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
impl PluginLifecycle
Sourcepub fn load(
&self,
configs: &[PluginConfig],
sources: &SourceResolutions,
) -> Result<(), LoadError>
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).
Sourcepub fn set_route_plugins(&self, routes: HashMap<String, Vec<String>>)
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).
Sourcepub fn register_route(&self, route_name: &str, plugin_names: &[String])
pub fn register_route(&self, route_name: &str, plugin_names: &[String])
Register which plugins a route uses (for failure isolation).
Sourcepub fn mark_crashed(&self, plugin_name: &str, error: &str)
pub fn mark_crashed(&self, plugin_name: &str, error: &str)
Mark a plugin as crashed.
Sourcepub fn mark_healthy(&self, plugin_name: &str)
pub fn mark_healthy(&self, plugin_name: &str)
Mark a plugin as healthy (after recovery).
Sourcepub fn disable(&self, plugin_name: &str, reason: &str)
pub fn disable(&self, plugin_name: &str, reason: &str)
Disable a plugin (manually or by circuit breaker).
Sourcepub fn crashed_plugins_for_route(&self, route_name: &str) -> Vec<String>
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.
Sourcepub fn route_should_500(&self, route_name: &str) -> bool
pub fn route_should_500(&self, route_name: &str) -> bool
Whether a route should get a 500 (has crashed plugins).
Sourcepub fn get_plugin(&self, name: &str) -> Option<LoadedPlugin>
pub fn get_plugin(&self, name: &str) -> Option<LoadedPlugin>
Get a loaded plugin.
Sourcepub fn plugins(&self) -> Vec<LoadedPlugin>
pub fn plugins(&self) -> Vec<LoadedPlugin>
Get all loaded plugins.
Sourcepub fn runner(&self) -> Option<PluginRunner>
pub fn runner(&self) -> Option<PluginRunner>
Get the plugin runner.
Sourcepub fn plugin_count(&self) -> usize
pub fn plugin_count(&self) -> usize
The number of loaded plugins.
Sourcepub fn healthy_count(&self) -> usize
pub fn healthy_count(&self) -> usize
The number of healthy plugins.
Sourcepub fn crashed_count(&self) -> usize
pub fn crashed_count(&self) -> usize
The number of crashed plugins.
Sourcepub fn validate_config(config: &PluginConfig) -> Result<(), ValidationError>
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.
Sourcepub fn phase_order(
plugin_names: &[String],
plugins: &HashMap<String, PluginConfig>,
) -> Vec<(PluginPhase, Vec<String>)>
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§
Auto Trait Implementations§
impl !Freeze for PluginLifecycle
impl RefUnwindSafe for PluginLifecycle
impl Send for PluginLifecycle
impl Sync for PluginLifecycle
impl Unpin for PluginLifecycle
impl UnwindSafe for PluginLifecycle
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