gleam/erlang/node

Types

pub type ConnectError {
  FailedToConnect
  LocalNodeIsNotAlive
}

Constructors

  • FailedToConnect

    Was unable to connect to the node.

  • LocalNodeIsNotAlive

    The local node is not alive, so it is not possible to connect to the other node.

pub type Node

Functions

pub fn connect(node: Atom) -> Result(Node, ConnectError)

Establish a connection to a node, so the nodes can send messages to each other and any other connected nodes.

Returns Error(FailedToConnect) if the node is not reachable.

Returns Error(LocalNodeIsNotAlive) if the local node is not alive, meaning it is not running in distributed mode.

pub fn self() -> Node

Return the current node.

pub fn send(node: Node, name: Atom, message: a) -> Nil

Send a message to a named process on a given node.

These messages are untyped, like regular Erlang messages.

pub fn to_atom(node: Node) -> Atom

Convert a node to the atom of its name.

pub fn visible() -> List(Node)

Return a list of all visible nodes in the cluster, not including the current node.

The current node can be included by calling self() and prepending the result.

let all_nodes = [node.self(), ..node.visible()]
Search Document