Skip to main content

Module edge_encoding

Module edge_encoding 

Source
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:

TagKindFormat
0x01Node[0x01][ns_hash: 4B][table_hash: 4B][tag: 1B][id_bytes]
0x02Edge[0x02][ns_hash: 4B][from_key...][et_hash: 4B][to_key...]
0x03Reverse 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§

DecodedEdgeKey
Decoded edge key components.
DecodedEdgeValue
Edge value decoded components.
DecodedReverseKey
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.