Skip to content

Engines

Overview

The Anoma Specification revolves around the concept of an engine, an actor-like entity encapsulating the engine environment and behaviour of a computational process. In Anoma, every engine is of a specific type. Engines of the same type share the same behaviour. However, two engines of the same type may have different execution context.

Engine components

Environment

The execution context of an engine. It consists of:

  • a local state for storing engine-specific data,
  • a mailbox cluster for receiving and sending messages,
  • a set of acquaintances (other engines that can interact with this engine), and
  • a set of active timers.

The complete definition of an engine environment can be found in the Juvix engine environment definition.

Behaviour

The function that describes all possible ways in which engines can act. This includes:

  • modifying their environment,
  • sending messages to other engines,
  • spawning new engine instances, and
  • managing their active timers.

The complete definition of an engine behaviour can be found in the Juvix engine behaviour definition.

Guards

The finite set of guard functions that describe the conditions under which the local state of the engine's instance should change by invoking the action function.

Conflict Solver

The function that resolves conflicts between actions to maximize their concurrency.

Anoma engine definitions

All required types and functions to define these engines can be found in the module engine. To understand how we have structured the definitions of engine types, see Tutorials on Writing Engine Families.

Anoma engine messages

type Msg :=
| MsgTemplate TemplateMsg
| MsgTicker TickerMsg
| MsgIdentityManagement IdentityManagementMsg
| MsgDecryption DecryptionMsg
| MsgEncryption EncryptionMsg
| MsgCommitment CommitmentMsg
| MsgVerification VerificationMsg
| MsgReadsFor ReadsForMsg
| MsgSignsFor SignsForMsg
| MsgNaming NamingMsg
| MsgLocalKVStorage LocalKVStorageMsg
| MsgLogging LoggingMsg
| MsgWallClock WallClockMsg
| MsgLocalTSStorage LocalTSStorageMsg;

Anoma engine environments

type Env :=
| EnvTemplate TemplateEnv
| EnvTicker TickerEnv
| EnvIdentityManagement IdentityManagementEnv
| EnvDecryption DecryptionEnv
| EnvEncryption EncryptionEnv
| EnvCommitment CommitmentEnv
| EnvVerification VerificationEnv
| EnvReadsFor ReadsForEnv
| EnvSignsFor SignsForEnv
| EnvNaming NamingEnv
| EnvLocalKeyValueStorage LocalKVStorageEnv
| EnvLogging LoggingEnv
| EnvWallClock WallClockEnv
| EnvLocalTSeries LocalTSStorageEnv;