Trait WasmPlugin

Source
pub trait WasmPlugin: Send + Sync {
    // Required methods
    fn manifest(&self) -> &PluginManifest;
    fn initialize<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        context: &'life1 ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_parameters(
        &self,
        entry_point: &str,
        params: &[Value],
    ) -> Result<()>;
    fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        entry_point: &'life1 str,
        parameters: &'life2 [Value],
        context: &'life3 ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn execute_streaming<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        entry_point: &'life1 str,
        input_stream: Box<dyn Stream<Item = Value> + Send + Unpin>,
        context: &'life2 ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<Value>> + Send + Unpin>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn cleanup<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        context: &'life1 ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PluginHealth>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Main plugin trait for WebAssembly plugins

Required Methods§

Source

fn manifest(&self) -> &PluginManifest

Get the plugin manifest

Source

fn initialize<'life0, 'life1, 'async_trait>( &'life0 mut self, context: &'life1 ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize the plugin

Source

fn validate_parameters(&self, entry_point: &str, params: &[Value]) -> Result<()>

Validate input parameters for a specific entry point

Source

fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, entry_point: &'life1 str, parameters: &'life2 [Value], context: &'life3 ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute a plugin function

Source

fn execute_streaming<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, entry_point: &'life1 str, input_stream: Box<dyn Stream<Item = Value> + Send + Unpin>, context: &'life2 ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<Value>> + Send + Unpin>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute with streaming input

Source

fn cleanup<'life0, 'life1, 'async_trait>( &'life0 mut self, context: &'life1 ExecutionContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clean up resources

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PluginHealth>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get plugin health status

Implementors§