Anoma.Node.Examples.ERegistry (Anoma v0.25.0)

Summary

Types

t()

I am the state of a registry created in the examples.

Functions

I create an address for a given node id and module.

I create an address for a given node id, module, and label.

I register a process in the registry and then lookup its pid.

Given a node id and an engine, I generate a name that can be used to register processes.

I generate a name from a module, node id and label.

I register a few engines for a specific node, and then ask the registry for the list.

Given a node id and an engine, I check if this process is registered and alive.

Given a node, I check for a local engine of a specific type.

I start a new registry, or return the address of the one that is already running.

Types

@type t() :: %Anoma.Node.Examples.ERegistry{pid: pid() | nil}

I am the state of a registry created in the examples.

Fields

  • :pid - the pid of the supervision tree.

Functions

Link to this function

create_address()

@spec create_address() :: Anoma.Node.Registry.Address.t()

I create an address for a given node id and module.

I assert that the address is created correctly.

Link to this function

create_address_with_label()

@spec create_address_with_label() :: Anoma.Node.Registry.Address.t()

I create an address for a given node id, module, and label.

Link to this function

find_pid_of_process(node_id \\ "")

@spec find_pid_of_process(String.t()) :: :ok

I register a process in the registry and then lookup its pid.

Link to this function

generate_name()

Given a node id and an engine, I generate a name that can be used to register processes.

Link to this function

generate_name_with_label()

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

I generate a name from a module, node id and label.

Link to this function

list_engines_for_node(node_id \\ "")

@spec list_engines_for_node(String.t()) :: :ok

I register a few engines for a specific node, and then ask the registry for the list.

Link to this function

process_registered?(node_id, engine)

@spec process_registered?(String.t(), atom()) :: boolean()

Given a node id and an engine, I check if this process is registered and alive.

Link to this function

single_node_running()

@spec single_node_running() :: :ok

Given a node, I check for a local engine of a specific type.

If there are multiple engines present of the same type, I expect an error.

Link to this function

start_registry()

@spec start_registry() :: t() | :error

I start a new registry, or return the address of the one that is already running.