Skip to content
Juvix imports

module arch.node.example.template_environment;

import arch.node.example.template_messages open;
import arch.node.types.basics open;
import arch.node.types.engine open;
import arch.node.types.messages open;
import arch.node.types.identities open;
import arch.node.types.anoma_message as Anoma open;

Template Environment

Overview

The Engine environment of the engine.

Mailbox state

Auxiliary Juvix code

syntax alias MailboxOneOne := Nat;

syntax alias MailboxTwoOne := String;

syntax alias MailboxTwoTwo := Bool;

TemplateMailboxStateFirstKind FirstKindMailboxState

type FirstKindMailboxState :=
mkFirstKindMailboxState@{
fieldOne : MailboxOneOne;
};

This is one family of mailbox states without much complexity.

Arguments
fieldOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateMailboxStateSecondKind SecondKindMailboxState

type SecondKindMailboxState :=
mkSecondKindMailboxState@{
fieldOne : MailboxTwoOne;
fieldTwo : MailboxTwoTwo;
};

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Arguments
fieldOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

fieldTwo

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateMailboxState

type TemplateMailboxState :=
| TemplateMailboxStateFirstKind FirstKindMailboxState
| TemplateMailboxStateSecondKind SecondKindMailboxState;

Local state

Auxiliary Juvix code

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

type CustomData :=
mkCustomData@{
word : String;
};

Arguments
word

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateLocalState

type TemplateLocalState :=
mkTemplateLocalState@{
taskQueue : CustomData;
};
Arguments
taskQueue

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Timer handles

Auxiliary Juvix code

syntax alias ArgOne := Nat;

TemplateTimerHandleFirstOption FirstOptionTimerHandle

type FirstOptionTimerHandle :=
mkFirstOptionTimerHandle@{
argOne : ArgOne;
};

Lorem ipsum dolor sit amet, consectetur adipiscing elit. The following code is an example of this case.

Arguments
argOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateTimerHandleSecondOption SecondOptionTimerHandle

type SecondOptionTimerHandle :=
mkSecondOptionTimerHandle@{
argOne : String;
argTwo : Bool;
};
Arguments
argOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

argTwo

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateTimerHandle

type TemplateTimerHandle :=
| TemplateTimerHandleFirstOption FirstOptionTimerHandle
| TemplateTimerHandleSecondOption SecondOptionTimerHandle;

TemplateTimestampedTrigger

TemplateTimestampedTrigger : Type :=
TimestampedTrigger TemplateTimerHandle Anoma.Msg;

Engine Environment

TemplateEnv

TemplateEnv : Type :=
EngineEnv
TemplateLocalState
TemplateMailboxState
TemplateTimerHandle
Anoma.Msg;

Instantiation

exTemplateEnv : TemplateEnv :=
mkEngineEnv@{
localState :=
mkTemplateLocalState@{
taskQueue :=
mkCustomData@{
word := "taskQueue";
};
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};