Skip to main content

Crate uni_plugin_wasm

Crate uni_plugin_wasm 

Source
Expand description

WASM Component Model loader for the uni-db plugin framework.

uni-plugin-wasm provides the host-side machinery to load WASM plugins built against the uni:plugin WIT worlds. The boundary uses:

  • WIT-typed contracts for each plugin kind (scalar, aggregate, procedure, locy-agg, hook, storage, …) — typed exports + capability- gated host imports.
  • Arrow IPC over linear memory for RecordBatch exchange — host calls plugin’s alloc(len), copies IPC bytes in, calls the work export, reads IPC bytes back at the returned (ptr, len).
  • Pre-warmed instance pools to amortize the 10–100 ms wasmtime instantiation cost across hot-path UDF invocations.

§Crate status

WasmLoader::load is fully wired behind the wasmtime-runtime feature (default-on): it instantiates a component, negotiates capabilities against the host grants, and registers the plugin’s scalar / aggregate / procedure adapters end-to-end through the respective WIT worlds.

Modules§

adapter
ComponentScalarFn — bridges a CM scalar-plugin instance to ScalarPluginFn.
adapter_aggregate
Aggregate adapter — bridges a CM aggregate-plugin instance to AggregatePluginFn / PluginAccumulator.
adapter_procedure
Procedure adapter — bridges a CM procedure-plugin instance to ProcedurePlugin.
bindings
wasmtime-generated bindings for the uni:plugin WIT worlds.
buffer
WasmIpcBuffer — RAII handle for a buffer allocated inside a WASM plugin’s linear memory.
error
Error types for the WASM loader.
host_state
Per-Store host state.
ipc
Arrow IPC bridge — re-exported from uni-plugin-wasm-rt.
linker
Per-major Linker builder for the scalar-plugin world.
loader
WasmLoader — top-level entry point for loading WASM Component Model plugins.
multi_version
M10 per-major Linker cache for multi-version ABI coexistence.
pool
Instance pool — re-exported from uni-plugin-wasm-rt.

Structs§

MultiVersionLinker
Per-major Linker cache.
WasmIpcBuffer
RAII handle to a buffer allocated inside a WASM plugin’s linear memory.
WasmLoader
Top-level WASM Component Model plugin loader.

Enums§

WasmError
Errors specific to the WASM loader.

Constants§

SUPPORTED_MAJORS
Major versions the host can link against.

Type Aliases§

WasmInstancePool
Type alias — generic InstancePool parameterized with crate::WasmError.