Skip to main content

Module engine

Module engine 

Source
Expand description

Engine selection + the pre-serialized static-response table — the cross-platform half of the HTTP fast path.

LOGOS serves HTTP everywhere; the ENGINE is a knob. Two engines exist:

  • tokio — the portable baseline in super::server. Always compiled, works on every native platform, and is the only engine for the interpreter tier (whose !Send handler drives Listener/Conn inline).
  • uring — the Linux thread-per-core io_uring engine in engine_uring (behind the io-uring feature). The compiled (AOT) tier’s fast path: its handlers are plain Fns, exactly the engine’s contract.

choose_engine is the ONE selection law, applied by the serve entries in server.rs: LOGOS_HTTP_ENGINE=uring|tokio overrides; the default is uring wherever a probe ring actually initializes (Linux, io-uring feature compiled in, kernel support present), else tokio. Selection is ALWAYS announced with one stderr line — loud, never silent — so a deploy can never quietly run the slow path.

Structs§

EngineChoice
The outcome of choose_engine: the engine plus the human-readable reason that goes on stderr.
StaticResponses
Pre-serialized static responses — the memcpy fast path.

Enums§

EngineKind
Which engine a serve entry runs on.

Functions§

announce
The one loud line: which engine this serve entry runs on, and why.
choose_engine
Read the selection knobs from the environment and apply choose_engine_from. LOGOS_HTTP_FORCE_FALLBACK=1 makes the uring probe fail artificially (the fallback-honesty test hook — it exercises the same path a ring-init failure takes on a real kernel without io_uring).
choose_engine_from
The pure selection law. probe initializes a throwaway ring (or explains why it cannot); it runs only when uring is actually a candidate.
lifecycle_knob_requested
The name of the first lifecycle knob the environment sets, if any — the pure half of the rule above, so it can be tested without the process environment.
shard_count_from
The shard-count law for the uring engine: LOGOS_HTTP_SHARDS when it parses to a positive count (clamped to 1024), else the box’s available parallelism, else 1. Pure so it is testable without touching the process environment.