Kanta.Registry (kanta v0.4.2)

Kanta Registry

Summary

Functions

Fetch the config for an Kanta supervisor instance.

Find the {pid, value} pair for a registered Kanta process.

Build a via tuple suitable for calls to a supervised Kanta process.

Returns the pid of a supervised Kanta process, or nil if the process can't be found.

Functions

Link to this function

child_spec(arg)

Link to this function

config(kanta_name)

@spec config(atom()) :: Kanta.Config.t()

Fetch the config for an Kanta supervisor instance.

Example

Get the default instance config:

Kanta.Registry.config(Kanta)

Get config for a custom named instance:

Kanta.Registry.config(MyApp.Kanta)
Link to this function

lookup(kanta_name, role \\ nil)

Find the {pid, value} pair for a registered Kanta process.

Example

Get the default instance config:

Kanta.Registry.lookup(Kanta)

Get a supervised module's pid:

Kanta.Registry.lookup(Kanta, Kanta.Notifier)
Link to this function

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

Build a via tuple suitable for calls to a supervised Kanta process.

Example

For an Kanta supervisor:

Kanta.Registry.via(Kanta)

For a plugin:

Kanta.Registry.via(Kanta, {:plugin, Kanta.DeepL.Plugin})
Link to this function

whereis(kanta_name, role \\ nil)

Returns the pid of a supervised Kanta process, or nil if the process can't be found.

Example

Get the Kanta supervisor's pid:

Kanta.Registry.whereis(Kanta)

Get the pid for a plugin:

Kanta.Registry.whereis(Kanta, {:plugin, MyApp.Kanta.Plugin})