001: /*
002:
003: Derby - Class org.apache.derby.impl.store.raw.data.PageActions
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.store.raw.data;
023:
024: import org.apache.derby.iapi.services.io.FormatableBitSet;
025: import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream;
026:
027: import org.apache.derby.iapi.error.StandardException;
028:
029: import org.apache.derby.iapi.store.access.conglomerate.LogicalUndo;
030:
031: import org.apache.derby.iapi.store.raw.RecordHandle;
032: import org.apache.derby.iapi.store.raw.xact.RawTransaction;
033:
034: import org.apache.derby.iapi.types.DataValueDescriptor;
035:
036: public interface PageActions {
037:
038: /**
039: * Set the Delete status of the record at the given slot.
040: * <p>
041: * Subclass that implements this method has to call
042: * BasePage.setDeleteStatus to update the delete status on the in-memory
043: * slot table.
044: * <p>
045: * <BR> MT - latched, page is latched when this methods is called.
046: * @param t The transaction
047: * @param page the target page
048: * @param slot the slot number of the record
049: * @param recordId the recordID of the record
050: * @param delete set the delete status to this value
051: * @param undo logical undo logic if necessary
052: *
053: * @exception StandardException Standard Cloudscape error policy
054: * @see org.apache.derby.iapi.store.raw.Page#deleteAtSlot
055: **/
056: public void actionDelete(RawTransaction t, BasePage page, int slot,
057: int recordId, boolean delete, LogicalUndo undo)
058: throws StandardException;
059:
060: /**
061: * Update record at the given slot with this row.
062: * <p>
063: * <BR> MT - latched, page is latched when this methods is called.
064: *
065: * @param t The transaction
066: * @param page the updated page
067: * @param slot the slot number of the record
068: * @param recordId the recordID of the record
069: * @param row The new storable row
070: * @param validColumns the columns that needs to be updated
071: * @param realStartColumn the first column that is updated
072: * @param logBuffer where to prepare the log record
073: * @param realSpaceOnPage ??
074: * @param headRowHandle the record handle of the head row
075: *
076: * @return the next column to update in the row or,
077: * -1 if the update has been completed.
078: *
079: * @exception StandardException Standard Cloudscape error policy
080: *
081: * @see org.apache.derby.iapi.store.raw.Page#updateAtSlot
082: **/
083: public int actionUpdate(RawTransaction t, BasePage page, int slot,
084: int recordId, Object[] row, FormatableBitSet validColumns,
085: int realStartColumn,
086: DynamicByteArrayOutputStream logBuffer,
087: int realSpaceOnPage, RecordHandle headRowHandle)
088: throws StandardException;
089:
090: /**
091: * Purge the record at the given slot.
092: * <p>
093: * Subclass that implements this method has to remove the slot from the
094: * base page in-memory slot table (removeAndShiftDown).
095: * <p>
096: * <BR> MT - latched, page is latched when this methods is called.
097: *
098: * @param t The transaction
099: * @param slot the starting slot number of the record
100: * @param num_rows how many rows to purge
101: * @param recordIds the recordIDs of the record (an array of num_rows)
102: *
103: * @exception StandardException Standard Cloudscape error policy
104: *
105: * @see org.apache.derby.iapi.store.raw.Page#purgeAtSlot
106: **/
107: public void actionPurge(RawTransaction t, BasePage page, int slot,
108: int num_rows, int[] recordIds, boolean logData)
109: throws StandardException;
110:
111: /**
112: * Update a field of the record at the given slot with this value.
113: * <p>
114: *
115: * <BR> MT - latched, page is latched when this methods is called.
116: *
117: * @param t The transaction
118: * @param slot the slot number of the record
119: * @param recordId the recordID of the record
120: * @param fieldId the fieldId of the value
121: * @param newValue the new value for the field
122: * @param undo if logical undo may be necessary, a function
123: * pointer to the access code where the logical undo
124: * logic resides. Null if logical undo is not
125: * necessary.
126: *
127: * @exception StandardException Standard Cloudscape error policy
128: *
129: * @see org.apache.derby.iapi.store.raw.Page#updateFieldAtSlot
130: *
131: **/
132: public void actionUpdateField(RawTransaction t, BasePage page,
133: int slot, int recordId, int fieldId, Object newValue,
134: LogicalUndo undo) throws StandardException;
135:
136: /**
137: * Insert record at the given slot with this recordId.
138: * <p>
139: *
140: * <BR> MT - latched, page is latched when this methods is called.
141: *
142: * @param t The transaction
143: * @param slot the slot number of the record
144: * @param recordId the recordID of the record
145: * @param row The storable row
146: * @param undo if logical undo may be necessary, a function
147: * pointer to the access code where the logical
148: * undo logic resides. Null if logical undo is
149: * not necessary.
150: * @param insertFlag see Page value for insertFlag
151: *
152: * @exception StandardException Standard Cloudscape error policy
153: *
154: * @see org.apache.derby.iapi.store.raw.Page#insertAtSlot
155: **/
156: public int actionInsert(RawTransaction t, BasePage page, int slot,
157: int recordId, Object[] row, FormatableBitSet validColumns,
158: LogicalUndo undo, byte insertFlag, int startColumn,
159: boolean isLongColumn, int realStartColumn,
160: DynamicByteArrayOutputStream logBuffer,
161: int realSpaceOnPage, int overflowThreshold)
162: throws StandardException;
163:
164: /**
165: * Copy num_rows from srcPage into deestpage.
166: * <p>
167: * Longer descrption of routine.
168: * <p>
169: * @param t The transaction
170: * @param destPage the destination page
171: * @param srcPage the source page
172: * @param destSlot starting slot # of destination page to copy to
173: * @param numRows the number of rows to be copied
174: * @param srcSlot starting slot number of source page to copy from
175: * @param recordIds an array of record ids to use in the
176: * destination page
177: *
178: * @exception StandardException Standard Cloudscape policy.
179: **/
180: public void actionCopyRows(RawTransaction t, BasePage destPage,
181: BasePage srcPage, int destSlot, int numRows, int srcSlot,
182: int[] recordIds) throws StandardException;
183:
184: /**
185: * Invalidate the page due to deallocation.
186: * Short one line description of routine.
187: * <p>
188: * Invalidate the page due to deallocation - this is the action on the page
189: * that is being deallocated as opposed to the action on the allocation
190: * page.
191: * <p>
192: *
193: * @param t The transaction
194: * @param page that page to be invalidated
195: *
196: * @exception StandardException Standard Cloudscape policy.
197: **/
198: public void actionInvalidatePage(RawTransaction t, BasePage page)
199: throws StandardException;
200:
201: /**
202: * Initialize the page due to allocation.
203: * <p>
204: * Initialize the page due to allocation - this page could be brand new or
205: * it could be being re-allocated.
206: * <p>
207: *
208: * @param t The transaction
209: * @param page that page to be initialized
210: * @param initFlag flags set to values in BasePage.INIT_PAGE_*
211: * which indicates how the new page is to be
212: * initialized.
213: * @param pageFormatId The format Id of the page being initialized.
214: *
215: * @exception StandardException Standard Cloudscape policy.
216: **/
217: public void actionInitPage(RawTransaction t, BasePage page,
218: int initFlag, int pageFormatId, long pageOffset)
219: throws StandardException;
220:
221: /**
222: * Shrink the reserved space to the new value.
223: * <p>
224: * Shrink the reserved space to the new value. This action is not undoable.
225: * <p>
226: * @param t The transaction
227: * @param page that page to be initialized
228: * @param slot the slot number of the record
229: * @param recordId the recordID of the record
230: * @param newValue the new reserved space value
231: *
232: * @exception StandardException Unexpected exception from the implementation
233: *
234: **/
235: public void actionShrinkReservedSpace(RawTransaction t,
236: BasePage page, int slot, int recordId, int newValue,
237: int oldValue) throws StandardException;
238: }
|