Class StoredRecordHeader
1 byte - status compressed int - record identifier compressed long - overflow page } only if hasOverflow() is true compressed int - overflow id } " " " compressed int - first field } only if hasFirstField set - otherwise 0 compressed int - number of fields in this portion - only if hasOverflow() is false OR hasFirstField is true - otherwise 0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Class which holds the fieldsoverflowId
,overflowPage
andfirstField
, which are not needed when there is no overflow. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RecordHandle
A record handle that can represent the record, may be null.protected int
Actual identifier of the record
MT - Mutablestatic final int
maximum length for row containing just an overflow pointer.protected int
number of fields in the row.private StoredRecordHeader.OverflowInfo
private static final byte
Status bits for the record header: RECORD_DELETED - used to indicate the record has been deleted RECORD_OVERFLOW - used to indicate the record has been overflowed, it will point to the overflow page and ID RECORD_HAS_FIRST_FIELD - used to indicate that firstField is stored.private static final byte
private static final byte
private static final byte
private byte
Status of the record. -
Constructor Summary
ConstructorsConstructorDescriptionConstructors for This class:StoredRecordHeader
(byte[] data, int offset) StoredRecordHeader
(int id, int numberFields) StoredRecordHeader
(StoredRecordHeader loadTargetFrom) -
Method Summary
Modifier and TypeMethodDescriptionint
protected RecordHandle
Get a record handle for the record.final int
getId()
Get the record identifier
MT - thread safeint
int
long
static final int
getStoredSizeRecordId
(int record_id) Return length on disk of the record id portion of the record header Record id is part of the record header and is stored in an internal compressed format.protected final boolean
final boolean
final boolean
Get the deleted state of the record.private void
read
(byte[] data, int offset) void
read
(ObjectInput in) private int
readFirstField
(byte[] data, int offset) private void
readNumberFields
(byte[] data, int offset) private int
readOverFlowId
(byte[] data, int offset) private int
readOverFlowPage
(byte[] data, int offset) int
setDeleted
(boolean deleteTrue) Set the deleted state of the record.void
setFirstField
(int firstField) final void
setId
(int id) final void
setNumberFields
(int numberFields) void
setOverflowDetails
(RecordHandle overflowHandle) void
setOverflowFields
(StoredRecordHeader loadFromTarget) int
size()
return the size of the record header.toString()
int
write
(OutputStream out) Public Methods implmenting read/write of Storable Interface:
-
Field Details
-
RECORD_DELETED
private static final byte RECORD_DELETEDStatus bits for the record header: RECORD_DELETED - used to indicate the record has been deleted RECORD_OVERFLOW - used to indicate the record has been overflowed, it will point to the overflow page and ID RECORD_HAS_FIRST_FIELD - used to indicate that firstField is stored. When RECORD_OVERFLOW and RECORD_HAS_FIRST_FIELD both are set, part of record is on the page, the record header also stores the overflow pointer to the next part of the record. RECORD_VALID_MASK - A mask of valid bits that can be set currently, such that the following assert can be made: ASSERT((status & ~RECORD_VALID_MASK) == 0))- See Also:
-
RECORD_OVERFLOW
private static final byte RECORD_OVERFLOW- See Also:
-
RECORD_HAS_FIRST_FIELD
private static final byte RECORD_HAS_FIRST_FIELD- See Also:
-
RECORD_VALID_MASK
private static final byte RECORD_VALID_MASK- See Also:
-
MAX_OVERFLOW_ONLY_REC_SIZE
public static final int MAX_OVERFLOW_ONLY_REC_SIZEmaximum length for row containing just an overflow pointer.The maximum stored length of a row that just contains an overflow pointer is 17 bytes: stored sizeof(status byte) : 1 + stored sizeof(record id) : 4 + max stored size overflow page ptr: 8 + max stored size overflow record id: 4
- See Also:
-
id
protected int idActual identifier of the record
MT - Mutable -
status
private byte statusStatus of the record. See above for description of fields: RECORD_DELETED RECORD_OVERFLOW RECORD_HAS_FIRST_FIELD RECORD_VALID_MASK
MT - Mutable - single thread required. -
numberFields
protected int numberFieldsnumber of fields in the row. -
handle
A record handle that can represent the record, may be null. -
overflow
-
-
Constructor Details
-
StoredRecordHeader
public StoredRecordHeader()Constructors for This class: -
StoredRecordHeader
public StoredRecordHeader(int id, int numberFields) -
StoredRecordHeader
public StoredRecordHeader(byte[] data, int offset) -
StoredRecordHeader
-
-
Method Details
-
getHandle
Get a record handle for the record.
MT - single thread required -
getId
public final int getId()Get the record identifier
MT - thread safe -
getNumberFields
public int getNumberFields() -
getOverflowPage
public long getOverflowPage() -
getOverflowId
public int getOverflowId() -
getFirstField
public int getFirstField() -
hasOverflow
public final boolean hasOverflow() -
hasFirstField
protected final boolean hasFirstField() -
isDeleted
public final boolean isDeleted()Get the deleted state of the record.
MT - single thread required -
size
public int size()return the size of the record header.Calculates the size of the record header, mostly used to allow a reader to skip over the record header and position on the 1st field of the record.
This low level routine is performance critical to processing lots of rows, so calls to CompressNumber have been hand inlined.
- Returns:
- The length of the record header.
-
setDeleted
public int setDeleted(boolean deleteTrue) Set the deleted state of the record.return 1, if delete status from not deleted to deleted return -1, if delete status from deleted to not deleted return 0, if status unchanged.
MT - single thread required -
setFirstField
public void setFirstField(int firstField) -
setId
public final void setId(int id) -
setOverflowDetails
-
setOverflowFields
-
setNumberFields
public final void setNumberFields(int numberFields) -
write
Public Methods implmenting read/write of Storable Interface:- Throws:
IOException
-
read
- Throws:
IOException
-
readOverFlowPage
private int readOverFlowPage(byte[] data, int offset) -
readOverFlowId
private int readOverFlowId(byte[] data, int offset) -
readFirstField
private int readFirstField(byte[] data, int offset) -
readNumberFields
private void readNumberFields(byte[] data, int offset) -
read
private void read(byte[] data, int offset) -
getStoredSizeRecordId
public static final int getStoredSizeRecordId(int record_id) Return length on disk of the record id portion of the record header Record id is part of the record header and is stored in an internal compressed format. The length of this format depends on the value of the record id.- Returns:
- length of encoded record id on disk.
-
toString
-