Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

Cooperative shutdown primitives.

ShutdownToken is a clonable, hierarchical cancellation primitive shared between the ComponentRegistry, every Component lifecycle phase, and the future transport layer (added in M5).

Design goals:

  1. Cooperative, not preemptive: tasks opt-in by calling ShutdownToken::wait or by polling ShutdownToken::is_shutdown.
  2. Hierarchical: child tokens propagate a shutdown signal upward to their parent, so the entire process can be torn down from any component failure without each component needing to wire its own supervision.
  3. Cheap to clone: backpressure-free, Arc-backed, safe to embed in every component without allocation pressure.

Structsยง

ShutdownToken
Hierarchical, cooperative shutdown token.