libcluster v3.1.1 Cluster.Strategy behaviour

This module defines the behaviour for implementing clustering strategies.

Link to this section Summary

Functions

Given a list of node names, attempts to connect to all of them. Returns :ok if all nodes connected, or {:error, [{node, reason}, ..]} if we failed to connect to some nodes.

Given a list of node names, attempts to disconnect from all of them. Returns :ok if all nodes disconnected, or {:error, [{node, reason}, ..]} if we failed to disconnect from some nodes.

Link to this section Types

Link to this type

bad_nodes()
bad_nodes() :: [{node(), reason :: term()}]

Link to this type

mfa_tuple()
mfa_tuple() :: {module(), atom(), [term()]}

Link to this type

strategy_args()
strategy_args() :: [Cluster.Strategy.State.t()]

Link to this type

topology()
topology() :: atom()

Link to this section Functions

Link to this function

connect_nodes(topology, connect, list_nodes, nodes)
connect_nodes(topology(), mfa_tuple(), mfa_tuple(), [atom()]) ::
  :ok | {:error, bad_nodes()}

Given a list of node names, attempts to connect to all of them. Returns :ok if all nodes connected, or {:error, [{node, reason}, ..]} if we failed to connect to some nodes.

All failures are logged.

Link to this function

difference(a, b)

Link to this function

disconnect_nodes(topology, disconnect, list_nodes, nodes)
disconnect_nodes(topology(), mfa_tuple(), mfa_tuple(), [atom()]) ::
  :ok | {:error, bad_nodes()}

Given a list of node names, attempts to disconnect from all of them. Returns :ok if all nodes disconnected, or {:error, [{node, reason}, ..]} if we failed to disconnect from some nodes.

All failures are logged.

Link to this function

intersection(a, b)

Link to this section Callbacks

Link to this callback

child_spec(strategy_args)

Link to this callback

start_link(strategy_args)
start_link(strategy_args()) ::
  {:ok, pid()} | :ignore | {:error, reason :: term()}