Skip to content
Juvix imports

module arch.node.net.node_proxy;

import arch.node.net.node_proxy_messages open;
import arch.node.net.node_proxy_config open;
import arch.node.net.node_proxy_environment open;
import arch.node.net.node_proxy_behaviour open;
import arch.node.types.basics open;
import arch.node.types.engine open;
import arch.node.types.anoma as Anoma open;

open node_proxy_config_example;
open node_proxy_environment_example;
open node_proxy_behaviour_example;

Node Proxy Engine

Purpose

A Node Proxy engine is responsible for communication with one specific remote node.

It performs transport selection, connection establishment and maintenance.

It forwards messages between local engine instances and Transport Connection engine instances.

Connections may be ephemeral or permanent. Ephemeral connections are established when the first message is sent to the node, or when the remote node initiates a connection, and not re-established automatically when the connection is lost. Permanent connections are established when the Node Proxy is started, and automatically re-established when the connection is lost.

The engine instance name corresponds to the remote NodeID.

Engine Components

Type

NodeProxyEngine : Type :=
Engine
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

exNodeProxyEngine : NodeProxyEngine :=
mkEngine@{
cfg := exNodeProxyCfg;
env := exNodeProxyEnv;
behaviour := exNodeProxyBehaviour;
};

Where exNodeProxyCfg is defined as follows:

exNodeProxyCfg : NodeProxyCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "node-proxy";
cfg := mkNodeProxyLocalCfg;
};

exNodeProxyEnv is defined as follows:

exNodeProxyEnv : NodeProxyEnv :=
mkEngineEnv@{
localState := mkNodeProxyLocalState;
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and exNodeProxyBehaviour is defined as follows:

module node_proxy_behaviour_example;
exNodeProxyBehaviour : NodeProxyBehaviour :=
mkEngineBehaviour@{
guards := First [exampleReplyGuard];
};
end;