Skip to content
Juvix imports

module arch.node.net.node_proxy_behaviour;

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.types.basics open;
import arch.node.types.identities open;
import arch.node.types.messages open;
import arch.node.types.engine open;
import arch.node.types.anoma as Anoma open;

Node Proxy Behaviour

Overview

A node proxy engine acts in the ways described on this page. The action labels correspond to the actions that can be performed by the engine. Using the action labels, we describe the effects of the actions.

Action arguments

The action arguments are set by a guard and passed to the action function as part of the GuardOutput.

NodeProxyActionArguments

NodeProxyActionArguments : Type := Unit;

Actions

Auxiliary Juvix code

NodeProxyAction

NodeProxyAction : Type :=
Action
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NodeProxyActionInput

NodeProxyActionInput : Type :=
ActionInput
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg;

NodeProxyActionEffect

NodeProxyActionEffect : Type :=
ActionEffect
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NodeProxyActionExec

NodeProxyActionExec : Type :=
ActionExec
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyAction

Respond with a NodeProxyMsgExampleResponse.

State update
The state remains unchanged.
Messages to be sent
A NodeProxyMsgExampleReply message with the data set by exampleReplyGuard.
Engines to be spawned
No engine is created by this action.
Timer updates
No timers are set or cancelled.
exampleReplyAction
(input : NodeProxyActionInput) : Option NodeProxyActionEffect := TODO;

Action Labels

exampleReplyActionLabel

exampleReplyActionLabel : NodeProxyActionExec := Seq [exampleReplyAction];

Guards

Auxiliary Juvix code

NodeProxyGuard

NodeProxyGuard : Type :=
Guard
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NodeProxyGuardOutput

NodeProxyGuardOutput : Type :=
GuardOutput
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NodeProxyGuardEval

NodeProxyGuardEval : Type :=
GuardEval
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyGuard

Guard description (optional).

Condition
Message type is NodeProxyMsgExampleRequest.
exampleReplyGuard
(trigger : NodeProxyTimestampedTrigger)
(cfg : NodeProxyCfg)
(env : NodeProxyEnv)
: Option NodeProxyGuardOutput := TODO;

The Node Proxy behaviour

NodeProxyBehaviour

NodeProxyBehaviour : Type :=
EngineBehaviour
NodeProxyLocalCfg
NodeProxyLocalState
NodeProxyMailboxState
NodeProxyTimerHandle
NodeProxyActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

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

Node Proxy Action Flowchart

exampleReply Flowchart

flowchart TD
  subgraph C[Conditions]
    CMsg>NodeProxyMsgExampleRequest<br/>from local engine]
    CEnv[(exampleValue < 10)]
  end

  G(exampleReplyGuard)
  A(exampleReplyAction)

  C --> G -- *exampleReplyActionLabel* --> A --> E

  subgraph E[Effects]
    EEnv[(exampleValue := exampleValue + 1)]
    EMsg>NodeProxyMsgExampleResponse<br/>argOne]
  end
exampleReply flowchart