Juvix imports
module arch.node.engines.executor;
import prelude open;
import arch.node.types.engine open;
import arch.node.engines.executor_config open public;
import arch.node.engines.executor_messages open public;
import arch.node.engines.executor_environment open public;
import arch.node.engines.executor_behaviour open public;
import arch.node.types.anoma as Anoma open;
open executor_config_example;
open executor_environment_example;
Executor Engine¶
Conceptually, Executors run the executor function in order to compute transaction outputs, including state updates (see here for more on the executor function). Executors may be co-located with shards, or with mempool workers. The Execution Engines might keep a pool of Executors, or spin a new one up with each TransactionCandidate.
Purpose¶
The Executor Engine maintains executor capabilities for a specific identity and handles executor requests for that identity. Only the original caller and anyone to whom they pass the engine instance reference can send messages to the instance and decrypt data encrypted to the corresponding identity.
Components¶
- Executor Messages
- Executor Config
- Executor Environment
- Executor Behaviour
Type¶
ExecutorEngine : Type :=
Engine
ExecutorCfg
ExecutorLocalState
ExecutorMailboxState
ExecutorTimerHandle
ExecutorActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;
Example of a executor engine¶
exampleExecutorEngine : ExecutorEngine :=
mkEngine@{
cfg := executorCfg;
env := executorEnv;
behaviour := executorBehaviour;
};
where executorCfg
is defined as follows:
executorCfg : EngineCfg ExecutorCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "executor";
cfg :=
mkExecutorCfg@{
timestamp := 0;
executable := "";
lazy_read_keys := Set.empty;
eager_read_keys := Set.empty;
will_write_keys := Set.empty;
may_write_keys := Set.empty;
worker := mkPair none "";
issuer := mkPair none "";
};
};
executorEnv
is defined as follows:
executorEnv : ExecutorEnv :=
mkEngineEnv@{
localState :=
mkExecutorLocalState@{
program_state :=
mkProgramState@{
data := "";
halted := false;
};
completed_reads := Map.empty;
completed_writes := Map.empty;
};
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};
and executorBehaviour
is defined as follows:
executorBehaviour : ExecutorBehaviour :=
mkEngineBehaviour@{
guards := First [processReadGuard];
};