WasmChainAdapter

Struct WasmChainAdapter 

Source
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

Source

pub fn new(instances: PluginInstances) -> Self

Source

pub fn has_pause(&self) -> bool

Whether a plugin is paused for callouts (the driver’s loop condition, DW-167).

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn paused_response_headers(&self) -> Vec<(String, String)>

The paused plugin’s resumed response_headers payload.

Source

pub fn paused_request_body(&self) -> Vec<u8> ⓘ

The paused plugin’s resumed request_body payload.

Source

pub fn paused_response_body(&self) -> Vec<u8> ⓘ

The paused plugin’s resumed response_body payload.

Source

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

Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

fn on_done(&mut self)

Call on_done for all WASM instances (the cleanup path).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyExt for T
where T: Any + ?Sized,

§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, X> CoerceTo<T> for X
where 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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,