Locker.Registry
This module provides a global process registry using locker Erlang
library as the storage backend. It supports e.g., the GenServer‘s
{:via, module, term} API.
Example
You can spawn a regular GenServer process that will be registered
to locker using the GenServer API directly.
GenServer.start([], [name: {:via, Locker.Registry, "my_process"}])
Note that when using GenServer, you will need to refresh the registration
using Locker.extend_lease/3. To avoid this, you should use
Locker.Server instead of GenServer directly.
You can find out the process id of the named process using
Locker.Registry.whereis_name.
Locker.Registry.whereis_name("my_process")
#=> {:ok, pid}
You can uregister the named process by calling
Locker.Registry.unregister.
Locker.Registry.unregister("my_process")
Summary
Functions
Registers the given pid to a name globally
Sends a message to the given name
Unregisters the calling process
Unregisters the given name
Finds the process identifier for the given name
Functions
Specs
register_name(any, pid) :: :yes | :no
Registers the given pid to a name globally.
Specs
send(any, any) :: :ok | {:badarg, {any, any}}
Sends a message to the given name.