Skip to content
Juvix imports

module arch.node.engines.net_registry_behaviour;

import arch.node.engines.net_registry_messages open;
import arch.node.engines.net_registry_config open;
import arch.node.engines.net_registry_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;

Network Registry Behaviour

Overview

A Network Registry 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.

Network Registry Action Flowchart

exampleReply Flowchart

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

Action arguments

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

NetworkRegistryActionArguments

NetworkRegistryActionArguments : Type := Unit;

Actions

Auxiliary Juvix code

NetworkRegistryAction

NetworkRegistryAction : Type :=
Action
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NetworkRegistryActionInput

NetworkRegistryActionInput : Type :=
ActionInput
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg;

NetworkRegistryActionEffect

NetworkRegistryActionEffect : Type :=
ActionEffect
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NetworkRegistryActionExec

NetworkRegistryActionExec : Type :=
ActionExec
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyAction

Respond with a NetworkRegistryMsgExampleResponse.

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

Action Labels

exampleReplyActionLabel

exampleReplyActionLabel : NetworkRegistryActionExec := Seq [exampleReplyAction];

Guards

Auxiliary Juvix code

NetworkRegistryGuard

NetworkRegistryGuard : Type :=
Guard
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NetworkRegistryGuardOutput

NetworkRegistryGuardOutput : Type :=
GuardOutput
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

NetworkRegistryGuardEval

NetworkRegistryGuardEval : Type :=
GuardEval
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

exampleReplyGuard

Guard description (optional).

Condition
Message type is NetworkRegistryMsgExampleRequest.
exampleReplyGuard
(trigger : NetworkRegistryTimestampedTrigger)
(cfg : NetworkRegistryCfg)
(env : NetworkRegistryEnv)
: Option NetworkRegistryGuardOutput := TODO;

Engine behaviour

NetworkRegistryBehaviour

NetworkRegistryBehaviour : Type :=
EngineBehaviour
NetworkRegistryLocalCfg
NetworkRegistryLocalState
NetworkRegistryMailboxState
NetworkRegistryTimerHandle
NetworkRegistryActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Instantiation

module registry_behaviour_example;
exNetworkRegistryBehaviour : NetworkRegistryBehaviour :=
mkEngineBehaviour@{
guards := First [exampleReplyGuard];
};
end;