Expand description
§nodedb-crdt
CRDT engine with SQL constraint validation for NodeDB.
§The CRDT / SQL Paradox
CRDTs are AP (Available + Partition-tolerant): agents compute optimistic deltas offline and sync later. SQL constraints are CP (Consistent + Partition-tolerant): UNIQUE indexes, foreign keys, etc. must hold globally.
This crate bridges the gap:
- Optimistic local writes — agents apply deltas to their local
LoroDocwithout constraint checks (AP behavior for availability). - Constraint validation at commit — when deltas sync to the leader, constraints are validated against the committed state.
- Dead-letter queue — rejected deltas are routed to a DLQ with compensation hints so the application can recover gracefully.
- Pre-validation — optional fast-reject against the leader’s state before the full Raft round-trip, reducing wasted consensus bandwidth.
Re-exports§
pub use constraint::Constraint;pub use constraint::ConstraintKind;pub use constraint::ConstraintSet;pub use dead_letter::CompensationHint;pub use dead_letter::DeadLetterQueue;pub use deferred::DeferredQueue;pub use error::CrdtError;pub use error::Result;pub use policy::CollectionPolicy;pub use policy::ConflictPolicy;pub use policy::PolicyRegistry;pub use policy::PolicyResolution;pub use policy::ResolvedAction;pub use signing::DeltaSigner;pub use signing::DeviceRegistry;pub use state::CrdtState;pub use validator::ValidationOutcome;pub use validator::Validator;
Modules§
- constraint
- SQL constraint definitions for CRDT collections.
- constraint_
checks - Constraint-checking methods for the
Validator. - dead_
letter - Dead-letter queue for rejected CRDT deltas.
- deferred
- Deferred retry queue for CASCADE_DEFER policy.
- error
- Error types for the CRDT engine.
- list_
ops - LoroMovableList operations for block document model.
- policy
- Declarative conflict resolution policies for CRDT constraint violations.
- pre_
validate - Pre-validation: fast-reject before Raft round-trip.
- signing
- Delta signing and verification using HMAC-SHA256 with replay protection.
- state
- CRDT state management backed by loro.
- validator
- Constraint validator — checks deltas against committed state.
Structs§
- Crdt
Auth Context - Authentication context threaded through CRDT validation.