pub struct PluginRegistry {
pub db: Db,
pub runtime: Runtime,
/* private fields */
}Fields§
§db: Db§runtime: RuntimeImplementations§
Source§impl PluginRegistry
impl PluginRegistry
pub fn new(db: Db, runtime: Runtime) -> Result<Self>
pub fn plugins(&self) -> &HashMap<String, WitmPlugin>
pub async fn load_plugins(&mut self) -> Result<()>
pub async fn plugin_from_component( &self, component_bytes: Vec<u8>, ) -> Result<WitmPlugin>
Sourcepub async fn plugin_from_component_with_key(
&self,
component_bytes: Vec<u8>,
expected_public_key: Option<&[u8]>,
) -> Result<WitmPlugin>
pub async fn plugin_from_component_with_key( &self, component_bytes: Vec<u8>, expected_public_key: Option<&[u8]>, ) -> Result<WitmPlugin>
Load and verify a plugin from WASM bytes.
If expected_public_key is provided, the plugin’s embedded public key
must match it exactly — this lets callers pin trust to a known author
rather than accepting any self-signed component.
pub async fn register_plugin(&mut self, plugin: WitmPlugin) -> Result<()>
pub async fn remove_plugin( &mut self, name: &str, namespace: Option<&str>, ) -> Result<Vec<String>>
pub fn find_first_unexecuted_plugin( &self, event: &dyn Event, executed_plugins: &HashSet<String>, ) -> Option<&WitmPlugin>
Sourcepub fn can_handle(&self, event: &dyn Event) -> bool
pub fn can_handle(&self, event: &dyn Event) -> bool
Check if any plugins can handle an event
Sourcepub fn effective_plugins_for_tenant(
&self,
overrides: &[TenantPluginOverride],
) -> HashSet<String>
pub fn effective_plugins_for_tenant( &self, overrides: &[TenantPluginOverride], ) -> HashSet<String>
Returns the set of plugin IDs that are effective for a given tenant. Applies per-tenant enable/disable overrides on top of global enabled state.
Sourcepub fn resolve_config(
&self,
plugin: &WitmPlugin,
tenant_config: &[TenantPluginConfig],
) -> Vec<UserInput>
pub fn resolve_config( &self, plugin: &WitmPlugin, tenant_config: &[TenantPluginConfig], ) -> Vec<UserInput>
Resolve configuration for a plugin, merging tenant-specific config over global defaults. Tenant config values are stored as JSON strings in the database.
Sourcepub async fn handle_event(
&self,
event: Box<dyn Event>,
) -> Result<(WasmEvent, Store<Host>)>
pub async fn handle_event( &self, event: Box<dyn Event>, ) -> Result<(WasmEvent, Store<Host>)>
Handle a generic event, passing it through all registered plugins, and returning the final Event (whose inner contents implement Event) and Store (for resolving any resource handles on the host side) Validates that the final Event matches the expected output type for its event kind, returning an error if not
Sourcepub async fn handle_event_for_tenant(
&self,
event: Box<dyn Event>,
effective_set: &HashSet<String>,
tenant_config: &[TenantPluginConfig],
) -> Result<(WasmEvent, Store<Host>)>
pub async fn handle_event_for_tenant( &self, event: Box<dyn Event>, effective_set: &HashSet<String>, tenant_config: &[TenantPluginConfig], ) -> Result<(WasmEvent, Store<Host>)>
Handle an event with tenant-specific plugin filtering and configuration.
Uses effective_set to filter plugins and tenant_config to override per-plugin config.
Auto Trait Implementations§
impl Freeze for PluginRegistry
impl !RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl UnsafeUnpin for PluginRegistry
impl !UnwindSafe for PluginRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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