pub trait Plugin: Send + Sync {
// Required methods
fn plugin_type(&self) -> &str;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Every plugin (native or scripted) implements this trait.
A plugin is a node in a compiled policy graph. The engine drives each node
through execute and follows the node’s success or
error port depending on the result.
Required Methods§
Sourcefn plugin_type(&self) -> &str
fn plugin_type(&self) -> &str
Unique identifier for the plugin type (e.g., “proxy-rewrite”, “upstream”).
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes the plugin logic against the request/response context.
Contract:
ctxis taken by value: the plugin owns theContextfor the duration of the call and must hand it back in either outcome — insidePluginOutputon success, or insidePluginExecutionErroron failure. The context is never lost.named_inputscarries values that upstream nodes published asnamed_outputs, keyed by name; most plugins ignore it.- On
Ok, the graph engine routes the returned context through the node’ssuccessport. OnErr, thePluginExecutionErrorcarries both the context and aGatewayError, letting the engine record the error and continue through the node’serrorport (typically toward anerror-handlernode) instead of aborting the request.