Horde.Cluster (Horde v0.8.5) View Source

Public functions to join and leave hordes.

Calling Horde.Cluster.set_members/2 will join the given members in a cluster. Cluster membership is propagated via a CRDT, so setting it once on a single node is sufficient.

{:ok, sup1} = Horde.DynamicSupervisor.start_link([], name: :supervisor_1, strategy: :one_for_one)
{:ok, sup2} = Horde.DynamicSupervisor.start_link([], name: :supervisor_2, strategy: :one_for_one)
{:ok, sup3} = Horde.DynamicSupervisor.start_link([], name: :supervisor_3, strategy: :one_for_one)

:ok = Horde.Cluster.set_members(:supervisor_1, [:supervisor_1, :supervisor_2, :supervisor_3])

Link to this section Summary

Link to this section Types

Specs

member() :: name() | {name(), node()}

Specs

name() :: atom()

Link to this section Functions

Specs

members(horde :: GenServer.server()) :: [member()]

Get the members (nodes) of the horde

Link to this function

set_members(horde, members, timeout \\ 5000)

View Source

Specs

set_members(
  horde :: GenServer.server(),
  members :: [member()],
  timeout :: timeout()
) :: :ok | {:error, term()}