Module wasm_plugin

Module wasm_plugin 

Source
Expand description

WASM plugin port — dynamic plugin loading WASM plugin port — dynamic plugin system

Defines the interface for loading and executing WebAssembly plugins that implement the ScrapingService interface. Any language that compiles to WASM + WASI can be used to write a Stygian plugin.

§Architecture

stygian-graph
  └─ WasmPluginPort  ← this file
        │
        └─ WasmPluginLoader (adapters/wasm_plugin.rs)
              │
              ├─ wasmtime Engine + Component (feature = "wasm-plugins")
              └─ WasmScrapingService implements ScrapingService

§Feature gate

The adapter that actually loads WASM files requires the wasm-plugins Cargo feature. The port trait is always available so application code can depend on it without pulling in wasmtime.

§Plugin contract

A WASM plugin must export two functions with these signatures (in WASI Preview 1 / C ABI style):

ExportSignatureDescription
plugin_name() → *const u8Null-terminated UTF-8 name
plugin_execute(url_ptr: i32, url_len: i32, params_ptr: i32, params_len: i32, out_ptr: *mut i32) → i32Execute and return output length

See examples/wasm-plugin/ for a Rust template.

Structs§

WasmPluginMeta
Static metadata about a loaded WASM plugin.

Traits§

WasmPluginPort
Port: load and manage WASM scraping plugins.