Skip to main content

Module server

Module server 

Source
Expand description

Server orchestrator — binds the accept loop, pipeline threads, and reader.

On startup:

  1. Recovers or creates the JournaledApp<A>.
  2. Decomposes it into (A, W) via into_parts(), where W is the journal writer.
  3. Builds the disruptor pipeline (input ring + output ring).
  4. Spawns 3-5 OS threads: journal, matching, response, [repl-sender], [event-publisher].
  5. Runs the accept loop, registering connections with the io_uring reader.

Fully synchronous — no async runtime needed. Reader threads use io_uring with multishot RECV to multiplex connections, eliminating thread oversubscription. The response thread writes via io_uring SEND.

Re-exports§

pub use crate::ControlEvent;

Structs§

PipelineCores
Core assignments for pipeline threads.
ServerConfig
Server configuration, parsed from CLI arguments via clap.

Functions§

run
Run the server with automatic transport selection.
run_with_listener
Run the server with a caller-supplied listener.

Type Aliases§

EventPublisherFn
Body of the event-publisher thread: a free function with this exact signature (the trading binary supplies melin_server::event_publisher::run; the skip-order-exec binary supplies nothing). Passing it as a function pointer keeps the runtime decoupled from the trading domain — no melin_server::* reference inside server.rs — without paying for a boxed closure.