org.helidb.util.bplus
Interface NodeSizeStrategy

All Known Implementing Classes:
FixedSizeNodeSizeStrategy, NumberOfRecordsNodeSizeStrategy, PositionDependentNodeSizeStrategy

public interface NodeSizeStrategy

The node size strategy determines the size of a node in a B+ Tree when it is stored in a file by the FileBackedNodeRepository. A node is either a leaf node containing data records or a non-leaf node containing pointers to child nodes.

Implementations of this interface should be immutable.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
helidb-core

Method Summary
 int getMaxNumberOfRecordsPerNode(int nodeHeaderSize, int recordSize, long pos)
          Given the supplied size of the node header and records, how many records will fit in a node?
 int getNodeSize(int nodeHeaderSize, int recordSize, long pos)
          Given the supplied size of the node header and records, how many bytes will a node occupy?
 

Method Detail

getMaxNumberOfRecordsPerNode

int getMaxNumberOfRecordsPerNode(int nodeHeaderSize,
                                 int recordSize,
                                 long pos)
Given the supplied size of the node header and records, how many records will fit in a node?

Parameters:
nodeHeaderSize - The size of the node header.
recordSize - The size of a record.
pos - The position of the node in the file.
Returns:
The number of records that fit in a node.

getNodeSize

int getNodeSize(int nodeHeaderSize,
                int recordSize,
                long pos)
Given the supplied size of the node header and records, how many bytes will a node occupy?

Parameters:
nodeHeaderSize - The size of the node header.
recordSize - The size of a record.
pos - The position of the node in the file.
Returns:
The size of a node, in bytes.