Expand description
§spacedb-store — SpaceDB Layer 0
The per-node storage primitive: a typed, transactional, order-preserving key/value store that everything else in SpaceDB rests on. Getting this small and correct is the whole game — every layer above inherits its guarantees.
§What S1 ships
KvEngine— the engine seam, with two implementations that share identical transaction semantics:RedbEngine(durable) andMemEngine(in-memory, for tests).codec— a deterministicpostcardvalue codec and an order-preserving key codec (a < b ⟺ encode(a) < encode(b)), each a verified bijection.Table— the typedTable<K, V>primitive that applies both codecs once so layers above never touch raw bytes.
§Guarantees
- Atomic multi-table writes. One
WriteTxspans many tables and commits all-or-nothing; dropping it rolls back. - Logical-order range scans, courtesy of the order-preserving key codec.
- Single-writer / snapshot reads, identical across both engines.
§Open-core boundary
spacedb-store is MIT and depends on no MATA crate. MATA-specific
capabilities (the vault key, identity, mesh replication, settlement) enter
later through seams this crate defines — e.g. the KeyProvider for the AEAD
boundary in S2 — which MATA implements in its proprietary hosted product. The
dependency arrow is MATA → SpaceDB, never the reverse.
Re-exports§
pub use codec::decode_value;pub use codec::encode_value;pub use codec::KeyDecode;pub use codec::KeyEncode;pub use engine::Durability;pub use engine::KvEngine;pub use engine::ReadTx;pub use engine::Readable;pub use engine::WriteTx;pub use mem_engine::MemEngine;pub use redb_engine::RedbEngine;pub use table::Table;pub use crypto::open_row;pub use crypto::rewrap_dek;pub use crypto::seal_row;pub use crypto::unwrap_dek;pub use crypto::wrap_fresh_dek;pub use crypto::CryptoError;pub use crypto::KeyProvider;pub use crypto::StaticKeyProvider;pub use crypto::WrappedDek;pub use crypto::KEY_LEN;pub use crypto::NONCE_LEN;pub use collection::Collection;pub use meta::open_meta;pub use meta::open_meta_with;pub use meta::read_store_version;pub use meta::write_store_version;pub use meta::MetaStatus;pub use meta::Migration;pub use meta::STORE_FORMAT_VERSION;pub use extern_value::classify;pub use extern_value::content_hash;pub use extern_value::should_externalize;pub use extern_value::ExternRef;pub use extern_value::ValuePlacement;
Modules§
- codec
- The two codecs every layer above rests on: a value codec and an order-preserving key codec.
- collection
Collection<K, V>— the encrypted typed table.- crypto
- The AEAD value boundary — the zero-knowledge linchpin.
- engine
- The storage engine seam — the one trait everything in SpaceDB rests on.
- extern_
value - Large-value externalization (the seam, stubbed).
- mem_
engine - In-memory
KvEngine— the test/ephemeral engine. - meta
- The
_metaschema gate — refuse or migrate, never silently open. - redb_
engine - redb-backed
KvEngine— the durable engine. - table
Table<K, V>— the typed primitive every layer above uses.
Enums§
Type Aliases§
- Store
Result - The result type returned throughout
spacedb-store.