Expand description
Array CRDT synchronization for NodeDB-Lite.
This module implements the embedded side of the sparse N-dimensional array sync protocol. The design has three independent paths:
-
Outbound — local writes call
ArrayOutbound, which appends the op to a durable KV-backedKvOpLogStoreand enqueues it onPendingQueuefor the transport layer to drain. The send path is fire-and-forget from the engine’s perspective. -
Inbound — wire messages from Origin enter
ArrayInbound, which deduplicates by HLC against the local op-log, applies the op viaLiteApplyEngine, and persists the resulting state. The receive path deliberately does not re-trigger outbound hooks, preventing echo loops by construction. -
Catch-up —
CatchupTrackerpersists the highest applied HLC per array so that, on reconnect, the transport can request only the ops it missed.
Cross-cutting state:
ReplicaState— stable replica identity + monotonic HLC generator.SchemaRegistry— per-array [SchemaDoc] snapshots, persisted as Loro documents.
Backpressure is enforced at the PendingQueue (100k-op cap); overflow
surfaces as crate::error::LiteError::Backpressure.
Transport wiring (WebSocket dispatch into ArrayInbound and the push loop
that drains PendingQueue) lives in crate::sync::transport. This module
is transport-agnostic. reject_policy decides what happens to a local op
Origin refuses.
Re-exports§
pub use ack_sender::spawn as spawn_ack_sender;pub use catchup::CatchupTracker;pub use inbound::ArrayInbound;pub use inbound::InboundOutcome;pub use inbound::LiteApplyEngine;pub use op_log_store::KvOpLogStore;pub use outbound::ArrayOutbound;pub use pending::PendingArrayOp;pub use pending::PendingQueue;pub use reject_policy::RejectDisposition;pub use reject_policy::reject_disposition;pub use replica_state::ReplicaState;pub use schema_registry::SchemaRegistry;
Modules§
- ack_
sender - [
ArrayAckSender] — periodic ack sender from Lite to Origin. - catchup
- Catchup-request helper: tracks the last-seen inbound HLC per array and
builds
ArrayCatchupRequestMsgmessages for the transport layer. - inbound
- Inbound array CRDT message handler for NodeDB-Lite.
- op_
log_ store - Storage-backed
OpLogimplementation for the array CRDT sync subsystem. - outbound
- High-level emitter for array CRDT ops on the send path.
- pending
- Durable FIFO queue of outbound array ops waiting for transport to Origin.
- reject_
policy - What Lite does with a locally-originated op Origin refuses.
- replica_
state - Persistent replica identity and HLC generator for the array CRDT sync subsystem.
- schema_
registry - Per-array
SchemaDocregistry with durable cold-start snapshots.