Skip to main content

Module engine

Module engine 

Source
Expand description

The sans-IO Engine state machine. The sans-IO Engine state machine

Modules§

bootstrap
Engine bootstrap state — consolidated owner of every bootstrap field the engine reads during install + poll.
call_context
Per-function-call invocation context.
core
The Engine struct + test-only constructor + registration accessors. Hot-path poll cycle lives in engine::poll.
dispatch_entry
Engine dispatch types
graph_slot
GraphSlot - per-FunctionProto compiled data per docs/ENGINE.md §3.
invoke
Op invocation lifecycle
pending_async
PendingAsync + ExecutionState - engine’s async-suspension bookkeeping + execution liveness tracking per §5.3.
poll
8-phase poll cycle + handle_completion per docs/ENGINE.md §7 + §9.
step
EngineStep - observable output of Engine::poll per docs/ENGINE.md §10 + docs/internal/IMPLEMENTATION_PLAN.md //! lines 751-753.

Structs§

BootstrapInput
Host-supplied bootstrap input staging request — borrowed shape. The host hands the engine a target name plus an ordered (input_name, value_bytes) slice; the engine validates against the target’s declared formal input ports and runs the Principle 1a copy (cap-check → try_reserve_exactextend_from_slice) so the caller’s borrowed buffers can drop the moment crate::node::Node::run_bootstrap returns.
Engine
Single-Node engine state. Built via Node::ensure_ready; tests use Engine::new() and seed fields directly.
EngineStats
Point-in-time hot-path counters for dashboards + saturation detection. Not synchronized against an in-flight poll cycle.
ExecutionState
Per-execution liveness tracker Stored in Engine.execution_state, keyed by ExecId. /// minimum-viable: just the output counter for GC bookkeeping; may extend.
GraphSlot
Per-FunctionProto compiled data installed on the Engine. Keyed in Engine.graphs by (domain, name, overload) - the canonical symbol-table key the linker dedupes on. The map key IS the name, so GraphSlot carries no separate name field.
ModuleBootstrap
Per-target Module bootstrap metadata. Stamped into the engine bootstrap state when the install path sees a module_phase = bootstrap FunctionProto.
OwnedBootstrapInput
Owned-form mirror of BootstrapInput. Kept around because callers (and tests) may want an owned shape, but the new flat run_bootstrap path stages each entry directly without parking it on a queue.
PendingAsync
Bookkeeping for an Op suspended on a CommandId per docs/ENGINE.md §9.1. Stored in Engine.pending_async, keyed by CommandId.

Enums§

BootstrapKind
Discriminator carried over from earlier shapes. Module is the only kind today; the enum is kept so external introspection that matched on BootstrapKind::Module keeps compiling.
BootstrapStatus
Host-facing bootstrap lifecycle status. Returned by Node::bootstrap_status so the caller can decide whether to keep polling or surface a “wait for input” prompt.
EngineStep
One step of work the engine performed during a poll cycle. Engine::poll returns Vec<EngineStep> capturing every event the host can observe.
OpDispatch
Per-OpRef dispatch decision, pre-stamped at install time by Engine::resolve_dispatch. Runtime invoke is one indirect probe against GraphSlot.op_dispatch[idx]. Four variants:

Functions§

make_protocol_dispatcher
Build a RoleDispatcher for a concrete ProtocolRuntime impl. Called from Engine::register_protocol_dispatcher and from any test/production setup that needs to register dispatcher entries on a fresh Engine.

Type Aliases§

StatelessInvokeFn
Stateless syscall invoke fn pointer Same input/output shape as a role-trait dispatch_atomic call; returns DispatchResult for uniform handling by invoke_one.