|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.raw.data.StoredRecordHeader
public final class StoredRecordHeader
A class StoredPage uses to cache record headers by passing instances to BasePage, and to write stored versions of record headers. Format
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 | |
---|---|
private static class |
StoredRecordHeader.OverflowInfo
Class which holds the fields overflowId , overflowPage
and firstField , which are not needed when there is no
overflow. |
Field Summary | |
---|---|
protected RecordHandle |
handle
A record handle that can represent the record, may be null. |
protected int |
id
Actual identifier of the record MT - Mutable |
protected int |
numberFields
number of fields in the row. |
private StoredRecordHeader.OverflowInfo |
overflow
|
private static byte |
RECORD_DELETED
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 byte |
RECORD_HAS_FIRST_FIELD
|
private static byte |
RECORD_OVERFLOW
|
private static byte |
RECORD_VALID_MASK
|
private byte |
status
Status of the record. |
Constructor Summary | |
---|---|
StoredRecordHeader()
Constructors for This class: |
|
StoredRecordHeader(byte[] data,
int offset)
|
|
StoredRecordHeader(int id,
int numberFields)
|
|
StoredRecordHeader(StoredRecordHeader loadTargetFrom)
|
Method Summary | |
---|---|
int |
getFirstField()
|
protected RecordHandle |
getHandle(PageKey pageId,
int current_slot)
Get a record handle for the record. |
int |
getId()
Get the record identifier MT - thread safe |
int |
getNumberFields()
|
int |
getOverflowId()
|
long |
getOverflowPage()
|
static 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 boolean |
hasFirstField()
|
boolean |
hasOverflow()
|
boolean |
isDeleted()
Get the deleted state of the record. |
private void |
read(byte[] data,
int offset)
|
void |
read(java.io.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)
|
void |
setId(int id)
|
void |
setNumberFields(int numberFields)
|
void |
setOverflowDetails(RecordHandle overflowHandle)
|
void |
setOverflowFields(StoredRecordHeader loadFromTarget)
|
int |
size()
return the size of the record header. |
java.lang.String |
toString()
|
int |
write(java.io.OutputStream out)
Public Methods implmenting read/write of Storable Interface: |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final byte RECORD_DELETED
private static final byte RECORD_OVERFLOW
private static final byte RECORD_HAS_FIRST_FIELD
private static final byte RECORD_VALID_MASK
protected int id
private byte status
protected int numberFields
protected RecordHandle handle
private StoredRecordHeader.OverflowInfo overflow
Constructor Detail |
---|
public StoredRecordHeader()
public StoredRecordHeader(int id, int numberFields)
public StoredRecordHeader(byte[] data, int offset)
public StoredRecordHeader(StoredRecordHeader loadTargetFrom)
Method Detail |
---|
protected RecordHandle getHandle(PageKey pageId, int current_slot)
MT - single thread required
public final int getId()
public int getNumberFields()
public long getOverflowPage()
public int getOverflowId()
public int getFirstField()
public final boolean hasOverflow()
protected final boolean hasFirstField()
public final boolean isDeleted()
MT - single thread required
public int size()
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.
StandardException
- Standard exception policy.public int setDeleted(boolean deleteTrue)
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
public void setFirstField(int firstField)
public final void setId(int id)
public void setOverflowDetails(RecordHandle overflowHandle)
public void setOverflowFields(StoredRecordHeader loadFromTarget)
public final void setNumberFields(int numberFields)
public int write(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void read(java.io.ObjectInput in) throws java.io.IOException
java.io.IOException
private int readOverFlowPage(byte[] data, int offset)
private int readOverFlowId(byte[] data, int offset)
private int readFirstField(byte[] data, int offset)
private void readNumberFields(byte[] data, int offset)
private void read(byte[] data, int offset)
public static final int getStoredSizeRecordId(int record_id)
public java.lang.String toString()
toString
in class java.lang.Object
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |