|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.util.bplus.PositionDependentNodeSizeStrategy
public class PositionDependentNodeSizeStrategy
This NodeSizeStrategy
gives node sizes that depend on where in the
file they are stored. It keeps a map of position - size pairs and a default
node size for the positions not present in the map.
This is most commonly used to give the first node in the file a smaller size to be able to accommodate header information in the file without having the contents of the root node spill over into the next disk block.
Warning! Don't let node sizes vary too much! Two of the smallest nodes need to be able to accommodate all the records in one of the largest node +1. (This is a requirement when splitting nodes.)
Constructor Summary | |
---|---|
PositionDependentNodeSizeStrategy(int defaultSize,
Map<Long,Integer> nodeSizes)
|
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? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PositionDependentNodeSizeStrategy(int defaultSize, Map<Long,Integer> nodeSizes) throws IllegalArgumentException
IllegalArgumentException
Method Detail |
---|
public int getMaxNumberOfRecordsPerNode(int nodeHeaderSize, int recordSize, long pos)
NodeSizeStrategy
getMaxNumberOfRecordsPerNode
in interface NodeSizeStrategy
nodeHeaderSize
- The size of the node header.recordSize
- The size of a record.pos
- The position of the node in the file.
public int getNodeSize(int nodeHeaderSize, int recordSize, long pos)
NodeSizeStrategy
getNodeSize
in interface NodeSizeStrategy
nodeHeaderSize
- The size of the node header.recordSize
- The size of a record.pos
- The position of the node in the file.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |