Skip to main content

Crate spacedb_crdt

Crate spacedb_crdt 

Source
Expand description

§spacedb-crdt — SpaceDB Layer 1 (convergent collections)

The default data tier, and the reason SpaceDB survives a partition-prone mesh: data is modeled as Y-CRDT (via yrs), so every write is locally available and merges conflict-free with no coordination. Writing offline on a Starlink-partitioned home is a non-event, not an error.

M2-S1 ships CrdtDoc: a document with a typed field→CRDT-type mapping (LWW-Register + PN-Counter), local-first mutation, and the sync primitives (state vector, incremental update, merge). The order-independent convergence property — the same updates in any order produce the same state — is proven by the fuzzed test in tests/convergence.rs.

Open-core (MIT): this depends on yrs directly, never on a MATA crate. Persistence into the encrypted spacedb-store is M2-S2.

Structs§

CrdtDoc
A convergent document: a yrs CRDT plus a typed field API.
CrdtStore
Persists CrdtDocs into an encrypted spacedb-store collection. Engine- agnostic like the underlying Collection: the methods take the engine and open their own transactions.
ReactiveQuery
A live query over a document: re-evaluates query when the document changes and yields the new result only when it differs from the last emitted one.
Watcher
Watches a document’s revision counter for changes.

Enums§

CrdtError

Constants§

CRDT_DOCS_COLLECTION
The encrypted collection that holds doc_id → CRDT-state rows.

Functions§

compact_updates
Merge a batch of v1-encoded updates into one compacted, equivalent update.

Type Aliases§

CrdtResult
Result alias for spacedb-crdt.