Juvix imports
module arch.node.net.storage_behaviour;
import arch.node.net.storage_messages open;
import arch.node.net.storage_config open;
import arch.node.net.storage_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;
Storage Behaviour¶
Overview¶
A Storage 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.
StorageActionArguments¶
StorageActionArguments : Type := Unit;
Actions¶
Auxiliary Juvix code
StorageAction¶
StorageAction : Type :=
  Action
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
StorageActionInput¶
StorageActionInput : Type :=
  ActionInput
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg;
StorageActionEffect¶
StorageActionEffect : Type :=
  ActionEffect
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
StorageActionExec¶
StorageActionExec : Type :=
  ActionExec
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
exampleReplyAction¶
Respond with a StorageMsgExampleResponse.
- State update
- The state remains unchanged.
- Messages to be sent
- A StorageMsgExampleReplymessage with the data set byexampleReplyGuard.
- Engines to be spawned
- No engine is created by this action.
- Timer updates
- No timers are set or cancelled.
exampleReplyAction (input : StorageActionInput) : Option StorageActionEffect :=
  TODO;
Action Labels¶
exampleReplyActionLabel¶
exampleReplyActionLabel : StorageActionExec := Seq [exampleReplyAction];
Guards¶
Auxiliary Juvix code
StorageGuard¶
StorageGuard : Type :=
  Guard
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
StorageGuardOutput¶
StorageGuardOutput : Type :=
  GuardOutput
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
StorageGuardEval¶
StorageGuardEval : Type :=
  GuardEval
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
exampleReplyGuard¶
Guard description (optional).
- Condition
- Message type is StorageMsgExampleRequest.
exampleReplyGuard
  (trigger : StorageTimestampedTrigger)
  (cfg : StorageCfg)
  (env : StorageEnv)
  : Option StorageGuardOutput := TODO;
Engine behaviour¶
StorageBehaviour¶
StorageBehaviour : Type :=
  EngineBehaviour
    StorageLocalCfg
    StorageLocalState
    StorageMailboxState
    StorageTimerHandle
    StorageActionArguments
    Anoma.Msg
    Anoma.Cfg
    Anoma.Env;
Instantiation¶
module storage_behaviour_example;
  exStorageBehaviour : StorageBehaviour :=
    mkEngineBehaviour@{
      guards := First [exampleReplyGuard];
    };
end;
Action Flowchart¶
exampleReply Flowchart¶
flowchart TD
  subgraph C[Conditions]
    CMsg>StorageMsgExampleRequest<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>StorageMsgExampleResponse<br/>argOne]
  endexampleReply flowchart