reliable_sync library
Reliable sync protocol (#lzsync, protocol.md § Reliable Sync).
Exposes the receiver-side ResyncCoordinator (ResyncAction), the
sender-side at-least-once DurableOutbox / InMemoryOutbox, the OR-set /
LWW liveness cells (OrSet, WireLwwRegister), the host-injected seams
(Clock, SnapshotProvider, IpcSink, IpcSource), and the full-duplex
SyncDriver (Progress, DriverError). The reverse-channel control frames
(ResyncRequest / OutboxAck) live in package:lazily/ipc.dart.
Classes
- Clock
- Monotonic clock seam (spec § SyncDriver — policy injected, no runtime in core). The driver never schedules itself; the host calls SyncDriver.tick on its own cadence and supplies wall-free monotonic millis.
- DurableOutbox
- Sender-side at-least-once outbox contract (spec § DurableOutbox).
- FileOutbox
- Ready-to-use durable filesystem outbox.
- FileOutboxStore
- Append-only filesystem OutboxStore.
- InMemoryOutbox
- In-memory DurableOutbox — correct within a process lifetime; the default.
- InMemoryStore
- Ordered process-local OutboxStore.
- IpcSink
-
Transport sink for IPC messages. send returns
trueon success; afalsereturn is a transient send failure the driver retains-and-stalls on (it is never fatal). Mirrors theIpcSinktrait inlazily-rs/src/ipc.rs. - IpcSource
-
Transport source for IPC messages. recv returns the next message, or
nullwhen the source is currently exhausted or closed. A read failure is signalled by throwing (the driver surfaces it as DriverError). Mirrors theIpcSourcetrait inlazily-rs/src/ipc.rs. - OrSet
- An observed-remove set (OR-set) liveness cell.
- OutboxStore
- Dumb ordered byte storage for the durable outbox protocol.
- Progress
- What one SyncDriver.tick accomplished (spec § SyncDriver).
- ResyncAction
- Receiver decision for an inbound frame (spec § ResyncCoordinator).
- ResyncActionApply
- Apply the frame and advance the receiver epoch.
- ResyncActionIgnore
- Drop the frame (already-applied re-delivery, malformed, a duplicate request suppressed while resyncing, or a reverse-channel control frame arriving at a data receiver).
- ResyncActionRequestSnapshot
- A gap was detected; request a fresh Snapshot covering fromEpoch.
- ResyncCoordinator
- Receiver-side reliable-sync coordinator.
- SnapshotProvider
- Sender-side answer to a peer's IpcMessageResyncRequest (spec § SyncDriver).
-
StoredOutbox<
S extends OutboxStore> - Storage-independent durable outbox protocol.
- SyncDriver
- Full-duplex reliable-sync loop driver (spec § SyncDriver).
-
WireLwwRegister<
V> -
A last-writer-wins register liveness cell (per-pid
alive, owner lease).
Typedefs
- OutboxFrame = (Epoch, IpcMessage)
- One retained outbox frame: its epoch retention key and the message.
- StoredOutboxFrame = (Epoch, Uint8List)
- One serialized outbox frame returned by OutboxStore.scanAfter.
Exceptions / Errors
- DriverError
- A transport error surfaced by SyncDriver.tick.