RaftEx.Network (raft_ex v0.1.0)

View Source

Handles distributed RPC communication between Raft nodes across the cluster.

Summary

Functions

Makes a synchronous call to a server.

Casts a message to a server asynchronously.

Handle node down events.

Handle node up events. Attempts to re-register with any Raft clusters the local node was part of.

Monitors a remote server process.

Sends an RPC message to a server.

Start node monitoring for Raft cluster communication. Sets up monitoring of remote nodes and connects to seed nodes.

Types

opts()

@type opts() :: keyword()

rpc()

@type rpc() :: struct()

server_id()

@type server_id() :: {atom(), node()}

Functions

call(server_id, msg, timeout \\ 5000)

@spec call(server_id(), term(), timeout()) :: {:ok, term()} | {:error, term()}

Makes a synchronous call to a server.

cast(server_id, msg)

@spec cast(server_id(), term()) :: :ok | {:error, term()}

Casts a message to a server asynchronously.

handle_node_down(node)

@spec handle_node_down(node()) :: :ok

Handle node down events.

handle_node_up(node)

@spec handle_node_up(node()) :: :ok

Handle node up events. Attempts to re-register with any Raft clusters the local node was part of.

monitor(server_id)

@spec monitor(server_id()) :: reference() | {:error, term()}

Monitors a remote server process.

send_rpc(server_id, rpc, opts \\ [])

@spec send_rpc(server_id(), rpc(), opts()) :: :ok | {:error, term()}

Sends an RPC message to a server.

start_monitoring(opts \\ [])

Start node monitoring for Raft cluster communication. Sets up monitoring of remote nodes and connects to seed nodes.

Options

  • :seeds - list of seed nodes to connect to
  • :cookie - Erlang distribution cookie