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