Anoma.Node.Registry (Anoma v0.25.0)

Summary

Functions

I return the contents of the registry.

Given a node_id, I return a list of all the engine names I know for this node.

Given an engine type, I return the name of the local engine of that type.

I register the calling process under the name of the engine at the given node id.

I generate the :via stanza for a process with the given node_id and engine name.

Given a node id and engine, I check if there is a process registered with that address and return the pid.

Functions

Link to this function

address(node_id, engine, label \\ nil)

Link to this function

dump_register()

@spec dump_register() :: [{Anoma.Node.Registry.Address.t(), pid(), any()}]

I return the contents of the registry.

Link to this function

engines_for(node_id)

@spec engines_for(String.t()) :: [atom()]

Given a node_id, I return a list of all the engine names I know for this node.

I filter out all the non-engine names based on an allow list.

Link to this function

local_node_id()

@spec local_node_id() :: {:ok, any()} | {:error, term()}

Given an engine type, I return the name of the local engine of that type.

If there are multiple engines of that type present, I raise an error.

Link to this function

register(node_id, engine, label \\ nil)

@spec register(String.t(), atom(), atom()) :: {:ok, pid()} | {:error, term()}

I register the calling process under the name of the engine at the given node id.

Link to this function

via(node_id, engine, label \\ nil)

@spec via(String.t(), atom(), atom()) ::
  {:via, Registry, {atom(), Anoma.Node.Registry.Address.t()}}

I generate the :via stanza for a process with the given node_id and engine name.

Link to this function

whereis(node_id, engine, label \\ nil)

@spec whereis(String.t(), atom(), atom()) :: pid() | nil

Given a node id and engine, I check if there is a process registered with that address and return the pid.