View Source Elsa.ElsaRegistry (Elsa.fi v4.1.0)
Implements a custom version of the Registry for Elsa, allowing the registration of shared processes like brod clients as well as processes started under brod supervision.
Saves the process identifier-to-name key/value pairs to ETS.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Look up the cached partition count for a topic. Direct ETS read — no process hop.
Returns {:ok, count} or :error if not yet cached.
Callback implementation for GenServer.init/1.
Cache the partition count for a topic. Direct ETS write — no process hop. The cache table is owned by the registry process and is deleted when the connection dies.
Register the pid of a process to the registry under a given name.
Select all records within the registry and return them as a list.
Wraps the Kernel module send/2 function with a safe call to
ensure the receiving process is defined.
Start the Elsa registery process and link it to the current process. Creates the process registry table in ETS and traps exits during the init process.
De-register the process name from its associated pid within the registry.
Lookup a pid from within the registry by name.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get_partition_count(atom(), String.t()) :: {:ok, non_neg_integer()} | :error
Look up the cached partition count for a topic. Direct ETS read — no process hop.
Returns {:ok, count} or :error if not yet cached.
Callback implementation for GenServer.init/1.
@spec put_partition_count(atom(), String.t(), non_neg_integer()) :: true
Cache the partition count for a topic. Direct ETS write — no process hop. The cache table is owned by the registry process and is deleted when the connection dies.
Register the pid of a process to the registry under a given name.
Select all records within the registry and return them as a list.
Wraps the Kernel module send/2 function with a safe call to
ensure the receiving process is defined.
@spec start_link(keyword()) :: GenServer.on_start()
Start the Elsa registery process and link it to the current process. Creates the process registry table in ETS and traps exits during the init process.
De-register the process name from its associated pid within the registry.
Lookup a pid from within the registry by name.