horde v0.2.3 Horde.Registry
A distributed process registry.
Horde.Registry implements a distributed Registry backed by an add-wins last-write-wins δ-CRDT (provided by DeltaCrdt.AWLWWMap
). This CRDT is used for both tracking membership of the cluster and implementing the registry functionality itself. Local changes to the registry will automatically be synced to other nodes in the cluster.
Because of the semantics of an AWLWWMap, the guarantees provided by Horde.Registry are more relaxed than those provided by the standard library Registry. Conflicts will be automatically silently resolved by the underlying AWLWWMap.
Cluster membership is managed with Horde.Cluster
. Joining a cluster can be done with Horde.Cluster.join_hordes/2
and leaving the cluster happens automatically when you stop the registry with Horde.Registry.stop/3
.
Horde.Registry supports the common “via tuple”, described in the documentation for GenServer
.
Link to this section Summary
Functions
Child spec to enable easy inclusion into a supervisor
Get the process registry of the horde
register a process under the given name
unregister the process under the given name
Link to this section Functions
child_spec(options :: list()) :: Supervisor.child_spec()
Child spec to enable easy inclusion into a supervisor.
Example:
supervise([
Horde.Registry
])
Example:
supervise([
{Horde.Registry, [name: MyApp.GlobalRegistry]}
])
Get the process registry of the horde
register(horde :: GenServer.server(), name :: atom(), pid :: pid()) :: {:ok, pid()}
register a process under the given name
stop(Supervisor.supervisor(), reason :: term(), timeout()) :: :ok
unregister(horde :: GenServer.server(), name :: GenServer.name()) :: :ok
unregister the process under the given name