Skip to main content

Module cypher_value_codec

Module cypher_value_codec 

Source
Expand description

MessagePack-based binary encoding for CypherValue (uni_common::Value).

§Design

All property values are stored as self-describing binary blobs in Arrow LargeBinary columns. Each blob has the format:

[tag_byte: u8][msgpack_payload: bytes]

The tag byte provides O(1) type identification without deserialization. MessagePack preserves int/float distinction natively (unlike JSON).

§Tag Constants

TagTypePayload
0Nullempty
1Boolmsgpack bool
2Intmsgpack i64
3Floatmsgpack f64
4Stringmsgpack string
5Listmsgpack array of recursively-encoded blobs
6Mapmsgpack map of string → recursively-encoded blobs
7Bytesmsgpack binary
8Nodemsgpack {vid, label, props}
9Edgemsgpack {eid, type, src, dst, props}
10Pathmsgpack {nodes, rels}
11Datemsgpack i32 (days since epoch)
12Timemsgpack i64 (nanoseconds since midnight)
13DateTimemsgpack i64 (nanoseconds since epoch)
14Durationmsgpack {months, days, nanos}
15Pointmsgpack {srid, coords}
16Vectormsgpack array of f32

Nested values (List elements, Map values, Node/Edge properties) are recursively encoded as [tag][payload] blobs.

Constants§

TAG_BOOL
TAG_BYTES
TAG_DATE
TAG_DATETIME
TAG_DURATION
TAG_EDGE
TAG_FLOAT
TAG_INT
TAG_LIST
TAG_LOCALDATETIME
TAG_LOCALTIME
TAG_MAP
TAG_NODE
TAG_NULL
TAG_PATH
TAG_STRING
TAG_TIME
TAG_VECTOR

Functions§

decode
Decode tagged MessagePack bytes to a Value.
decode_bool
Decode a bool directly without constructing a Value.
decode_float
Decode a float directly without constructing a Value.
decode_int
Decode an int directly without constructing a Value.
decode_string
Decode a string directly without constructing a Value.
encode
Encode a Value to tagged MessagePack bytes.
encode_bool
Encode a bool directly without constructing a Value.
encode_float
Encode a float directly without constructing a Value.
encode_int
Encode an int directly without constructing a Value.
encode_null
Encode null directly.
encode_string
Encode a string directly without constructing a Value.
extract_map_entry_raw
Extract a map entry as raw bytes without decoding the entire map.
is_null
Fast null check.
peek_tag
Peek at the tag byte without deserializing.