Expand description
Daemon core — Unix-socket listener + request handler.
Public entry point: Daemon::run. The binary wrapper in
src/bin/zero-headlessd.rs is thin glue: parse CLI flags,
spawn a Daemon, wait on its shutdown handle.
§Shutdown paths (all equivalent)
Request::Killover the socket — set by/killand the (M3) Telegram bot.SIGTERMfrom launchd / systemd.Shutdownhandle held by the test harness.
All three funnel through a single shutdown_signal channel;
the listener drops its accept loop on receive, open
connections drain their in-flight request, and then the
daemon exits with a zero status.
§Engine probe
Abstracted behind the EngineProbe trait so tests can
inject a deterministic stub without standing up an HTTP
server. Production uses HttpEngineProbe over
zero_engine_client::HttpClient::health.
Structs§
- Always
Reachable - Always-reachable probe — convenient for tests that care about state + socket semantics and not about the probe machinery.
- Always
Unreachable - Always-unreachable probe — for testing the honest “engine down” status path.
- Config
- Daemon configuration. Built by the binary’s
mainfrom CLI flags + defaults, and by tests viaConfig::for_test. - Daemon
- In-memory daemon instance. The fields are
Arc<Mutex<…>>so each accept-loop iteration can hand a handler task a clone without colouring everythingClone. - Http
Engine Probe - Production probe: calls
GET /healthviazero_engine_client::HttpClient. Kept outside the trait so the daemon core stays free of an HTTP-client dependency at the test boundary. - Shutdown
- Handle returned from
Daemon::spawn. Holding it keeps the daemon running; dropping it does not kill the daemon — tests that want a guaranteed shutdown should callShutdown::shutdownand.awaitShutdown::join.
Enums§
Traits§
- Engine
Probe - Abstract engine reachability probe. The daemon calls
EngineProbe::probeon a schedule + on-demand before a/statusreply that would otherwise return stale data.
Type Aliases§
- Probe
Future - Convenience alias for the engine probe’s future type.
Pin<Box<dyn Future>>becauseasync fnin dyn-compatible traits is still a rough edge; manual boxing keeps the dyn bound simple and the caller path explicit.