Skip to main content

Module supervisor

Module supervisor 

Source
Expand description

The supervision engine — abstract Supervisor trait + two impls.

LinuxSupervisor does the real PID-1 work via fork(2)/execve(2); MockSupervisor records actions for unit tests. The orchestration loop in run_once is written against the trait, so testing the scheduler logic requires no privileges.

Structs§

LinuxSupervisor
Real PID-1 backend. Uses libc fork/execve/waitpid/kill. Safe to compile on macOS (same libc surface); running meaningfully requires being PID 1 in a Linux kernel.
MockSupervisor
In-memory supervisor for tests. Records spawns + signals; reap_one returns queued exits in FIFO order.
ReapedEvent

Enums§

SupervisorError

Traits§

Supervisor
Minimum interface a supervisor backend must expose.

Functions§

boot
Walk the config and spawn every enabled service. Returns the per-name PIDs. Deterministic; errors on the first spawn failure with no partial state (caller can retry with a new env).
run_once
Drain any pending child exits. Applies the restart policy for each service keyed by the PID we spawned for it.

Type Aliases§

Pid
Result