Anoma.Node.Examples.ENode (Anoma v0.29.0)
Summary
Functions
I initialize the ETS table to keep track of creates nodes.
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{ grpc_port: integer(), node_id: String.t() | nil, pid: pid() | nil, tcp_ports: [integer()] }
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.:tcp_ports
- The ports on which the node is listening for connections.:grpc_ports
- The ports on which the node is listening for grpc connections.
Functions
initialize_ets()
@spec initialize_ets() :: atom()
I initialize the ETS table to keep track of creates nodes.
My only reason for existence is to keep track of the nodes that are created in the system and their GRPC ports.
kill_all_nodes()
@spec kill_all_nodes() :: :ok
I kill all the nodes in the vm.
start_node(opts \\ [])
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.
stop_node(node)
@spec stop_node(t()) :: :ok
I stop a node and assert that's is gone.