Skip to main content

Module buffer_file_store

Module buffer_file_store 

Source
Expand description

Deterministic binary persistence for NumericFeatureBufferStore.

The format .n4d (DAG-ML Data file) is a versioned little-endian byte stream sealed with a SHA-256 trailer so a host can persist a provider’s feature buffers between processes and detect tampering on reload. The serializer iterates the store in BTreeMap order so byte-identical stores produce byte-identical files; deserialization rebuilds the store using the same column-major typed input path as the in-memory ABI, so a round-trip preserves every buffer fingerprint.

Constants§

NUMERIC_FEATURE_BUFFER_FILE_FORMAT_VERSION

Functions§

deserialize_columnar_store
Parse a .n4d byte stream back into a store. Rejects unknown magic, unsupported versions, truncated streams, and any tampering of the payload caught by SHA-256 mismatch.
read_store_from_path
Read a store back from path. Errors propagate the validation failure from deserialize_columnar_store alongside the path for diagnostics.
serialize_columnar_store
Serialize a store to its deterministic .n4d byte stream. The output ends with a 32-byte SHA-256 of all preceding bytes so callers can distinguish truncation from intentional empty stores and detect any later tampering through deserialize_columnar_store.
write_store_to_path
Write a store to path. Replaces any existing file at the destination.