Skip to main content

Module runtime

Module runtime 

Source
Expand description

WASM Plugin Runtime

Real wasmtime-backed plugin executor.

§ABI

Plugins export, at minimum:

  • memory (default linear memory).
  • alloc(size: i32) -> i32 — host calls this to obtain a slot in plugin memory it can write input bytes into.
  • dealloc(ptr: i32, size: i32) — host calls this to free either the input slot (after the call) or the output slot (after the host has read the result).
  • One function per declared hook, with one of two signatures:
    • Result-returning hooks (pre_query, route, authenticate, rewrite): (ptr: i32, len: i32) -> i64 where the i64 is (result_ptr << 32) | result_len. result_ptr == 0 && result_len == 0 is a valid “no result” reply (host treats it as the default per-hook outcome).
    • Observer hooks (post_query, metrics, on_connect, on_disconnect): (ptr: i32, len: i32) with no return — the host ignores any output the plugin may have written.

The runtime tries the result-returning signature first; if the exported function has the no-return shape it falls back.

Structs§

LoadedPlugin
A loaded and instantiated plugin
RuntimeStats
Runtime statistics
WasmPluginRuntime
WASM plugin runtime

Enums§

PluginError
Error types for plugin operations
PluginState
Plugin state