Imison.Registry (Imison v0.1.0)

Copy Markdown View Source

Local process storage for Imison instances.

Summary

Functions

Fetch the config of a running Imison instance, raising when none runs under that name.

Find the {pid, value} pair registered for an Imison supervisor or one of its processes.

Build a via tuple for an Imison supervisor or one of its processes, registering value with it.

Types

key()

@type key() :: Imison.name() | {Imison.name(), role()}

role()

@type role() :: term()

value()

@type value() :: term()

Functions

config(imison_name)

@spec config(Imison.name()) :: Imison.Config.t()

Fetch the config of a running Imison instance, raising when none runs under that name.

Example

Imison.Registry.config(Imison)

lookup(imison_name, role \\ nil)

@spec lookup(Imison.name(), role()) :: nil | {pid(), value()}

Find the {pid, value} pair registered for an Imison supervisor or one of its processes.

Returns nil when nothing is registered under that name and role, including when Imison.Registry itself isn't running (the :imison application isn't started) and when the registered process has exited but the registry hasn't removed its entry yet.

Example

Imison.Registry.lookup(Imison, Imison.Capture.Worker)

via(imison_name, role \\ nil, value \\ nil)

@spec via(Imison.name(), role(), value()) ::
  {:via, Registry, {Imison.Registry, key()} | {Imison.Registry, key(), value()}}

Build a via tuple for an Imison supervisor or one of its processes, registering value with it.

Example

Imison.Registry.via(Imison, nil, config)