Skip to content
Juvix preamble

module node_architecture.engines.template_environment;

import prelude open;
import node_architecture.types.engine open;
import node_architecture.engines.template_messages open;

Template Environment

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Overview

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Mailbox states

Auxiliary Juvix code

syntax alias MailboxOneOne := Nat;

syntax alias MailboxTwoOne := String;

syntax alias MailboxTwoTwo := Bool;

type TemplateMailboxState :=
| TemplateMailboxStateOne {fieldOne : MailboxOneOne}
| TemplateMailboxStateTwo {
fieldOne : MailboxTwoOne;
fieldTwo : MailboxTwoTwo
};

TemplateMailboxStateOne

This is one family of mailbox states without much complexity.

fieldOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateMailboxStateTwo

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

fieldOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

fieldTwo

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Local state

Auxiliary Juvix code

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

type NiceState := mkNiceState {word : String};

stringRepresentation

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

type TemplateLocalState := mkTemplateLocalState {taskQueue : NiceState};

Timer handles

Auxiliary Juvix code

syntax alias ArgOne := Nat;

type TemplateTimerHandle :=
| TemplateTimerHandleOne {argOne : ArgOne}
| TemplateTimerHandleTwo {
argOne : String;
argTwo : Bool
};

TemplateTimerHandleOne

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

handleOneExample : TemplateTimerHandle :=
TemplateTimerHandleOne@{
argOne := 7
};
argOne

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

TemplateTimerHandleTwo

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

handleTwoExample : TemplateTimerHandle :=
TemplateTimerHandleTwo@{
argOne := "hello";
argTwo := true
};

Environment summary

We have finished all the type definitions, there is nothing to explain in the template as the code is self-explanatory.

TemplateEnvironment : Type :=
EngineEnvironment TemplateLocalState TemplateMailboxState TemplateTimerHandle;

Example of a Template environment

templateEnvironmentExample : TemplateEnvironment :=
mkEngineEnvironment@{
name := "template";
localState :=
mkTemplateLocalState@{
taskQueue :=
mkNiceState@{
word := "taskQueue"
}
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := []
};