pub struct PluginRef { /* private fields */ }Expand description
Manager-owned wrapper that pairs a plugin with its authoritative config.
The trusted_config comes from the config loader / manager — never
from the plugin itself. The executor reads all scheduling decisions
(mode, priority, hooks, capabilities, on_error) from this config.
The plugin receives a copy of its config at construction time so it can read its own settings during hook execution. But the manager/executor never reads config back from the plugin.
Trust flow:
config loader → manager → PluginRef.trusted_config → executor
↘ plugin (receives a copy, cannot influence scheduling)Implementations§
Source§impl PluginRef
impl PluginRef
Sourcepub fn new(plugin: Arc<dyn Plugin>, trusted_config: PluginConfig) -> Self
pub fn new(plugin: Arc<dyn Plugin>, trusted_config: PluginConfig) -> Self
Create a new PluginRef with an independently-sourced config.
The trusted_config must come from the config loader or manager,
NOT from plugin.config(). The plugin may hold its own copy
for reading during execute(), but the manager never consults it.
Sourcepub fn trusted_config(&self) -> &PluginConfig
pub fn trusted_config(&self) -> &PluginConfig
The authoritative config used by the executor for all decisions.
Sourcepub fn plugin(&self) -> &Arc<dyn Plugin>
pub fn plugin(&self) -> &Arc<dyn Plugin>
The plugin implementation (for calling initialize/shutdown).
Sourcepub fn id(&self) -> Uuid
pub fn id(&self) -> Uuid
Unique identifier assigned at registration.
Returned by value — Uuid is Copy (16 bytes).
Sourcepub fn mode(&self) -> PluginMode
pub fn mode(&self) -> PluginMode
Effective mode — returns Disabled if the runtime circuit breaker
has tripped, otherwise returns the configured mode.
Acquire on the load pairs with Release on the disable() store
so weak-memory-ordering hardware (ARM64) propagates the disable
promptly across threads.
Sourcepub fn disable(&self)
pub fn disable(&self)
Runtime-disable this plugin (one-way circuit breaker).
Called by the executor when a plugin errors with on_error: Disable.
All clones of this PluginRef (in HookEntry, etc.) share the same
AtomicBool, so the disable is visible across the system.
Release ordering establishes a happens-before with Acquire
loads in is_disabled() and mode() — required for correctness
on weak-memory hardware (ARM64) where Relaxed allows the new
value to remain unobserved by other threads for an unbounded window.
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Whether this plugin has been runtime-disabled.
Acquire pairs with the Release in disable() (see mode()).