|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
K - The type of keys in the node.public interface NodeRepository<K>
The BPlusTree uses a NodeRepository to store and retrieve
tree nodes.
When updating a tree, the BPlusTree may book nodes before actually
writing something to them. See bookPositionForLeafNode() and
bookPositionForNonLeafNode().
BPlusTree| Method Summary | |
|---|---|
long |
bookPositionForLeafNode()
Book a position for a future leaf node. |
long |
bookPositionForNonLeafNode()
Book a position for a future non-leaf node. |
void |
clear()
Remove all contents from the node repository. |
void |
close()
Close the node repository and release all its allocated resources. |
boolean |
compact()
Defragment the node repository to recover wasted disk space. |
void |
deleteNode(long pos,
boolean leafNode)
Delete the node at the supplied position. |
int |
getMaxNumberOfRecordsForLeafNode(long pos)
Get the maximum number of records for a leaf node in the tree at the supplied position. |
int |
getMaxNumberOfRecordsForNonLeafNode(long pos)
Get the maximum number of records for a non-leaf node in the tree at the supplied position. |
long |
getPositionOfRootNode()
Get the root node's position in the node repository. |
boolean |
leafNodeHasPointersToAdjacentLeafNodes()
Does leaf nodes have pointers to their adjacent leaf nodes? If so, the tree supports iteration. |
BPlusTreeNode<K,?> |
readNode(long pos,
K keyForFirstPointer)
Read the node at the supplied position. |
void |
replaceContentsWith(InputStream is,
long dataSize)
Replace the contents of the node repository with data read from the stream. |
void |
returnBookedLeafNodePosition(long p)
Return a previously booked position for a leaf node. |
void |
returnBookedNonLeafNodePosition(long p)
Return a previously booked position for a non-leaf node. |
void |
verifyRepositoryIntegrity()
Verify the node repository's integrity. |
long |
writeContentsTo(OutputStream os)
Write the contents of the node repository to the stream. |
K |
writeNode(BPlusTreeNode<K,?> node)
Write the node to the repository. |
| Method Detail |
|---|
int getMaxNumberOfRecordsForLeafNode(long pos)
NodeRepository's NodeSizeStrategy, and by what extra metadata
the NodeRepository stores for each leaf nodes.
pos - The position of the leaf node.
int getMaxNumberOfRecordsForNonLeafNode(long pos)
NodeRepository's NodeSizeStrategy, and by what extra metadata
the NodeRepository stores for each non-leaf nodes.
pos - The position of the non-leaf node.
long getPositionOfRootNode()
boolean leafNodeHasPointersToAdjacentLeafNodes()
true if leaf nodes have pointers to their adjacent leaf
nodes.long bookPositionForLeafNode()
returnBookedLeafNodePosition(long).
bookPositionForNonLeafNode(),
returnBookedLeafNodePosition(long)void returnBookedLeafNodePosition(long p)
p - The position to return.bookPositionForLeafNode(),
returnBookedNonLeafNodePosition(long)long bookPositionForNonLeafNode()
returnBookedNonLeafNodePosition(long).
bookPositionForLeafNode(),
returnBookedNonLeafNodePosition(long)void returnBookedNonLeafNodePosition(long p)
p - The position to return.bookPositionForNonLeafNode(),
returnBookedLeafNodePosition(long)
BPlusTreeNode<K,?> readNode(long pos,
K keyForFirstPointer)
pos - The position to read the node at. The root node has position
0.keyForFirstPointer - The key for the node's first pointer, if this
is a non-leaf node. The key for the root node's first pointer is null.
null if the node position is beyond the end
of the file.K writeNode(BPlusTreeNode<K,?> node)
node - The node to write.
void deleteNode(long pos,
boolean leafNode)
pos - The position of the node to delete.leafNode - Is the node to delete a leaf node?
long writeContentsTo(OutputStream os)
throws WrappedIOException
os - The stream to write to. The stream is not closed after
writing.
WrappedIOException - On I/O errors.
void replaceContentsWith(InputStream is,
long dataSize)
throws WrappedIOException,
NotEnoughDataException
is - The stream to read from. The stream is not closed after
reading.dataSize - The total number of bytes to read from the stream.
WrappedIOException - On I/O errors.
NotEnoughDataException - If there is not enough data available in
the stream.void clear()
boolean compact()
true if the node repository was defragmented, or false if there was nothing to defragment right now.void close()
void verifyRepositoryIntegrity()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||