distribute/cluster

Types

Detailed health status of the cluster from this node’s perspective.

pub type ClusterHealth {
  ClusterHealth(
    self_node: String,
    is_distributed: Bool,
    connected_nodes: List(String),
    connected_count: Int,
    reachable_nodes: List(String),
    unreachable_nodes: List(String),
  )
}

Constructors

  • ClusterHealth(
      self_node: String,
      is_distributed: Bool,
      connected_nodes: List(String),
      connected_count: Int,
      reachable_nodes: List(String),
      unreachable_nodes: List(String),
    )
pub type ConnectError {
  ConnectTimeout
  NodeNotFound
  ConnectNetworkError(String)
  ConnectIgnored
}

Constructors

  • ConnectTimeout
  • NodeNotFound
  • ConnectNetworkError(String)
  • ConnectIgnored
pub type StartError {
  InvalidNodeName(String)
  AlreadyStarted
  CookieTooLong
  NetworkError(String)
  SystemError(String)
  StartFailed(String)
}

Constructors

  • InvalidNodeName(String)
  • AlreadyStarted
  • CookieTooLong
  • NetworkError(String)
  • SystemError(String)
  • StartFailed(String)

Values

pub fn connect(node: String) -> Result(Nil, ConnectError)

Connect to a remote node. Returns Ok(Nil) on success.

pub fn connected_count() -> Int

Number of currently connected nodes.

pub fn health() -> ClusterHealth

Perform a cluster health check.

pub fn is_distributed() -> Bool

Whether this node is running as a distributed node.

pub fn is_healthy() -> Bool

Quick health check: distributed and has at least one connection.

pub fn nodes() -> List(String)

List all currently connected nodes.

pub fn ping(node: String) -> Bool

Ping a remote node. Returns True if it responds.

pub fn self_node() -> String

Get the current node’s name.

pub fn start_node(
  name: String,
  cookie: String,
) -> Result(Nil, StartError)

Start a distributed BEAM node. Name must contain @ (e.g. myapp@127.0.0.1). Cookie must be 255 characters or fewer.

Search Document