View Source Horde.Cluster (Horde v0.9.0)

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])

Summary

Types

@type member() :: name() | {name(), node()}
@type name() :: atom()

Functions

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

Get the members (nodes) of the horde

Link to this function

set_members(horde, members, timeout \\ 5000)

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