View Source OddJob.Utils (OddJob v0.5.1)
Internal utilities for working with OddJob processes.
To avoid unexpected behavior, it's recommended that developers do not interact
directly with OddJob processes. See OddJob
for the public API.
Link to this section Summary
Functions
Extracts the pid
from an {:ok, pid}
tuple.
Links and monitors the pid
and returns the tuple {pid, monitor_ref}
.
Returns the OddJob.Pool.Supervisor
name in :via for the given name
.
Returns the OddJob.Async.ProxySupervisor
name in :via for the given name
.
Returns the OddJob.Queue
name in :via for the given name
.
Returns the OddJob.Scheduler.Supervisor
name in :via for the given name
.
Link to this section Types
Specs
name() :: OddJob.Registry.name()
Link to this section Functions
Specs
Extracts the pid
from an {:ok, pid}
tuple.
iex> pid = spawn_link(fn -> :hello end)
iex> pid == OddJob.Utils.extract_pid({:ok, pid})
true
Specs
Links and monitors the pid
and returns the tuple {pid, monitor_ref}
.
Example
iex> pid = spawn(fn -> [] end)
iex> {^pid, ref} = OddJob.Utils.link_and_monitor(pid)
iex> receive do
...> {:DOWN, ^ref, :process, ^pid, :normal} -> :received
...> end
:received
Specs
Returns the OddJob.Pool.Supervisor
name in :via for the given name
.
iex> OddJob.Utils.pool_supervisor_name(:job)
{:via, Registry, {OddJob.Registry, {:job, :pool_sup}}}
Specs
Returns the OddJob.Async.ProxySupervisor
name in :via for the given name
.
iex> OddJob.Utils.proxy_sup_name(:job)
{:via, Registry, {OddJob.Registry, {:job, :proxy_sup}}}
Specs
Returns the OddJob.Queue
name in :via for the given name
.
iex> OddJob.Utils.queue_name(:job)
{:via, Registry, {OddJob.Registry, {:job, :queue}}}
Specs
Returns the OddJob.Scheduler.Supervisor
name in :via for the given name
.
iex> OddJob.Utils.scheduler_sup_name(:job)
{:via, Registry, {OddJob.Registry, {:job, :scheduler_sup}}}