Engine Families¶
Overview¶
The Anoma Specification revolves around the concept of an engine, an actor-like entity encapsulating the state and behaviour of a computational process. Engines operate within a specific execution context called the engine environment. In Anoma, engines are organised into families based on shared behaviour and environment, although each engine instance has its own local state and name.
Each engine family must declare specific components that each of its member engine instances will have. For Anoma specifications, the components are:
- Engine Environment
-
This serves as the execution context for engines. In addition to the local state, the engine environment encompasses elements such as the mailbox cluster owned by an engine instance and a finite set of acquaintances—other engine instances known to the current one that can interact with it.
- Action Function
-
The function that describes all possible ways in which engines can act, by changing their environment, sending messages, spawning new engine instances, and update their list of active timers.
- 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.
Juvix engine families definitions¶
For the Anoma Specification, engine families are written in Juvix Markdown. All necessary types and functions to define these engines can be found in the module engine_family. See Tutorials on Writing Engine Families for a tutorial on how to structure the writing of engine families in Juvix.
Below we showcase the current engine families and their related components in Juvix for the Anoma Specification. Please be aware that not all engine families are listed here, and the specification is continually expanding with new engine families.
Engine messages in Anoma
Juvix imports
module node_architecture.types.anoma_message;
import node_architecture.basics open;
import node_architecture.engines.ticker_overview open using {TickerMsg};
Anoma Messages¶
An Anoma message is a admissible messages that can be sent between nodes in
the network. An Anoma message is of the type Msg
. Each constructor of the type
Msg
corresponds to a specific type of message comming from a specific engine
family. For example, the engine family Ticker
has a corresponding message type
TickerMsg
.
type Msg := MsgTicker TickerMsg;
Engine environments in Anoma
Juvix imports
module node_architecture.types.anoma_environment;
import node_architecture.engines.ticker_environment open;
Anoma Engine Environments¶
An Anoma engine environment is a collection of all the necessary
information/context that an engine instance needs to operate.
See Engine Environments for more information on engine environments.
Below is the definition of the type Env
which represents an Anoma engine
environment. This means, an Anoma engine instance would have an environment of
type Env
.
For example, an environment for an engine instance of the engine family Ticker
is of type TickerEnvironment
.
type Env := EnvTicker TickerEnvironment;