public class Checkpoint extends Object implements ICheckpoint, Externalizable
Note: In order to create a btree use
BTree.create(IRawStore, IndexMetadata) to write the initial
IndexMetadata record and the initial check point on the store. It
will then load the BTree from the Checkpoint record and
you can start using the index.
| Constructor and Description |
|---|
Checkpoint()
De-serialization ctor.
|
Checkpoint(BTree btree)
Creates a
Checkpoint record from a BTree. |
Checkpoint(HTree htree)
Creates a
Checkpoint record from an HTree. |
Checkpoint(IndexMetadata metadata)
Create the first checkpoint record for a new
BTree from a
IndexMetadata record. |
Checkpoint(IndexMetadata metadata,
Checkpoint oldCheckpoint)
|
Checkpoint(Stream stream)
Creates a
Checkpoint record from an HTree. |
| Modifier and Type | Method and Description |
|---|---|
static ICheckpointProtocol |
create(IRawStore store,
IndexMetadata metadata)
Generic method to create a persistence capable data structure (GIST
compatible, core implementation).
|
long |
getBloomFilterAddr()
Address of the
IBloomFilter. |
long |
getCheckpointAddr()
The address used to read this
Checkpoint record from the store. |
long |
getCounter()
Return the value of the B+Tree local counter stored in the
Checkpoint record. |
long |
getEntryCount()
The #of index entries (aka tuple count).
|
int |
getGlobalDepth()
The global depth of the root directory (HTree only).
|
int |
getHeight()
The height of a B+Tree.
|
IndexTypeEnum |
getIndexType()
The type of index for this checkpoint record.
|
long |
getLeafCount()
The #of leaves (B+Tree), hash buckets (HTree), or ZERO (0) for a solution
set stream.
|
long |
getMetadataAddr()
Address that can be used to read the
IndexMetadata record for the
index from the store. |
long |
getNodeCount()
The #of non-leaf nodes (B+Tree) or directories (HTree).
|
long |
getRecordVersion()
Return the value of the next record version number to be assigned that is
stored in the
Checkpoint record. |
long |
getRootAddr()
Address of the root node or leaf of the
BTree. |
boolean |
hasCheckpointAddr()
Return
true iff the checkpoint address is defined. |
static Checkpoint |
load(IRawStore store,
long addrCheckpoint)
Read a
Checkpoint record from a store. |
static ICheckpointProtocol |
loadFromCheckpoint(IRawStore store,
long checkpointAddr,
boolean readOnly)
Utility method reads the
Checkpoint record and then loads and
returns a view of the associated read-only persistence capable data
structure. |
void |
readExternal(ObjectInput in) |
String |
toString()
A human readable representation of the state of the
Checkpoint
record. |
void |
write(IRawStore store)
Write the
Checkpoint record on the store, setting
addrCheckpoint as a side effect. |
void |
writeExternal(ObjectOutput out) |
public Checkpoint()
public Checkpoint(IndexMetadata metadata)
BTree from a
IndexMetadata record. The root of the BTree will NOT
exist (its address will be 0L). Once written on the store
the Checkpoint record may be used to obtain a corresponding
instance of a BTree object.metadata - The index metadata record.public Checkpoint(IndexMetadata metadata, Checkpoint oldCheckpoint)
BTree when it
is propagated on overflow onto a new backing IRawStore. The
counter is propagated to the new Checkpoint but
otherwise the initialization is as if for an empty BTree.metadata - The index metadata record.oldCheckpoint - The last Checkpoint for the index on the old backing
store. The counter is propagated to the new
Checkpoint record.public Checkpoint(BTree btree)
Checkpoint record from a BTree.
Pre-conditions:
null then the root is assumed to be
clean and the root address from the last Checkpoint record is
used. Otherwise the address of the root is used (in which case it MUST be
defined).
Note: This method is invoked by reflection.
btree - The btree.public Checkpoint(HTree htree)
Checkpoint record from an HTree.
Pre-conditions:
null then the root is assumed to be
clean and the root address from the last Checkpoint record is
used. Otherwise the address of the root is used (in which case it MUST be
defined).
Note: This method is invoked by reflection.
htree - The HTree.public Checkpoint(Stream stream)
Checkpoint record from an HTree.
Pre-conditions:
null then the root is assumed to be
clean and the root address from the last Checkpoint record is
used. Otherwise the address of the root is used (in which case it MUST be
defined).
Note: This method is invoked by reflection.
stream - The HTree.public final long getCheckpointAddr()
ICheckpointCheckpoint record from the store.
Note: This is set as a side-effect by #write(IRawStore).
getCheckpointAddr in interface ICheckpointpublic final boolean hasCheckpointAddr()
ICheckpointtrue iff the checkpoint address is defined.hasCheckpointAddr in interface ICheckpointpublic final long getMetadataAddr()
ICheckpointIndexMetadata record for the
index from the store.getMetadataAddr in interface ICheckpointpublic final long getRootAddr()
ICheckpointBTree.getRootAddr in interface ICheckpoint0L iff the index does
not have a root page.public final long getBloomFilterAddr()
ICheckpointIBloomFilter.getBloomFilterAddr in interface ICheckpoint0L iff the
index does not have a bloom filter.public final int getHeight()
getHeight in interface ICheckpointIndexTypeEnum.BTreepublic final int getGlobalDepth()
getGlobalDepth in interface ICheckpointIndexTypeEnum.HTreepublic final long getNodeCount()
ICheckpointgetNodeCount in interface ICheckpointpublic final long getLeafCount()
ICheckpointgetLeafCount in interface ICheckpointpublic final long getEntryCount()
ICheckpointgetEntryCount in interface ICheckpointpublic final long getCounter()
ICheckpointCheckpoint record.getCounter in interface ICheckpointpublic final long getRecordVersion()
ICheckpointCheckpoint record. This number is incremented each
time a node or leaf is written onto the backing store. The initial value
is ZERO (0). The first value assigned to a node or leaf will be ZERO (0).getRecordVersion in interface ICheckpointpublic final IndexTypeEnum getIndexType()
ICheckpointgetIndexType in interface ICheckpointpublic final String toString()
Checkpoint
record.public final void write(IRawStore store)
Checkpoint record on the store, setting
addrCheckpoint as a side effect.store - IllegalStateException - if the Checkpoint record has already been
written.public static Checkpoint load(IRawStore store, long addrCheckpoint)
Checkpoint record from a store.store - The store.addrCheckpoint - The address from which to read the Checkpoint
record. This address is set on the Checkpoint
record as a side-effect.public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic static ICheckpointProtocol loadFromCheckpoint(IRawStore store, long checkpointAddr, boolean readOnly)
Checkpoint record and then loads and
returns a view of the associated read-only persistence capable data
structure.
Note: The caller is responsible for marking the returned object
as read-only or not depending on the context. This method should be used
from trusted code such as Name2Addr and AbstractJournal
which can make this decision.
store - The backing store.checkpointAddr - The address of the checkpoint record.readOnly - true if the object will be read-only.public static ICheckpointProtocol create(IRawStore store, IndexMetadata metadata)
store - The backing store.metadata - The metadata that describes the data structure to be created.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.