Skip to content
Juvix imports

module arch.node.engines.naming;

import prelude open;
import arch.node.types.engine open;
import arch.node.engines.naming_config open public;
import arch.node.engines.naming_messages open public;
import arch.node.engines.naming_environment open public;
import arch.node.engines.naming_behaviour open public;
import arch.node.types.anoma as Anoma open;

open naming_config_example;
open naming_environment_example;

Naming Engine

The Naming Engine is responsible for tracking naming information. It supports name resolution, submitting name evidence, and querying name evidence.

Purpose

The Naming Engine tracks which IdentityNames correspond with which ExternalIdentitys using IdentityNameEvidence. It provides functionality for resolving names, submitting name evidence, and querying name evidence.

Components

Type

NamingEngine : Type :=
Engine
NamingCfg
NamingLocalState
NamingMailboxState
NamingTimerHandle
NamingActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;

Example of a naming engine

exampleNamingEngine : NamingEngine :=
mkEngine@{
cfg := namingCfg;
env := namingEnv;
behaviour := namingBehaviour;
};

where namingCfg is defined as follows:

namingCfg : EngineCfg NamingCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "naming";
cfg := mkNamingCfg;
};

where namingEnv is defined as follows:

namingEnv : NamingEnv :=
mkEngineEnv@{
localState :=
mkNamingLocalState@{
evidenceStore := Set.empty;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};

and namingBehaviour is defined as follows:

namingBehaviour : NamingBehaviour :=
mkEngineBehaviour@{
guards :=
First [resolveNameGuard; submitNameEvidenceGuard; queryNameEvidenceGuard];
};