pub trait WasmDispatch {
// Required methods
fn on_request_headers(
&mut self,
name: &str,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>);
fn on_request_body(
&mut self,
name: &str,
body: Vec<u8>,
) -> (ChainOutcome, Vec<u8>);
fn on_response_headers(
&mut self,
name: &str,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>);
fn on_response_body(
&mut self,
name: &str,
body: Vec<u8>,
) -> (ChainOutcome, Vec<u8>);
// Provided method
fn on_done(&mut self) { ... }
}Expand description
A minimal per-request WASM dispatch interface the wasm domain
implements to bridge its PluginInstances into the unified chain.
The chain calls these methods on the adapter for each WASM plugin in
the phase, in order, passing the plugin’s NAME: the adapter holds
the per-request WASM instances keyed by name and dispatches to
exactly that instance (so a chain interleaving native filters and
WASM plugins in one phase runs each entry exactly once). NoWasm
is a no-op adapter that always returns ChainOutcome::Continue.
Required Methods§
Sourcefn on_request_headers(
&mut self,
name: &str,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
fn on_request_headers( &mut self, name: &str, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Run on_request_headers for the named WASM plugin. Returns the
outcome and the (possibly modified) headers.
Sourcefn on_request_body(
&mut self,
name: &str,
body: Vec<u8>,
) -> (ChainOutcome, Vec<u8>)
fn on_request_body( &mut self, name: &str, body: Vec<u8>, ) -> (ChainOutcome, Vec<u8>)
Run on_request_body for the named WASM plugin. Returns the
outcome and the (possibly modified) body.
Sourcefn on_response_headers(
&mut self,
name: &str,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
fn on_response_headers( &mut self, name: &str, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Run on_response_headers for the named WASM plugin. Returns the
outcome and the (possibly modified) headers.
Sourcefn on_response_body(
&mut self,
name: &str,
body: Vec<u8>,
) -> (ChainOutcome, Vec<u8>)
fn on_response_body( &mut self, name: &str, body: Vec<u8>, ) -> (ChainOutcome, Vec<u8>)
Run on_response_body for the named WASM plugin. Returns the
outcome and the (possibly modified) body.