Skip to content
Juvix preamble

module arch.node.engines.template;

import prelude open;
import arch.node.engines.template_messages open public;
import arch.node.engines.template_config open public;
import arch.node.engines.template_environment open public;
import arch.node.engines.template_behaviour open public;
import arch.node.types.engine open public;
import arch.node.types.anoma as Anoma open;

open template_config_example;
open template_environment_example;

Template Engine

Purpose

Brief summary of the purpose of the engine.

Components

  • Some
  • Useful
  • Links

Type

TemplateEngine : Type :=
Engine
TemplateLocalCfg
TemplateLocalState
TemplateMailboxState
TemplateTimerHandle
TemplateActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a template engine

exampleTemplateEngine : TemplateEngine :=
mkEngine@{
cfg := templateCfg;
env := templateEnv;
behaviour := templateBehaviour;
};

where templateCfg is defined as follows:

templateCfg : TemplateCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "template";
cfg :=
mkTemplateLocalCfg@{
example := 1;
value := "hello world";
};
};

templateEnv is defined as follows:

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

and templateBehaviour is defined as follows:

templateBehaviour : TemplateBehaviour :=
mkEngineBehaviour@{
guards := First [justHiGuard; exampleReplyGuard];
};