Skip to main content

WasmRuntime

Trait WasmRuntime 

Source
pub trait WasmRuntime: Send + Sync {
    // Required methods
    fn load_component<'life0, 'life1, 'async_trait>(
        &'life0 self,
        path: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<PluginMetadata>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn invoke_l4_peek<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        module_id: &'life1 ModuleId,
        export_name: &'life2 str,
        args_json: &'life3 str,
        input: L4PeekInput,
    ) -> Pin<Box<dyn Future<Output = Result<L4PeekDecision, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn invoke_l4_bytes<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        module_id: &'life1 ModuleId,
        export_name: &'life2 str,
        args_json: &'life3 str,
        input: L4BytesInput,
    ) -> Pin<Box<dyn Future<Output = Result<L4BytesDecision, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn invoke_l7_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        module_id: &'life1 ModuleId,
        export_name: &'life2 str,
        args_json: &'life3 str,
        input: L7RequestInput,
    ) -> Pin<Box<dyn Future<Output = Result<L7RequestDecision, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn invoke_l7_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        module_id: &'life1 ModuleId,
        export_name: &'life2 str,
        args_json: &'life3 str,
        input: L7ResponseInput,
    ) -> Pin<Box<dyn Future<Output = Result<L7ResponseDecision, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Runtime contract between the executor and the WASM plugin layer.

Declared in vane-core; the concrete implementation lives in vane-wasm (WasmtimeRuntime). vaned constructs an Arc<dyn WasmRuntime> at startup and injects it into the engine before the first FlowGraph compilation that references WASM plugins.

Required Methods§

Source

fn load_component<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<Arc<PluginMetadata>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load a WASM component from disk, call registry.get-metadata(), validate the result, and return the cached metadata.

The runtime may consult a .cwasm content-hash cache to skip recompilation. Cache write failures are non-fatal (WARN log).

Source

fn invoke_l4_peek<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, module_id: &'life1 ModuleId, export_name: &'life2 str, args_json: &'life3 str, input: L4PeekInput, ) -> Pin<Box<dyn Future<Output = Result<L4PeekDecision, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Invoke the l4-peek handler exported by the named component.

module_id must previously have been loaded via load_component. export_name selects which middleware export to call. args_json is the per-call-site configuration string delivered to the plugin via host.get-args. input carries the peek buffer and context.

Returns PluginError::Trap if the component has not been loaded.

Source

fn invoke_l4_bytes<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, module_id: &'life1 ModuleId, export_name: &'life2 str, args_json: &'life3 str, input: L4BytesInput, ) -> Pin<Box<dyn Future<Output = Result<L4BytesDecision, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Invoke the l4-bytes handler exported by the named component.

Source

fn invoke_l7_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, module_id: &'life1 ModuleId, export_name: &'life2 str, args_json: &'life3 str, input: L7RequestInput, ) -> Pin<Box<dyn Future<Output = Result<L7RequestDecision, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Invoke the l7-request handler exported by the named component.

Source

fn invoke_l7_response<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, module_id: &'life1 ModuleId, export_name: &'life2 str, args_json: &'life3 str, input: L7ResponseInput, ) -> Pin<Box<dyn Future<Output = Result<L7ResponseDecision, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Invoke the l7-response handler exported by the named component.

Implementors§