View Source Please.Nodes (Please v0.1.0)

An agent listing nodes in the network and the requests they can handle. It also keeps track of the busyness of the current node and it's name.

The key is the atom node name of the node. The value must be a metadata map.

This dictionary is built from remote nodes that are connected to the network, and will be stored in a map handled in this module acting as an Agent.

Summary

Functions

Returns a specification to start this module under a supervisor.

Get the metadata of all nodes.

Get the metadata of a node.

Get the referrals from the configuration.

Make a remote procedure call to a node.

Set this node metadata

Set the node metadata

Start the agent.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec get() :: map()

Get the metadata of all nodes.

@spec get(atom()) :: map() | nil

Get the metadata of a node.

@spec referrals() :: map()

Get the referrals from the configuration.

The referrals are a comma-separated list of atoms that represent the nodes that are connected to the network. This list is used to build the initial state of the agent, filtering out the nodes that are not reachable.

Link to this function

rpc(node, module, function, args \\ [])

View Source
@spec rpc(atom(), atom(), atom(), list()) :: {:ok, any()} | {:error, any()}

Make a remote procedure call to a node.

This function will call a function of a module in the given node with optional arguments.

@spec set(map()) :: :ok

Set this node metadata

@spec set(atom(), map()) :: :ok

Set the node metadata

@spec start_link(any()) :: {:ok, pid()}

Start the agent.