pub struct WasmChainAdapter { /* private fields */ }Expand description
The per-request WASM dispatch adapter.
Holds the proxy-wasm host’s PluginInstances for the route’s WASM
plugins and implements WasmDispatch so the unified
crate::plugins::PluginChain can drive them alongside native
filters with no dataplane-visible difference in attachment semantics.
Implementations§
Source§impl WasmChainAdapter
impl WasmChainAdapter
Sourcepub fn new(instances: PluginInstances) -> Self
pub fn new(instances: PluginInstances) -> Self
Wrap a per-request PluginInstances (created by
crate::wasm::runner::PluginRunner::instantiate).
Sourcepub fn has_pause(&self) -> bool
pub fn has_pause(&self) -> bool
Whether a plugin is paused for callouts (the driver’s loop condition, DW-167).
Sourcepub fn paused_plugin(&self) -> Option<&str>
pub fn paused_plugin(&self) -> Option<&str>
The paused plugin’s name (failure attribution for the loop guard and callout errors; falls back to the caller’s choice).
Sourcepub fn pending_callouts(&mut self) -> Option<(String, Vec<CalloutRequest>)>
pub fn pending_callouts(&mut self) -> Option<(String, Vec<CalloutRequest>)>
Drain the paused plugin’s pending callouts as transport-ready
requests (FIFO — the order the plugin dispatched them). None
when nothing is paused (the driver’s defensive path).
Sourcepub fn requeue_callouts(&mut self, requests: Vec<CalloutRequest>)
pub fn requeue_callouts(&mut self, requests: Vec<CalloutRequest>)
Re-enqueue callouts the driver drained but did not perform: a
mid-delivery re-dispatch (ChainOutcome::CalloutPending while
queued requests remain) must not abandon them — the remainder
goes back AHEAD of the new queue, preserving dispatch order,
so every dispatched callout is eventually performed (or the
loop guard trips). No-op when nothing is paused.
Sourcepub fn deliver_callout(
&mut self,
token: u32,
resp: &CalloutResponse,
) -> ChainOutcome
pub fn deliver_callout( &mut self, token: u32, resp: &CalloutResponse, ) -> ChainOutcome
Deliver a completed callout response to the paused plugin
(synchronous wasmtime re-entry) and collect its resumed
outcome. ChainOutcome::CalloutPending means the plugin
dispatched another callout inside the callback — keep driving.
On every terminal outcome the pause record is cleared.
Sourcepub fn paused_request_headers(&self) -> Vec<(String, String)>
pub fn paused_request_headers(&self) -> Vec<(String, String)>
The paused plugin’s resumed request_headers payload (its
post-callout header map) — what the chain resumes from.
Sourcepub fn paused_response_headers(&self) -> Vec<(String, String)>
pub fn paused_response_headers(&self) -> Vec<(String, String)>
The paused plugin’s resumed response_headers payload.
Sourcepub fn paused_request_body(&self) -> Vec<u8> ⓘ
pub fn paused_request_body(&self) -> Vec<u8> ⓘ
The paused plugin’s resumed request_body payload.
Sourcepub fn paused_response_body(&self) -> Vec<u8> ⓘ
pub fn paused_response_body(&self) -> Vec<u8> ⓘ
The paused plugin’s resumed response_body payload.
Sourcepub fn clear_pause(&mut self)
pub fn clear_pause(&mut self)
Clear the pause record after the driver collected the resumed
plugin’s phase payload (the record survives the Continue
delivery so paused_* can read the payload afterwards).
Trait Implementations§
Source§impl WasmDispatch for WasmChainAdapter
impl WasmDispatch for WasmChainAdapter
Source§fn 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)>)
on_request_headers for the named WASM plugin. Returns the
outcome and the (possibly modified) headers.Source§fn 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>)
on_request_body for the named WASM plugin. Returns the
outcome and the (possibly modified) body.Source§fn 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)>)
on_response_headers for the named WASM plugin. Returns the
outcome and the (possibly modified) headers.Source§fn 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>)
on_response_body for the named WASM plugin. Returns the
outcome and the (possibly modified) body.Auto Trait Implementations§
impl Freeze for WasmChainAdapter
impl !RefUnwindSafe for WasmChainAdapter
impl Send for WasmChainAdapter
impl Sync for WasmChainAdapter
impl Unpin for WasmChainAdapter
impl !UnwindSafe for WasmChainAdapter
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more