Expand description
Process lifecycle state machine (PLAN.md Phase 1 — Lifecycle Contract).
Tracks where the runtime is in its boot/serve/shutdown sequence so that:
- health probes can answer
/health/live,/health/ready,/health/startupdeterministically (live: process responsive, ready: accepting queries, startup: K8s-style “still warming up”); WriteGatecan reject mutations once shutdown is initiated;POST /admin/shutdownis idempotent — subsequent calls return the same successful state without re-running the flush pipeline;- orchestrators see a consistent transition pattern regardless of how shutdown was triggered (HTTP, SIGTERM, SIGINT).
The state is a single AtomicU8 in RuntimeInner plus a
parking_lot::RwLock<ShutdownReport> for the optional final
report. Phase transitions are monotonic — the runtime cannot move
backwards through them.
Structs§
- Cold
Start Phases - PLAN.md Phase 9.1 — cold-start phase snapshot. All fields are
wall-clock unix-ms;
0means the phase hasn’t fired yet. - Lifecycle
- Lifecycle state wrapper held in
RuntimeInner. - Shutdown
Report - Final report produced by a successful graceful shutdown.
Enums§
- Phase
- Discrete lifecycle phases. Numeric values are monotonic so an
AtomicU8compare_exchangegives us atomic transitions without a mutex. Decoded viaPhase::from_u8.