Expand description
Disk persistence and zero-copy mmap access for FibSidecarIndex.
This module provides a binary file format (FBS1) for serializing a
FibSidecarIndex to disk and two loading modes:
load_from_file— fully owned reconstruction (reads everything intoVecs, decodes compact bytes toFibCodeV1).load_mmap— zero-copy memory-mapped access. Compressed payloads stay in the mmap as&[u8]slices and are decoded on demand.
§File Format (FBS1)
[0..4] magic: "FBS1"
[4] version: u8 (1)
[5..9] profile_json_len: u32
[9..9+L] profile_json: JSON-serialized FibQuantProfileV1
[9+L..13+L] gram_len: u32 (number of f32 values = N*N)
[13+L..13+L+G] gram_values: N*N f32 (little-endian, row-major)
[13+L+G..17+L+G] entry_count: u32
Per entry:
id_len: u32 (little-endian)
id_bytes: id_len bytes (postcard-serialized Id)
code_len: u32 (little-endian)
code_bytes: code_len bytes (FibCodeV1::to_compact_bytes)Structs§
- FibSidecar
File V1 - On-disk file format for
FibSidecarIndex. - Mmap
Sidecar Index - A memory-mapped sidecar index with zero-copy access to compressed payloads.
Constants§
- FILE_
MAGIC - Magic bytes: “FBS1” = Fib Sidecar v1.
- FILE_
VERSION - Current file format version.
Functions§
- load_
from_ file - Load a
FibSidecarIndexfrom a binary file (fully owned). - load_
mmap - Load a sidecar index via memory-mapping (zero-copy).
- save_
to_ file - Serialize a
FibSidecarIndexto a binary file.