Encode and decode nodes from their binary format.
Node identifiers are assumed to fit into 64 bits.
Leaf node values are assumed to fit into 4 gibibytes.
-
decode(encoded)
- Decode node of any type.
-
decode_index(encoded)
- Decode an index node from its encoded byte string.
-
decode_leaf(encoded)
- Decode a leaf node from its encoded byte string.
-
encode(node)
- Encode a node of any type.
-
encode_index(node)
- Encode an index node as a byte string.
-
encode_leaf(node)
- Encode a leaf node as a byte string.
-
index_size(keys, values)
- Return size of an index node with the given pairs.
-
leaf_size(keys, values)
- Return size of a leaf node with the given pairs.
-
leaf_size_delta_add(old_size, value)
Return size of node that gets a new key/value pair added.
old_size is the old size of the node. The key must not already
have existed in the node.
-
leaf_size_delta_replace(old_size, old_value, new_value)
- Return size of node that gets a value replaced.
-
max_index_pairs(node_size)
- Return number of index pairs that fit in a node of a given size.
-
size(node)
- Return encoded size of a node, regardless of type.