Skip to main content

Module flatengine

Module flatengine 

Source
Expand description

The flat directory layout engine over a RawKv view.

One layout, written and tested once here; the flat backends (btreemap, redb) implement RawKv over their transaction views and route every operation through FlatEngine. FDB does not use this — it uses FDB’s native directory layer over the same row layouts (the crate::flatdir module documents the shared layouts).

The engine’s layout is a verbatim port of FoundationDB’s DirectoryLayer (see crate::flatdir): a node tree of allocated prefixes (packed i64s from the High Contention Allocator), a version row, and HCA counter/recent rows, all under the 0xFE node region. Data keys are prefix ‖ key in the 0x00–0xFD region; 0xFF is reserved.

Stores are opened lazily: a fresh store (no version row) answers empty on reads, and the first create writes the version row. A store whose version row this layout does not read fails every operation with FlatError::Foreign.

Re-exports§

pub use crate::flatdir::error::FlatError;

Structs§

DataBounds
The raw engine range of one directory’s data: the resolved prefix and the raw byte bounds over the engine’s whole keyspace. The start bound carries its own inclusion (Included/Excluded); the end bound is always Excluded. Cursor-yielding keys carry the prefix; strip prefix.len() bytes to get the within-directory key.
FlatEngine
The flat directory layout over a raw byte view.