Skip to main content

Module lifecycle_state

Module lifecycle_state 

Source
Expand description

Cluster lifecycle state tracking for observability.

ClusterLifecycleTracker is the single source of truth for “what phase is this node’s cluster init in right now”. It is owned by the main binary, passed by reference into start_cluster and friends, and read by:

  • The /cluster/status HTTP endpoint.
  • The nodedb_cluster_state Prometheus gauge.
  • systemd via readiness::notify_status so systemctl status surfaces a live phase string during the seconds-to-minutes window when the cluster is still forming.
  • INFO-level structured logs — every transition calls info! with the previous state, the new state, and the reason so a post- mortem on a flaky deploy can be done from journalctl alone.

Transitions are validated only in the loose sense that every transition goes through a typed method on the tracker. There is no strict state machine — a cluster can legitimately go Joining{3} → Failed{"timeout"} → Joining{0} → Ready{3} if the operator restarts with force_bootstrap, so we allow any → any.

Structs§

ClusterLifecycleTracker
Thread-safe container for the current ClusterLifecycleState.

Enums§

ClusterLifecycleState
Discrete phase of this node’s cluster init.