Skip to content
Juvix imports

module tutorial.engines.template;

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

open template_config_example;
open template_environment_example;
open template_behaviour_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;

Instantiation

exTemplateEngine : TemplateEngine :=
mkEngine@{
cfg := exTemplateCfg;
env := exTemplateEnv;
behaviour := exTemplateBehaviour;
};

Where exTemplateCfg is defined as follows:

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

exTemplateEnv is defined as follows:

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

and exTemplateBehaviour is defined as follows:

module template_behaviour_example;

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