Interface SoftBPlusTree.ValueSerializer<V>
- Type Parameters:
V- value type
- Enclosing class:
SoftBPlusTree<V>
public static interface SoftBPlusTree.ValueSerializer<V>
Serializes and deserializes values stored in leaf nodes. Values are written
contiguously after the key-parts section of a serialized leaf node, so the
serialized size of every value must be fixed or self-describing.
Important: every value in a leaf must serialize to exactly
serializedSize(V) bytes. The tree relies on this for in-place
value overwrites — when a key's value is replaced, only that value's
bytes are rewritten at a calculated offset within the serialized node,
without re-serializing the entire node.
-
Method Summary
Modifier and TypeMethodDescriptionread(ByteBuffer buffer) Reads a value frombufferstarting at its current position.intserializedSize(V value) Returns the number of bytes thatwrite(V, ByteBuffer)will produce forvalue.voidwrite(V value, ByteBuffer buffer) Writes the serialized form ofvalueintobufferstarting at the buffer's current position.
-
Method Details
-
write
Writes the serialized form ofvalueintobufferstarting at the buffer's current position. Must advance the position by exactlyserializedSize(value)bytes. -
read
Reads a value frombufferstarting at its current position. Must advance the position by exactly the number of bytes that were written bywrite(V, ByteBuffer)for this value. -
serializedSize
Returns the number of bytes thatwrite(V, ByteBuffer)will produce forvalue. Must be consistent withwrite(V, ByteBuffer)— the buffer position must advance by exactly this amount.
-