distribute/cluster/health
Types
Health status of the cluster.
pub type ClusterHealth {
Healthy
Degraded(suspect_count: Int, dead_count: Int)
Isolated
}
Constructors
-
HealthyAll nodes are alive and healthy.
-
Degraded(suspect_count: Int, dead_count: Int)Some nodes are suspected or unreachable.
-
IsolatedNo other nodes are connected.
Node health summary.
pub type NodeHealth {
NodeHealthy
NodeUnhealthy(reason: String)
}
Constructors
-
NodeHealthy -
NodeUnhealthy(reason: String)
Values
pub fn current_leader() -> Result(String, Nil)
Get the current leader if available.
pub fn has_quorum(expected_nodes: Int) -> Bool
Check if we have quorum (majority of expected nodes alive).
expected_nodes is the total expected cluster size including self.
pub fn is_healthy() -> Bool
Check if the local node is healthy. A node is considered healthy if:
- The membership service is running
- It can see at least one other node (or is intentionally standalone)