distribute/cluster/health

Types

Health status of the cluster.

pub type ClusterHealth {
  Healthy
  Degraded(suspect_count: Int, dead_count: Int)
  Isolated
}

Constructors

  • Healthy

    All nodes are alive and healthy.

  • Degraded(suspect_count: Int, dead_count: Int)

    Some nodes are suspected or unreachable.

  • Isolated

    No other nodes are connected.

Node health summary.

pub type NodeHealth {
  NodeHealthy
  NodeUnhealthy(reason: String)
}

Constructors

  • NodeHealthy
  • NodeUnhealthy(reason: String)

Values

pub fn alive_count() -> Int

Get count of alive nodes.

pub fn cluster_health() -> ClusterHealth

Get the overall cluster health status.

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)
pub fn node_health() -> NodeHealth

Get detailed health status of the local node.

pub fn suspect_count() -> Int

Get count of suspect nodes.

Search Document