Skip to main content

Module sidecar

Module sidecar 

Source
Expand description

Persistent structural index (sidecar) for MessagePack documents.

Appends a compact field-offset table directly after the raw msgpack bytes. On read, O(log n) field lookup via pre-computed byte ranges — no map scanning.

§Layout

[original_msgpack_bytes][entry0][entry1]...[entryN][entry_count: u16 LE][MAGIC: u32 LE]

Each entry is 16 bytes: field_name_hash(u64 LE) + value_offset(u32 LE) + value_len(u32 LE). Entries are stored sorted by field_name_hash to enable binary search. Magic: 0x4E494458 (“NIDX”).

Structs§

SidecarEntry
A single sidecar index entry.
SidecarFieldIndex
A field index backed by a parsed sidecar — provides the same .get() API as FieldIndex without re-scanning the msgpack.

Functions§

build_sidecar
Build a sidecar-indexed document from raw msgpack bytes.
field_index_from_sidecar
Parse the sidecar entries from a buffer into a SidecarFieldIndex.
has_sidecar
Check whether buf has a valid sidecar index appended.
msgpack_bytes
Return the raw msgpack slice from a buffer that may or may not have a sidecar.
sidecar_lookup
Look up a field’s byte range (start, end) using the sidecar index.