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-accept], [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::layout::PipelineCores;
pub use crate::layout::Placement;
pub use crate::layout::ReaderThread;
pub use crate::ControlEvent;

Structs§

ServerConfig
Server configuration, parsed from CLI arguments via clap.

Enums§

JournalStagingMode
CLI spelling of melin_journal::StagingMode.

Functions§

run
Run the server with automatic transport selection.
run_with_listener
Run the server with a caller-supplied listener.
run_with_shutdown
run, stopped through shutdown rather than by a signal: the same transport selection and the same startup, but no SIGINT/SIGTERM handler is installed. Set shutdown to true for a clean shutdown; the node may also set it itself (a fenced node stops this way).

Type Aliases§

EventPublisherFn
Body of the event-publisher thread: a free function with this exact signature (an application with an output feed supplies its publisher; one without supplies nothing). Passing it as a function pointer keeps the runtime decoupled from the application — no application reference inside server.rs — without paying for a boxed closure.