pamoja_sync/lib.rs
1//! Offline-first store-and-forward buffering for pamoja.
2//!
3//! Devices on intermittent links append records while offline and drain them in
4//! order when a link returns, so a node that is disconnected for hours or days
5//! loses nothing. This crate provides durable first-in first-out implementations
6//! of the core [`Store`](pamoja_core::Store) trait:
7//!
8//! - [`MemoryStore`] - a fast in-memory queue, optionally capacity-bounded so a
9//! full queue becomes an explicit backpressure signal.
10//! - [`FileStore`] - a crash-safe on-disk queue that survives power loss, for the
11//! power-loss-safe field logging the mission depends on.
12//!
13//! Both buffer raw bytes, so an application pairs a [`Store`](pamoja_core::Store)
14//! with a [`Codec`](https://docs.rs/pamoja-codec) to persist encoded payloads and
15//! a [`Transport`](pamoja_core::Transport) to forward them when a link appears.
16//! [`drain_to`] is the forward half: it publishes buffered records onto a
17//! transport in order, removing each only after it is sent, so a failed link
18//! loses nothing.
19
20mod file;
21mod forward;
22mod memory;
23
24pub use file::FileStore;
25pub use forward::drain_to;
26pub use memory::MemoryStore;