Skip to main content

Crate crdt_doc

Crate crdt_doc 

Source
Expand description

crdt-doc — the typed CRDT-document border for Saber (SABER.md §5).

A verbete body is ALWAYS a CrdtDoc by construction (solo = a one-replica CRDT). M0a is deliberately degenerate: the ONLY realized engine is SoloDoc (single writer, no concurrent merge). CrdtKind::Loro and CrdtKind::YCrdt are typed-and-named but UNBUILT — constructing one returns SpecError::Unimplemented, never a silent Ok, never a todo!()/panic!() (★★ UNREPRESENTABILITY / no-stub-Ok; ★★ TYPED-SPEC triplet “every unimplemented surface returns a typed error so consumers see the gap mechanically”).

The seam-clean rule (SABER §5): Edit is the local-author border, CrdtUpdate is the wire border, materialize()→Rope is the render border — never crossed raw. At M0a only materialize() is realized; local_edit / apply_update are the M2 wire borders and return SpecError for non-Solo kinds.

Structs§

CrdtUpdate
The wire delta exchanged between replicas (SABER §2 CrdtUpdate). At M0a this is an opaque byte vector with no producer — the type exists so the M2 local_edit/apply_update signatures are stable now.
SoloDoc
The single-writer degenerate document (M0a). Holds the body text directly — no merge, no concurrent edits. A loro CrdtDoc replaces it at M2 behind the same trait.

Enums§

CrdtKind
The CRDT engine selector (SABER §2 CrdtKind). Solo is the M0a degenerate; Loro the M2 primary; YCrdt the M2 interop arm.
SpecError
The typed error surface for the border. Every unimplemented engine arm returns one of these (no format!()thiserror’s #[error] is the typed emission surface, allowed surface #2).

Traits§

CrdtDoc
The CRDT-document border (SABER §5). A verbete body is ALWAYS one.

Functions§

open_doc
The typed dispatch over CrdtKind (SABER §2 “the dispatch tag”). M0a builds only Solo; Loro/YCrdt return SpecError::Unimplemented — the typed-but-degenerate border the M0a spec mandates.