pub struct PluginChain<W: WasmDispatch = NoWasm> { /* private fields */ }Expand description
The unified per-request plugin chain.
Built from a route’s plugin names + the gateway’s plugin configs +
the native registry + a WASM dispatch adapter. Holds the native
filter instances for this request and the names of the WASM plugins
(the adapter owns the WASM instances). Dispatches each phase to the
plugins in deterministic phase order, short-circuiting on
LocalResponse/Error.
Implementations§
Source§impl<W: WasmDispatch> PluginChain<W>
impl<W: WasmDispatch> PluginChain<W>
Sourcepub fn new(
plugin_names: &[String],
configs: &HashMap<String, PluginConfig>,
registry: &NativeRegistry,
wasm: W,
) -> (Self, Vec<NativeCreateFailure>)
pub fn new( plugin_names: &[String], configs: &HashMap<String, PluginConfig>, registry: &NativeRegistry, wasm: W, ) -> (Self, Vec<NativeCreateFailure>)
Build a chain for a route’s plugin names.
plugin_names is the route’s plugins list (declaration order).
configs is the gateway’s top-level plugins list keyed by
name. registry provides native filter factories. wasm is the
per-request WASM dispatch adapter (use NoWasm for native-only
chains).
Returns the chain and the list of native entries whose factory
ERRORED (NativeCreateFailure) — fail-closed material (DW-157):
the configured filter never runs, so the caller must answer the
request with the fail-closed 500 rather than proceed without it;
the chain deliberately does NOT silently skip a reported entry.
A plugin name that is neither a native filter in the registry nor
a WASM plugin in configs is silently skipped (it was already
flagged by validation as an unknown reference, and the
dataplane’s health gate fails closed on it before the chain is
built).
Sourcepub fn has_phase(&self, phase: PluginPhase) -> bool
pub fn has_phase(&self, phase: PluginPhase) -> bool
Whether at least one plugin declares the given phase. The dataplane uses this to decide whether a body phase requires buffering (DW-157): a route whose plugins declare no body phase keeps its zero-buffering streaming path.
Sourcepub fn on_request_headers(
&mut self,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
pub fn on_request_headers( &mut self, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Run the request_headers phase across all plugins in order.
Returns the outcome and the (possibly modified) headers.
Sourcepub fn resume_request_headers(
&mut self,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
pub fn resume_request_headers( &mut self, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Continue the request_headers phase AFTER the paused entry
(DW-167): headers is the resumed plugin’s post-callout
output. Plugins before (and including) the paused entry do not
run again.
Sourcepub fn on_request_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
pub fn on_request_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
Run the request_body phase across all plugins in order.
Returns the outcome and the (possibly modified) body.
Sourcepub fn resume_request_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
pub fn resume_request_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
Continue the request_body phase AFTER the paused entry
(DW-167): body is the resumed plugin’s post-callout output.
Sourcepub fn on_response_headers(
&mut self,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
pub fn on_response_headers( &mut self, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Run the response_headers phase across all plugins in order.
Returns the outcome and the (possibly modified) headers.
Sourcepub fn resume_response_headers(
&mut self,
headers: Vec<(String, String)>,
) -> (ChainOutcome, Vec<(String, String)>)
pub fn resume_response_headers( &mut self, headers: Vec<(String, String)>, ) -> (ChainOutcome, Vec<(String, String)>)
Continue the response_headers phase AFTER the paused entry
(DW-167): headers is the resumed plugin’s post-callout
output.
Sourcepub fn on_response_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
pub fn on_response_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
Run the response_body phase across all plugins in order.
Returns the outcome and the (possibly modified) body.
Sourcepub fn resume_response_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
pub fn resume_response_body(&mut self, body: Vec<u8>) -> (ChainOutcome, Vec<u8>)
Continue the response_body phase AFTER the paused entry
(DW-167): body is the resumed plugin’s post-callout output.
Sourcepub fn on_done(&mut self)
pub fn on_done(&mut self)
Call on_done on the WASM adapter (the cleanup path). Native
filters have no explicit done callback; they are dropped when the
chain is dropped.
Auto Trait Implementations§
impl<W> Freeze for PluginChain<W>where
W: Freeze,
impl<W = NoWasm> !RefUnwindSafe for PluginChain<W>
impl<W> Send for PluginChain<W>where
W: Send,
impl<W> Sync for PluginChain<W>where
W: Sync,
impl<W> Unpin for PluginChain<W>where
W: Unpin,
impl<W = NoWasm> !UnwindSafe for PluginChain<W>
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