View Source ElixirExt.Registry behaviour (Reginald v0.0.1-rc.0.0.2)

The ElixirExt.Registry module is used to define the behaviour that is necessary to be qualified as a RegMod for name registration of processes.

The definition according to the Elixir Docs (found here) is as follows:

The :via option expects a module that exports register_name/2, unregister_name/1, whereis_name/1 and send/2. One such example is the :global module which uses these functions for keeping the list of names of processes and their associated PIDs that are available globally for a network of Elixir nodes. Elixir also ships with a local, decentralized and scalable registry called Registry for locally storing names that are generated dynamically.

The definition according to the Erlang Docs (found here) is similar:

Register the gen_server process with the registry represented by RegMod. The RegMod callback is to export the functions register_name/2, unregister_name/1, whereis_name/1, and send/2, which are to behave like the corresponding functions in global. Thus, {via,global,GlobalName} is a valid reference equivalent to {global,GlobalName}.

The following callbacks and typespecs are copied over from the global registry definitions in order to ensure that we have the typespecs as maintained by Erlang's global.

Summary

Callbacks

Link to this callback

register_name(name, pid)

View Source
@callback register_name(name :: term(), pid()) :: :yes | :no
@callback send(name :: term(), msg :: term()) :: pid()
@callback unregister_name(name :: term()) :: :ok
@callback whereis_name(name :: term()) :: pid() | :undefined