Skip to main content

Crate uni_plugin_extism

Crate uni_plugin_extism 

Source
Expand description

Extism loader for the uni-db plugin framework.

uni-plugin-extism is the user-facing WASM loader. It sits parallel to uni-plugin-wasm (the Component Model loader). It follows the “Option C” hybrid pattern:

  • Component Model (uni-plugin-wasm) — typed WIT contracts, capability gating by linker absence, used for the Lua-host, trusted built-ins, and plugins where soundness is load-bearing.
  • Extism (this crate) — bytes-in / bytes-out, runtime-checked capabilities, used for user-authored UDFs that benefit from Extism’s mature 13-language host SDK story.

Trust is a property of the granted CapabilitySet, not of which ABI a plugin happens to use. A user can author a “trusted” plugin in Extism by granting it broad capabilities; a built-in can author against Extism if the structural advantages of CM aren’t load-bearing for its use case. The framework intentionally decouples ABI choice from trust tier.

§Crate status

Loader is wired through the extism-sdk. ExtismLoader::load runs a two-pass instantiation (manifest probe, then plugin build) and surfaces failures as ExtismError::Instantiate. The host-fn registration surface (HostFnRegistry) and capability gating model are in place; the NotYetImplemented placeholder has been retired.

§Why two WASM loaders

The proposal’s loader matrix (§5.1) keeps the four authoring categories (compile-time Rust, WASM, PyO3, Lua) but splits the WASM row into two ABIs. Both ABIs converge on the same PluginRegistrar — the executor cannot tell whether a registered ScalarPluginFn was authored against WIT or Extism. The two loaders share the wasmtime runtime (Extism is itself wasmtime-backed), so the runtime cost is one wasmtime process, not two.

Modules§

adapter
Adapters bridging Extism plugin exports to the uni_plugin capability traits.
adapter_aggregate
Aggregate adapter — bridges Extism aggregate plugins to AggregatePluginFn / PluginAccumulator.
adapter_common
Shared helpers for the three Extism adapter modules.
adapter_procedure
Procedure adapter — bridges Extism procedure plugins to ProcedurePlugin.
error
Error types for the Extism loader.
exports
Plugin-export readers — manifest and register.
host_fns
Host function registration surface for Extism plugins.
host_svc
Capability-gated host services for Extism plugins.
ipc
Arrow IPC bridge — re-exported from uni-plugin-wasm-rt.
loader
ExtismLoader — top-level entry point for loading Extism plugins.
pool
Instance pool — re-exported from uni-plugin-wasm-rt.
wire_translate
Wire → internal type translation.

Structs§

ExtismAggregateFn
AggregatePluginFn adapter wrapping an Extism plugin pool.
ExtismLoader
Top-level Extism plugin loader.
ExtismProcedure
ProcedurePlugin adapter wrapping an Extism plugin pool.
ExtismScalarFn
ScalarPluginFn adapter wrapping an Extism plugin pool.
HostFnRegistry
Registry of host functions available to Extism plugins.
RegistrationManifest
Top-level register export payload.
WireFnSignature
Wire-level scalar / aggregate / procedure signature shipped by a plugin’s register export.

Enums§

ExtismError
Errors specific to the Extism loader.
RegistrationEntry
One registration entry — a single qname plus its kind + signature.
WireArgType
Wire-level argument type shipped by a plugin.

Functions§

arrow_name_to_datatype
Map an Arrow primitive name (lowercase, as plugins write it) to arrow_schema::DataType.
parse_manifest_json
Parse the bytes returned by a plugin’s manifest export into an ExtismPluginManifest.
parse_registration_json
Parse the bytes returned by a plugin’s register export into a RegistrationManifest.
read_manifest_export
Call a live plugin’s manifest export and parse the response.
read_register_export
Call a live plugin’s register export and parse the response.
register_default_host_svc
Register the default capability-gated host-service surface on a loader.
wire_arg_to_internal
Translate a wire WireArgType into the internal ArgType.
wire_fn_sig_to_internal
Translate a full wire scalar/window signature into the internal FnSignature.
wire_null_handling_to_internal
Translate a wire null-handling string into the internal enum.
wire_volatility_to_internal
Translate a wire volatility string into the DataFusion enum.