distribute/cluster

Types

Error type for connection failures.

pub type ConnectError {
  ConnectTimeout
  NodeNotFound
  ConnectNetworkError(String)
  ConnectIgnored
}

Constructors

  • ConnectTimeout

    Connection timed out.

  • NodeNotFound

    Node not found or unreachable.

  • ConnectNetworkError(String)

    Network connectivity issue.

  • ConnectIgnored

    Connection was ignored (already connected or self).

pub type StartError {
  InvalidNodeName(String)
  AlreadyStarted
  CookieTooLong
  NetworkError(String)
  SystemError(String)
  StartFailed(String)
}

Constructors

  • InvalidNodeName(String)

    Node name is invalid (must contain ‘@’ and be a valid atom).

  • AlreadyStarted

    Node is already started as a distributed node.

  • CookieTooLong

    Cookie is too long (max 255 characters).

  • NetworkError(String)

    Network-related error (e.g., port binding failure).

  • SystemError(String)

    Permission denied or other system error.

  • StartFailed(String)

    Generic startup failure with detailed reason.

Values

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

Connect to another distributed node. Returns Ok(Nil) if connected, Error with reason otherwise.

pub fn connect_bool(node: String) -> Bool

Connect to another distributed node (legacy API). Returns True if connected successfully, False otherwise. @deprecated Use connect() which returns Result instead

pub fn nodes() -> List(String)

Get the list of currently connected nodes.

pub fn ping(node: String) -> Bool

Ping a remote node to check if it is reachable. Returns True if the node responds with pong, False otherwise.

pub fn self_node() -> String

Get the name of the current node.

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

Start distributed node with the given name and cookie. Returns Ok(Nil) on success, Error with specific failure reason.

Search Document