Skip to main content

melin_transport_core/
lib.rs

1//! Application-agnostic transport core for the Melin durable pipeline.
2//!
3//! Owns the disruptor wiring (journal stage + matching stage + response-stage
4//! output ring), the `InputSlot<E>` / `OutputSlot<R, Q>` ring slot types, the
5//! `OutputPayload<R, Q>` envelope, and the `Pipeline<A>` / `ReplicaPipeline<A>`
6//! builders. Everything here is generic over an `A: Application` — the
7//! matching engine (`melin-exchange-core`) is the canonical implementation.
8//!
9//! Also owns the application-generic snapshot framing (`snapshot::{save,
10//! load}`) and the `JournaledApp<A>` lifecycle wrapper (create / recover /
11//! recover_from_snapshot / rotate) that composes a journal writer with an
12//! application state machine. The application supplies only the payload
13//! bytes via `Application::{snapshot, restore}`; the framing (magic,
14//! versions, sequence, chain hash, CRC) lives here.
15
16#![cfg_attr(not(test), deny(clippy::unwrap_used))]
17
18/// Cluster-wide durability ack policy: the `Level`/`Clause`/`Policy`
19/// cursor-evaluation core used by the response stage's ack gate.
20/// Application-agnostic — the operator-facing CLI mode that picks
21/// between named policies lives with the consuming application.
22pub mod durability_policy;
23/// Health / liveness endpoint — plain TCP listener that serves a one-line
24/// status to Kubernetes probes, an HTTP-wrapped status to `GET /`, and a
25/// Prometheus text exposition body to `GET /metrics`. The state struct
26/// holds only atomics/cursors; the endpoint is fully transport-shaped.
27pub mod health;
28pub mod journaled_app;
29pub mod pipeline;
30/// Replication wire protocol, journal-file catch-up, ack queueing,
31/// and per-replica observability metrics. Generic over
32/// `E: AppEvent`; connection orchestration and key authorization live
33/// with the consuming application.
34pub mod replication;
35pub mod replication_wire;
36/// Shadow snapshot stage — replays journal events on a cloned
37/// application off the hot path and writes periodic snapshots gated on
38/// journal fsync. Generic over `A: Application`.
39pub mod shadow;
40pub mod snapshot;
41pub mod tick;
42pub mod trace;
43
44#[cfg(test)]
45mod test_support;
46
47#[cfg(test)]
48mod pipeline_tests;
49
50pub use journaled_app::{JournaledApp, JournaledAppError};