Anoma.Node.Examples.ENode (Anoma v0.32.0)

Summary

Types

t()

I am the state of a TCP listener.

Functions

I kill all the nodes in the vm.

I start a new node given a node id and returns its process id.

I stop a node and assert that's is gone.

Types

@type t() :: %Anoma.Node.Examples.ENode{node_id: String.t() | nil, pid: pid() | nil}

I am the state of a TCP listener.

My fields contain information to listen for TCP connection with a remote node.

Fields

  • :node_id - The key of this router. This value is used to announce myself to other
  • :pid - the pid of the supervision tree.

Functions

Link to this function

kill_all_nodes()

@spec kill_all_nodes() :: :ok

I kill all the nodes in the vm.

Link to this function

start_node(opts \\ [])

@spec start_node(Keyword.t()) :: t() | {:error, :failed_to_start_node}

I start a new node given a node id and returns its process id.

When a node is started, I put its ENode struct in an ETS table for later retrieval.

When a node is already spawned, I lookup the ENode struct in the ETS table. Some meta data (in particular, the GRPC port) is only available when the node is started so I fetch that data from the ETS table.

Link to this function

stop_node(node)

@spec stop_node(t()) :: :ok

I stop a node and assert that's is gone.