1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! 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:
//!
//! 1. **Outbound** — local writes call [`ArrayOutbound`], which appends the op
//! to a durable KV-backed [`KvOpLogStore`] and enqueues it on
//! [`PendingQueue`] for the transport layer to drain. The send path is
//! fire-and-forget from the engine's perspective.
//!
//! 2. **Inbound** — wire messages from Origin enter [`ArrayInbound`], which
//! deduplicates by HLC against the local op-log, applies the op via
//! [`LiteApplyEngine`], and persists the resulting state. The receive path
//! deliberately does *not* re-trigger outbound hooks, preventing echo
//! loops by construction.
//!
//! 3. **Catch-up** — [`CatchupTracker`] persists 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.
pub use spawn as spawn_ack_sender;
pub use CatchupTracker;
pub use ;
pub use KvOpLogStore;
pub use ArrayOutbound;
pub use ;
pub use ;
pub use ReplicaState;
pub use SchemaRegistry;