View Source Cluster.Strategy behaviour (libcluster v3.4.1)

This module defines the behaviour for implementing clustering strategies.

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.

Types

@type bad_nodes() :: [{node(), reason :: term()}]
@type mfa_tuple() :: {module(), atom(), [term()]}
@type strategy_args() :: [Cluster.Strategy.State.t()]
@type topology() :: atom()

Callbacks

Link to this callback

child_spec(strategy_args)

View Source
@callback child_spec(strategy_args()) :: Supervisor.child_spec()
Link to this callback

start_link(strategy_args)

View Source
@callback start_link(strategy_args()) ::
  {:ok, pid()} | :ignore | {:error, reason :: term()}

Functions

Link to this function

connect_nodes(topology, connect, list_nodes, nodes)

View Source
@spec 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

disconnect_nodes(topology, disconnect, list_nodes, nodes)

View Source
@spec 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.