Skip to main content

Crate forge_host

Crate forge_host 

Source
Expand description

WASM plugin runtime.

Loads sandboxed WASM components, enforces fuel / memory / epoch limits, provides the host-api imports declared in wit/host.wit, and invokes plugin exports.

§Sandbox

Plugins receive no filesystem, network, clock, RNG, environment, or process state. The only host imports are log and case-convert. WASI imports are not linked. See ADR-0001 and ADR-0008.

§Resource limits

Every plugin invocation has its own Store / StoreLimits / wasmtime resource budget:

  • Fuel — instructions executed. consume_fuel = true on the engine.
  • Memory — bytes allocated by guest linear memory. Enforced via wasmtime::ResourceLimiter.
  • Wall-clock time — enforced via epoch interruption. The engine has a shared epoch counter ticked by a background thread on a fixed cadence; each store sets epoch_deadline_trap() at the appropriate count.

Modules§

filesystem
Output guard: validates files returned from a generator before they hit disk.

Structs§

Engine
Shared wasmtime::Engine plus a background thread that ticks the epoch counter so per-store wall-clock deadlines can fire.
GenerationOutput
HostState
Per-invocation state held in wasmtime::Store<HostState>.
Limits
OutputFile
Plugin
Loaded plugin component. Holds the compiled component + cached info(). Each invocation builds a fresh Store with its own resource budget.
TransformOutput

Enums§

EngineError
FileMode
LoadError
PluginKind
ResourceKind
StageError