Expand description
Binary edge key encoding for the graph overlay.
Replaces the previous UTF-8 string key format with compact binary keys that support efficient prefix scans and maintain lexicographic ordering.
§Key Layout
All keys start with a one-byte tag that identifies the key type:
| Tag | Kind | Format |
|---|---|---|
| 0x01 | Node | [0x01][ns_hash: 4B][table_hash: 4B][tag: 1B][id_bytes] |
| 0x02 | Edge | [0x02][ns_hash: 4B][from_key...][et_hash: 4B][to_key...] |
| 0x03 | Reverse Index | [0x03][ns_hash: 4B][et_hash: 4B][to_key...][from_key...] |
Where from_key / to_key are [table_hash: 4B][tag: 1B][id_bytes] (the RecordId key).
The namespace hash ensures graphs in different namespaces never collide. All hashes are FNV-1a 32-bit, big-endian encoded for sort ordering.
Structs§
- Decoded
Edge Key - Decoded edge key components.
- Decoded
Edge Value - Edge value decoded components.
- Decoded
Reverse Key - Decoded reverse index key components.
Functions§
- decode_
edge_ key - Decode an edge key (tag 0x02) into its components.
- decode_
edge_ value - Decode an edge value.
- decode_
node_ value - Decode a node value into (node_type, properties).
- decode_
properties - Decode a
HashMap<String, SochValue>from compact binary encoding. - decode_
reverse_ key - Decode a reverse index key (tag 0x03) into its components.
- edge_
from_ prefix - Build an edge prefix for scanning all edges from a node.
- edge_
from_ type_ prefix - Build an edge prefix for scanning edges of a specific type from a node.
- edge_
key - Build an edge storage key.
- edge_
prefix - Build an edge prefix for scanning all edges in a namespace.
- encode_
edge_ value - Encode an edge value (from_table, from_id_display, edge_type, to_table, to_id_display + properties).
- encode_
node_ value - Encode a node value (node_type + properties) as binary.
- encode_
properties - Encode a
HashMap<String, SochValue>as a compact binary value. - node_
key - Build a node storage key.
- node_
prefix - Build a node prefix for scanning all nodes in a namespace.
- node_
table_ prefix - Build a node prefix for scanning all nodes of a specific table in a namespace.
- reverse_
key - Build a reverse index key.
- reverse_
prefix - Build a reverse index prefix for all reverse entries in a namespace.
- reverse_
type_ to_ prefix - Build a reverse index prefix for all edges of a given type pointing to a node.