com.bigdata.btree.data
Class AbstractReadOnlyNodeData<U extends IAbstractNodeData>

java.lang.Object
  extended by com.bigdata.btree.data.AbstractReadOnlyNodeData<U>

public abstract class AbstractReadOnlyNodeData<U extends IAbstractNodeData>
extends Object

Abstract base class for a read-only view of the data for B+Tree node or leaf. The data are stored in a ByteBuffer. Access to the keys, values and other metadata are via operations on that ByteBuffer.

Version:
$Id: AbstractReadOnlyNodeData.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected static short DELTA_VERSION_TIMESTAMPS
          Bit flag indicating that the tuple revision timestamps have been written out using an array n-bit deltas computed as maxTimestamp - minTimestamp, where n is the number of bits required to code (maxTimestamp - minTimestamp).
protected static short FLAG_DELETE_MARKERS
          Bit flag for a leaf carrying delete markers for each tuple.
protected static short FLAG_VERSION_TIMESTAMPS
          Bit flag for a leaf carrying version timestamps for each tuple.
protected static byte LEAF
          A B+Tree leaf data record.
protected static byte LINKED_LEAF
          A B+Tree leaf data record with with priorAddr and nextAddr fields.
protected static byte NODE
          A B+Tree node data record.
static int O_NEXT
          The offset of the long field which codes the address of the next leaf.
static int O_PRIOR
          The offset of the long field which codes the address of the previous leaf.
static int O_TYPE
          The offset of the byte field which codes the type of the node or leaf.
protected static int SIZEOF_ADDR
          The size of a field in the data record which encodes the address of a child node or leaf.
protected static int SIZEOF_ENTRY_COUNT
          The size of the field in the data record which encodes the #of tuples spanned by a node.
protected static int SIZEOF_FLAGS
          The size of the field in the data record which encodes bit flags for the node or leaf.
protected static int SIZEOF_KEYS_SIZE
          The size of the field in the data record which encodes the #of bytes in the coded keys (or the coded values).
protected static int SIZEOF_NKEYS
          The size of the field in the data record which encodes the #of keys in the node or leaf.
protected static int SIZEOF_TIMESTAMP
          The size of a field in the data record which encodes the revision timestamp of a tuple in a leaf.
protected static int SIZEOF_TYPE
          The size of the field in the data record which encodes whether the data record represents a B+Tree NODE, a LEAF, or a LINKED_LEAF.
protected static int SIZEOF_VERSION
          The size of the field in the data record which encodes the serialization version of the data record.
protected static short VERSION0
          Version zero is the only version defined at this time.
 
Constructor Summary
protected AbstractReadOnlyNodeData()
          Core ctor.
 
Method Summary
static boolean isLeaf(byte b)
          Return true iff the byte indicates an ILeafData record.
static boolean isNode(byte b)
          Return true iff the byte indicates an INodeData record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE

protected static final byte NODE
A B+Tree node data record.

See Also:
Constant Field Values

LEAF

protected static final byte LEAF
A B+Tree leaf data record.

See Also:
Constant Field Values

LINKED_LEAF

protected static final byte LINKED_LEAF
A B+Tree leaf data record with with priorAddr and nextAddr fields. This is used for the leaves in an IndexSegment.

See Also:
Constant Field Values

VERSION0

protected static final short VERSION0
Version zero is the only version defined at this time.

See Also:
Constant Field Values

FLAG_DELETE_MARKERS

protected static final short FLAG_DELETE_MARKERS
Bit flag for a leaf carrying delete markers for each tuple.

See Also:
Constant Field Values

FLAG_VERSION_TIMESTAMPS

protected static final short FLAG_VERSION_TIMESTAMPS
Bit flag for a leaf carrying version timestamps for each tuple.

See Also:
Constant Field Values

DELTA_VERSION_TIMESTAMPS

protected static final short DELTA_VERSION_TIMESTAMPS
Bit flag indicating that the tuple revision timestamps have been written out using an array n-bit deltas computed as maxTimestamp - minTimestamp, where n is the number of bits required to code (maxTimestamp - minTimestamp). This is a relatively compact coding.

See Also:
Constant Field Values

SIZEOF_TYPE

protected static final int SIZEOF_TYPE
The size of the field in the data record which encodes whether the data record represents a B+Tree NODE, a LEAF, or a LINKED_LEAF.

See Also:
Constant Field Values

SIZEOF_VERSION

protected static final int SIZEOF_VERSION
The size of the field in the data record which encodes the serialization version of the data record. The offset of this field depends on whether the record is a node or leaf versus a linked leaf. For a linked leaf, the version information starts after the prior/next addr fields. Otherwise it starts immediately after the type field.

See Also:
Constant Field Values

SIZEOF_FLAGS

protected static final int SIZEOF_FLAGS
The size of the field in the data record which encodes bit flags for the node or leaf.

See Also:
Constant Field Values

SIZEOF_NKEYS

protected static final int SIZEOF_NKEYS
The size of the field in the data record which encodes the #of keys in the node or leaf. The #of children in a node is always nkeys+1.

See Also:
Constant Field Values

SIZEOF_KEYS_SIZE

protected static final int SIZEOF_KEYS_SIZE
The size of the field in the data record which encodes the #of bytes in the coded keys (or the coded values). This is an int32 because it is possible that an int16 would limit the size of records for RMI.

See Also:
Constant Field Values

SIZEOF_ENTRY_COUNT

protected static final int SIZEOF_ENTRY_COUNT
The size of the field in the data record which encodes the #of tuples spanned by a node.

See Also:
Constant Field Values

SIZEOF_ADDR

protected static final int SIZEOF_ADDR
The size of a field in the data record which encodes the address of a child node or leaf.

See Also:
Constant Field Values

SIZEOF_TIMESTAMP

protected static final int SIZEOF_TIMESTAMP
The size of a field in the data record which encodes the revision timestamp of a tuple in a leaf.

See Also:
Constant Field Values

O_TYPE

public static final int O_TYPE
The offset of the byte field which codes the type of the node or leaf.

See Also:
Constant Field Values

O_PRIOR

public static final int O_PRIOR
The offset of the long field which codes the address of the previous leaf. This field IS NOT present unless the record type is LINKED_LEAF.

See Also:
Constant Field Values

O_NEXT

public static final int O_NEXT
The offset of the long field which codes the address of the next leaf. This field IS NOT present unless the record type is LINKED_LEAF.

See Also:
Constant Field Values
Constructor Detail

AbstractReadOnlyNodeData

protected AbstractReadOnlyNodeData()
Core ctor. There are two basic use cases. One when you already have the ByteBuffer with the encoded node or leaf data and one when you have a mutable Node or Leaf and you want to persist it. In the latter case, the derived class allocates a ByteBuffer and encodes the data onto that buffer.

Method Detail

isNode

public static boolean isNode(byte b)
Return true iff the byte indicates an INodeData record.

Parameters:
b - The byte value.
Returns:

isLeaf

public static boolean isLeaf(byte b)
Return true iff the byte indicates an ILeafData record. Note that this will return true for both LEAF and LINKED_LEAF.

Parameters:
b - The byte value.
Returns:


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