Skip to main content

nodedb_strict/
lib.rs

1//! Binary Tuple serialization for NodeDB strict document mode.
2//!
3//! Strict mode replaces MessagePack with a fixed-layout Binary Tuple for
4//! collections with known schemas. This gives O(1) field extraction and
5//! 3-4x better cache density than self-describing formats (BSON, MessagePack).
6//!
7//! # Tuple Layout
8//!
9//! ```text
10//! [schema_version: u16 LE]
11//! [null_bitmap: ceil(N/8) bytes]
12//! [fixed_fields: concatenated fixed-size values, zeroed when null]
13//! [offset_table: (N_var + 1) × u32 LE — start offsets into variable data]
14//! [variable_data: concatenated variable-length bytes]
15//! ```
16//!
17//! Fixed fields reserve space even when null (zeroed), so byte offsets are
18//! constant and computable from the schema alone. Variable fields use an
19//! offset table with N_var + 1 entries so the last field's length can be
20//! derived as `offset[N_var] - offset[N_var - 1]`.
21
22pub mod arrow_extract;
23pub mod decode;
24pub mod encode;
25pub mod error;
26
27pub use decode::TupleDecoder;
28pub use encode::TupleEncoder;
29pub use error::StrictError;