Snakepit.Pool.Registry (snakepit v0.1.2)
Registry for pool worker processes.
This is a thin wrapper around Elixir's Registry that provides:
- Consistent naming for worker processes
- Easy migration path to distributed registry (Horde)
- Helper functions for worker lookup
Summary
Functions
Returns the child spec for the registry.
Get worker_id from PID for O(1) lookups in :DOWN messages.
Gets the PID for a worker ID.
Lists all registered worker IDs.
Register a worker with metadata for O(1) reverse lookups. This is only used for manual registration - workers started with via_tuple are already registered.
Returns a via tuple for registering/looking up a worker process.
Counts the number of registered workers.
Checks if a worker is registered.
Functions
Returns the child spec for the registry.
Get worker_id from PID for O(1) lookups in :DOWN messages.
Gets the PID for a worker ID.
Lists all registered worker IDs.
Register a worker with metadata for O(1) reverse lookups. This is only used for manual registration - workers started with via_tuple are already registered.
Returns a via tuple for registering/looking up a worker process.
Examples
iex> Snakepit.Pool.Registry.via_tuple("worker_123")
{:via, Registry, {Snakepit.Pool.Registry, "worker_123"}}
Counts the number of registered workers.
Checks if a worker is registered.