com.bigdata.btree
Enum IndexSegmentRegion

java.lang.Object
  extended by java.lang.Enum<IndexSegmentRegion>
      extended by com.bigdata.btree.IndexSegmentRegion
All Implemented Interfaces:
Serializable, Comparable<IndexSegmentRegion>

public enum IndexSegmentRegion
extends Enum<IndexSegmentRegion>

Type-safe enumeration of the regions to which relative offsets may be constructed for an IndexSegmentStore.

Version:
$Id: IndexSegmentRegion.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
See Also:
IndexSegmentBuilder, IndexSegmentStore, IndexSegmentCheckpoint

Enum Constant Summary
BASE
          Offset is relative to the start of the backing file.
BLOB
          Offset is relative to the start of the blob region.
NODE
          Offset is relative to the start of the node region.
 
Field Summary
protected static long NBITS
          The #of bits that are used to indicate the IndexSegmentRegion on an encoded address.
 
Method Summary
 int code()
           
static long decodeOffset(long encodedOffset)
          Return the decoded offset (right-shifts by NBITS in order to strip off the bits used to encode the region).
static IndexSegmentRegion decodeRegion(long encodedOffset)
          Return the decoded region from an encoded offset.
 long encodeOffset(long offset)
          Encode an offset within a region.
static IndexSegmentRegion valueOf(String name)
          Returns the enum constant of this type with the specified name.
static IndexSegmentRegion[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BASE

public static final IndexSegmentRegion BASE
Offset is relative to the start of the backing file.

Note: The BASE region runs from the start of the file until the end of the file and thus overlaps both the NODE and BLOB regions. Any address may be expressed within the BASE region.

Note: The leaves are not really their own region, but rather are found within the BASE region starting at [leavesOffset] and running for [leavesExtent] bytes.


NODE

public static final IndexSegmentRegion NODE
Offset is relative to the start of the node region. This region contains only the nodes.


BLOB

public static final IndexSegmentRegion BLOB
Offset is relative to the start of the blob region. This region contains only raw records used for blob references.

Field Detail

NBITS

protected static final long NBITS
The #of bits that are used to indicate the IndexSegmentRegion on an encoded address. Since the address is encoded in a 64-bit long, the #of bits available to encode the offset and byteCount of the address is reduced by this many bits.

See Also:
Constant Field Values
Method Detail

values

public static IndexSegmentRegion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (IndexSegmentRegion c : IndexSegmentRegion.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static IndexSegmentRegion valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

code

public int code()

encodeOffset

public long encodeOffset(long offset)
Encode an offset within a region. The address is left shifted by NBITS and the low bits are set to indicate the region that identifies the base for the offset.

Note: This effectively reduces the maximum usable offset for the IndexSegmentStore by NBITS

Parameters:
offset - The offset of the allocation.
Returns:
The encoded offset.

decodeRegion

public static IndexSegmentRegion decodeRegion(long encodedOffset)
Return the decoded region from an encoded offset.

Parameters:
encodedOffset - The encoded offset.
Returns:
The decoded region.

decodeOffset

public static long decodeOffset(long encodedOffset)
Return the decoded offset (right-shifts by NBITS in order to strip off the bits used to encode the region). The returned offset is relative to the encoded region. The caller MUST adjust the offset appropriately in order to de-reference the record in the store.

Parameters:
encodedOffset - The encoded offset.
Returns:
The decoded offset.


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