public class IndexSegmentAddressManager extends WormAddressManager
Address manager supporting offsets that are encoded for one of several
regions in an IndexSegmentStore
. The regions are identified by a
IndexSegmentRegion
, which gets encoded into the offset component of
the address. The offsets are relative to the start of the identified regions.
The IndexSegmentCheckpoint
record gives the start of each region.
Together with IndexSegmentRegion
, this class class provides a
workaround for node offsets (which are relative to the start of the nodes
block) in contrast to leaf offsets (which are relative to a known offset from
the start of the index segment file). This condition arises as a side effect
of serializing nodes at the same time that the IndexSegmentBuilder
is
serializing leaves such that we can not group the nodes and leaves into
distinct regions and know the absolute offset to each node or leaf as it is
serialized.
The offsets for blobs are likewise relative to the start of a
IndexSegmentRegion.BLOB
region. The requirement for a blob region
arises in a similar manner: blobs are serialized during the
IndexSegmentBuilder
operation onto a buffer and then bulk copied onto
the output file. This means that only the relative offset into the blob
region is available at the time that the blob's address is written in an
index entry's value.
Modifier and Type | Field and Description |
---|---|
protected long |
extentBlobs
#of bytes in the blobs region.
|
protected long |
extentLeaves
#of bytes in the leaves region.
|
protected long |
extentNodes
#of bytes in the nodes region.
|
protected long |
maxOffset
The maximum offset (aka the #of bytes in the file).
|
protected long |
offsetBlobs
The offset within the file of the start of the blob region.
|
protected long |
offsetLeaves
The offset within the file of the start of the leaves region.
|
protected long |
offsetNodes
The offset within the file of the start of the node region.
|
_NULL_, MAX_OFFSET_BITS, MIN_OFFSET_BITS, SCALE_OUT_OFFSET_BITS, SCALE_UP_OFFSET_BITS
NULL
Constructor and Description |
---|
IndexSegmentAddressManager(IndexSegmentCheckpoint checkpoint) |
Modifier and Type | Method and Description |
---|---|
long |
getOffset(long addr)
Decodes the offset to extract the
IndexSegmentRegion and then
applies the appropriate offset for that region in order to convert the
offset into an absolute offset into the store. |
IndexSegmentRegion |
getRegion(long addr)
Return the region relative to which this address was encoded.
|
boolean |
isLeafAddr(long addr)
Return
true IFF the starting address lies entirely within
the region dedicated to the B+Tree leaves. |
boolean |
isNodeAddr(long addr)
Return
true IFF the starting address lies entirely within
the region dedicated to the B+Tree nodes. |
String |
toString(long addr)
Returns a representation of the address with the decoded offset and
the region to which that offset is relative.
|
assertByteCount, assertOffset, assertOffsetBits, getByteCount, getMaxByteCount, getMaxByteCount, getMaxOffset, getOffsetBits, getPhysicalAddress, main, toAddr, toString
protected final long offsetLeaves
protected final long extentLeaves
protected final long offsetNodes
protected final long extentNodes
protected final long offsetBlobs
protected final long extentBlobs
protected final long maxOffset
public IndexSegmentAddressManager(IndexSegmentCheckpoint checkpoint)
checkpoint
- public final IndexSegmentRegion getRegion(long addr)
Note: ANY address MAY be encoded relative to the
IndexSegmentRegion.BASE
region. However, choosing
IndexSegmentRegion.NODE
or IndexSegmentRegion.BLOB
regions does restrict the address to referencing a node (or blob)
respectively.
addr
- The address.public final long getOffset(long addr)
IndexSegmentRegion
and then
applies the appropriate offset for that region in order to convert the
offset into an absolute offset into the store.getOffset
in interface IAddressManager
getOffset
in class WormAddressManager
addr
- The opaque identifier that is the within store locator for
some datum.public String toString(long addr)
toString
in interface IAddressManager
toString
in class WormAddressManager
addr
- The opaque identifier that is the within store locator for
some datum.public boolean isNodeAddr(long addr)
true
IFF the starting address lies entirely within
the region dedicated to the B+Tree nodes.public boolean isLeafAddr(long addr)
true
IFF the starting address lies entirely within
the region dedicated to the B+Tree leaves.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.