com.bigdata.btree.data
Interface ILeafData

All Superinterfaces:
IAbstractNodeData, IDataRecordAccess, IKeysData
All Known Implementing Classes:
IndexSegment.ImmutableNodeFactory.ImmutableLeaf, IndexSegmentBuilder.SimpleLeafData, Leaf, MutableBucketData, MutableLeafData, ResultSet

public interface ILeafData
extends IAbstractNodeData, IKeysData

Interface for low-level data access for the leaves of a B+-Tree.

Version:
$Id: ILeafData.java 4523 2011-05-18 18:14:45Z thompsonbry $
Author:
Bryan Thompson

Method Summary
 boolean getDeleteMarker(int index)
          Return true iff the entry at the specified index is marked as deleted.
 long getNextAddr()
          The address of the next leaf in key order, 0L if it is known that there is no next leaf, and -1L if either: (a) it is not known whether there is a next leaf; or (b) it is known but the address of that leaf is not known to the caller.
 long getPriorAddr()
          The address of the previous leaf in key order, 0L if it is known that there is no previous leaf, and -1L if either: (a) it is not known whether there is a previous leaf; or (b) it is known but the address of that leaf is not known to the caller.
 long getRawRecord(int index)
          Return the address of the raw record on the backing store of the value stored in the tuple having the given index -or- IAddressManager.NULL if the value is the actual byte[] value associated with the key in the leaf.
 int getValueCount()
          The #of values in the leaf (this MUST be equal to the #of keys for a leaf).
 IRaba getValues()
          Return the object storing the logical byte[][] containing the values for the leaf.
 long getVersionTimestamp(int index)
          The version timestamp for the entry at the specified index.
 boolean hasDeleteMarkers()
          Return true iff the leaf maintains delete markers.
 boolean hasRawRecords()
          Return true iff the leaf promotes large byte[] values to raw records on the backing store.
 boolean hasVersionTimestamps()
          Return true iff the leaf maintains version timestamps.
 boolean isDoubleLinked()
          Return true if the leaf data record supports encoding of the address of the previous and next leaf in the B+Tree order.
 
Methods inherited from interface com.bigdata.btree.data.IAbstractNodeData
data, getMaximumVersionTimestamp, getMinimumVersionTimestamp, isCoded, isLeaf, isReadOnly
 
Methods inherited from interface com.bigdata.btree.data.IKeysData
getKeyCount, getKeys
 

Method Detail

getValueCount

int getValueCount()
The #of values in the leaf (this MUST be equal to the #of keys for a leaf).

Returns:
The #of values in the leaf.

getValues

IRaba getValues()
Return the object storing the logical byte[][] containing the values for the leaf. When the leaf maintains delete markers you MUST check whether or not the tuple is deleted before requesting its value.

Note: When the leaf maintains raw records you MUST check whether or not the value was written onto a raw record before interpreting the data returned by IRaba.get(int). If the length of the value exceeded the configured maximum record length for the index, then the value was written onto a raw record on the backing store and IRaba.get(int) will return the encoded address of that record rather than its data.

See Also:
hasDeleteMarkers(), getDeleteMarker(int)

getVersionTimestamp

long getVersionTimestamp(int index)
The version timestamp for the entry at the specified index.

Returns:
The version timestamp for the index entry.
Throws:
IndexOutOfBoundsException - unless index is in [0:ntuples-1].
UnsupportedOperationException - if version timestamps are not being maintained (they are only required for indices on which transaction processing will be used).

getDeleteMarker

boolean getDeleteMarker(int index)
Return true iff the entry at the specified index is marked as deleted.

Throws:
IndexOutOfBoundsException - unless index is in [0:ntuples-1].
UnsupportedOperationException - if delete markers are not being maintained.

getRawRecord

long getRawRecord(int index)
Return the address of the raw record on the backing store of the value stored in the tuple having the given index -or- IAddressManager.NULL if the value is the actual byte[] value associated with the key in the leaf. When the value is the address of a raw record, the actual byte[] value should be read from the backing store using the decoded address.

Raw record addresses are created transparently when a large byte[] is associated with a key in the leaf. They are materialized transparently when the tuple associated with the leaf is read. They are deleted when the tuple associated with the leaf is deleted.

Note: Raw records are managed at the leaf, rather than the IRaba level, because there is not always a backing store associated with an IRaba object. This is similar to how deleted tuples are handled. However, IRabaCoders are responsible for coding the long address stored in the values raba. Raw records are only used for large byte[] values. Highly specialized IRabaCoders can avoid the potential for a conflict with their own coding scheme by ensuring that the index either will not promote large values to raw records or by refraining from inserting large values into the index.

Returns:
The address of the raw record -or- IAddressManager.NULL
Throws:
UnsupportedOperationException - if raw record markers are not being maintained.

hasVersionTimestamps

boolean hasVersionTimestamps()
Return true iff the leaf maintains version timestamps.

Specified by:
hasVersionTimestamps in interface IAbstractNodeData

hasDeleteMarkers

boolean hasDeleteMarkers()
Return true iff the leaf maintains delete markers.


hasRawRecords

boolean hasRawRecords()
Return true iff the leaf promotes large byte[] values to raw records on the backing store.


isDoubleLinked

boolean isDoubleLinked()
Return true if the leaf data record supports encoding of the address of the previous and next leaf in the B+Tree order.


getPriorAddr

long getPriorAddr()
The address of the previous leaf in key order, 0L if it is known that there is no previous leaf, and -1L if either: (a) it is not known whether there is a previous leaf; or (b) it is known but the address of that leaf is not known to the caller.

Throws:
UnsupportedOperationException - if the leaf data record is not double-linked.

getNextAddr

long getNextAddr()
The address of the next leaf in key order, 0L if it is known that there is no next leaf, and -1L if either: (a) it is not known whether there is a next leaf; or (b) it is known but the address of that leaf is not known to the caller.

Throws:
UnsupportedOperationException - if the leaf data record is not double-linked.


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.