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):
| Export | Signature | Description |
|---|---|---|
plugin_name | () → *const u8 | Null-terminated UTF-8 name |
plugin_execute | (url_ptr: i32, url_len: i32, params_ptr: i32, params_len: i32, out_ptr: *mut i32) → i32 | Execute and return output length |
See examples/wasm-plugin/ for a Rust template.
Structs§
- Wasm
Plugin Meta - Static metadata about a loaded WASM plugin.
Traits§
- Wasm
Plugin Port - Port: load and manage WASM scraping plugins.