queue_core/lib.rs
1//! A generic work-queue abstraction for the sync pipeline.
2//!
3//! The engine publishes work items with a [`Producer`] and processes them from
4//! a [`Consumer`]; each item arrives as a [`Delivery`] carrying an [`AckHandle`]
5//! that confirms (or returns) it. This is deliberately domain-agnostic —
6//! generic over the payload `T` — so it depends on neither the source, the
7//! sink, nor the engine.
8//!
9//! The point of the abstraction is to make the *backend* swappable without
10//! touching pipeline code:
11//!
12//! - In-process [`tokio` channels](https://docs.rs/tokio) (see `queue-channel`)
13//! for single-node runs. Acknowledgement is a no-op there — durability comes
14//! from the source (the replication slot), and the bounded channel gives
15//! backpressure.
16//! - A durable broker (e.g. NATS JetStream) later, where [`AckHandle::ack`]
17//! becomes a real server acknowledgement and the queue itself is the
18//! durability boundary for the work pipeline.
19//!
20//! Because [`AckHandle`] models the ack the same way both back the same engine
21//! loop: `recv` → process → `ack`.
22
23mod error;
24mod queue;
25
26pub use error::*;
27pub use queue::*;