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

Link to this section Functions

Specs

extract_pid({:ok, pid()}) :: pid()

Extracts the pid from an {:ok, pid} tuple.

iex> pid = spawn_link(fn -> :hello end)
iex> pid == OddJob.Utils.extract_pid({:ok, pid})
true
Link to this function

pool_supervisor_name(name)

View Source

Specs

pool_supervisor_name(term()) :: name()

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

proxy_sup_name(term()) :: name()

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

queue_name(term()) :: name()

Returns the OddJob.Queue name in :via for the given name.

iex> OddJob.Utils.queue_name(:job)
{:via, Registry, {OddJob.Registry, {:job, :queue}}}
Link to this function

scheduler_sup_name(name)

View Source

Specs

scheduler_sup_name(term()) :: name()

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}}}