Skip to main content

Crate melin_transport_core

Crate melin_transport_core 

Source
Expand description

Application-agnostic transport core for the Melin durable pipeline.

Owns the disruptor wiring (journal stage + matching stage + response-stage output ring), the InputSlot<E> / OutputSlot<R, Q> ring slot types, the OutputPayload<R, Q> envelope, and the Pipeline<A> / ReplicaPipeline<A> builders. Everything here is generic over an A: Application — the matching engine (melin-exchange-core) is the canonical implementation.

Also owns the application-generic snapshot framing (snapshot::{save, load}) and the JournaledApp<A> lifecycle wrapper (create / recover / recover_from_snapshot / rotate) that composes a journal writer with an application state machine. The application supplies only the payload bytes via Application::{snapshot, restore}; the framing (magic, versions, sequence, chain hash, CRC) lives here.

Re-exports§

pub use journaled_app::JournaledApp;
pub use journaled_app::JournaledAppError;

Modules§

durability_policy
Cluster-wide durability ack policy: the Level/Clause/Policy cursor-evaluation core used by the response stage’s ack gate. Application-agnostic — the operator-facing CLI mode that picks between named policies lives with the consuming application. Durability ack policy — application-agnostic core.
health
Health / liveness endpoint — plain TCP listener that serves a one-line status to Kubernetes probes, an HTTP-wrapped status to GET /, and a Prometheus text exposition body to GET /metrics. The state struct holds only atomics/cursors; the endpoint is fully transport-shaped. Health/liveness endpoint — plain TCP listener on a dedicated port.
journaled_app
Generic journal-plus-application wrapper.
pipeline
Pipeline stages for the LMAX disruptor architecture.
replication
Replication wire protocol, journal-file catch-up, ack queueing, and per-replica observability metrics. Generic over E: AppEvent; connection orchestration and key authorization live with the consuming application. Application-agnostic replication protocol and helpers.
replication_wire
Wire format for input replication (InputBatch frames).
shadow
Shadow snapshot stage — replays journal events on a cloned application off the hot path and writes periodic snapshots gated on journal fsync. Generic over A: Application. Shadow snapshot stage — replays journal events on a cloned application to produce periodic snapshots without blocking the hot path.
snapshot
Application-generic snapshot file format.
tick
Tick-generation helpers shared by every ingress transport (io_uring reader, DPDK poll thread, future replacements). Each transport embeds the scheduler-clock tick generator into its existing ingress loop instead of running it as a separate thread, which keeps the input ring single-producer in steady state and removes one source of multi-producer ordering races.
trace
Per-stage latency tracing for the disruptor pipeline.