PluginLifecycle

Struct PluginLifecycle 

Source
pub struct PluginLifecycle { /* private fields */ }
Expand description

The plugin lifecycle manager: tracks loaded plugins, their health, and which routes use them.

Implementations§

Source§

impl PluginLifecycle

Source

pub fn new() -> Self

Create a new plugin lifecycle manager.

Source

pub fn load( &self, configs: &[PluginConfig], sources: &SourceResolutions, ) -> Result<(), LoadError>

Load plugins from config. Compiles each plugin’s .wasm module and stores it. sources carries the DW-165 registry-source resolutions (built by crate::wasm::source::resolve_sources): a resolved source: plugin loads from its verified local artifact exactly like a wasm: plugin; an unresolved one is marked Crashed with the step-named resolution error. Failure isolation is per plugin (DW-157): a .wasm that cannot be read or compiled — or a source: that could not be resolved or verified — marks THAT plugin Crashed (logged, visible to the operator at publish time) instead of failing the whole publish — routes referencing a crashed plugin answer 500 fail-closed, every other plugin keeps serving. The only whole-load failure is engine construction (LoadError::Compile).

Source

pub fn set_route_plugins(&self, routes: HashMap<String, Vec<String>>)

Replace the route -> plugins mapping wholesale (DW-157). The dataplane calls this on every generation swap so routes removed from the config stop mapping to plugin names (a per-route register_route insert-only API would leak stale routes).

Source

pub fn register_route(&self, route_name: &str, plugin_names: &[String])

Register which plugins a route uses (for failure isolation).

Source

pub fn mark_crashed(&self, plugin_name: &str, error: &str)

Mark a plugin as crashed.

Source

pub fn mark_healthy(&self, plugin_name: &str)

Mark a plugin as healthy (after recovery).

Source

pub fn disable(&self, plugin_name: &str, reason: &str)

Disable a plugin (manually or by circuit breaker).

Source

pub fn crashed_plugins_for_route(&self, route_name: &str) -> Vec<String>

Check if a route is affected by a crashed plugin. Returns the list of crashed plugins on this route.

Source

pub fn route_should_500(&self, route_name: &str) -> bool

Whether a route should get a 500 (has crashed plugins).

Source

pub fn get_plugin(&self, name: &str) -> Option<LoadedPlugin>

Get a loaded plugin.

Source

pub fn plugins(&self) -> Vec<LoadedPlugin>

Get all loaded plugins.

Source

pub fn runner(&self) -> Option<PluginRunner>

Get the plugin runner.

Source

pub fn plugin_count(&self) -> usize

The number of loaded plugins.

Source

pub fn healthy_count(&self) -> usize

The number of healthy plugins.

Source

pub fn crashed_count(&self) -> usize

The number of crashed plugins.

Source

pub fn validate_config(config: &PluginConfig) -> Result<(), ValidationError>

Validate a plugin config: check that the .wasm file exists, phases are non-empty, and limits are within bounds. Only validates WASM plugins (those with wasm set); native filters are validated by the snapshot pipeline (exactly-one-of wasm/native, phases non-empty) and the registry at startup.

Source

pub fn phase_order( plugin_names: &[String], plugins: &HashMap<String, PluginConfig>, ) -> Vec<(PluginPhase, Vec<String>)>

Get the phase order for a set of plugins (deterministic, not load-order-dependent).

Trait Implementations§

Source§

impl Default for PluginLifecycle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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,