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) and [MemEngine] (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 [
WriteTx] spans 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.