Skip to content
Juvix imports

module arch.node.net.transport_connection_behaviour;

import arch.node.net.transport_connection_messages open;
import arch.node.net.transport_connection_config open;
import arch.node.net.transport_connection_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;

Transport Connection 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.

TransportConnectionActionArguments

TransportConnectionActionArguments : Type := Unit;

Actions

Auxiliary Juvix code

TransportConnectionAction

TransportConnectionAction : Type :=
Action
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

TransportConnectionActionInput

TransportConnectionActionInput : Type :=
ActionInput
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg;

TransportConnectionActionEffect

TransportConnectionActionEffect : Type :=
ActionEffect
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
Anoma.Msg
Anoma.Cfg
Anoma.Env;

TransportConnectionActionExec

TransportConnectionActionExec : Type :=
ActionExec
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyAction

Respond with a TransportConnectionMsgExampleResponse.

State update
The state remains unchanged.
Messages to be sent
A TransportConnectionMsgExampleReply 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 : TransportConnectionActionInput)
: Option TransportConnectionActionEffect := TODO;

Action Labels

exampleReplyActionLabel

exampleReplyActionLabel : TransportConnectionActionExec :=
Seq [exampleReplyAction];

Guards

Auxiliary Juvix code

TransportConnectionGuard

TransportConnectionGuard : Type :=
Guard
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

TransportConnectionGuardOutput

TransportConnectionGuardOutput : Type :=
GuardOutput
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

TransportConnectionGuardEval

TransportConnectionGuardEval : Type :=
GuardEval
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyGuard

Guard description (optional).

Condition
Message type is TransportConnectionMsgExampleRequest.
exampleReplyGuard
(trigger : TransportConnectionTimestampedTrigger)
(cfg : TransportConnectionCfg)
(env : TransportConnectionEnv)
: Option TransportConnectionGuardOutput := TODO;

The Transport Connection behaviour

TransportConnectionBehaviour

TransportConnectionBehaviour : Type :=
EngineBehaviour
TransportConnectionLocalCfg
TransportConnectionLocalState
TransportConnectionMailboxState
TransportConnectionTimerHandle
TransportConnectionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

module transport_connection_behaviour_example;
exTransportConnectionBehaviour : TransportConnectionBehaviour :=
mkEngineBehaviour@{
guards := First [exampleReplyGuard];
};
end;

Transport Connection Action Flowchart

exampleReply Flowchart

flowchart TD
  subgraph C[Conditions]
    CMsg>TransportConnectionMsgExampleRequest<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>TransportConnectionMsgExampleResponse<br/>argOne]
  end
exampleReply flowchart