pub struct ForwardPolicyRegistry { /* private fields */ }Expand description
Registry of ForwardPolicy implementations keyed by callee namespace.
Clone is cheap: every policy is wrapped in Arc, and the underlying
HashMap clones the key strings + the Arc handles. The registry is
designed to be built at hub-construction time and read at dispatch time;
mutating after the hub is shared across tasks requires going through
DynamicHub::with_forward_policy at builder
time.
Implementations§
Source§impl ForwardPolicyRegistry
impl ForwardPolicyRegistry
Sourcepub fn register(
&mut self,
callee_ns: impl Into<String>,
policy: Arc<dyn ForwardPolicy>,
)
pub fn register( &mut self, callee_ns: impl Into<String>, policy: Arc<dyn ForwardPolicy>, )
Register a policy for a callee namespace.
The namespace is the same lowercased token used to look up
super::plexus::ChildRouter::get_child (e.g. "solar",
"echo"). If a policy is already registered for the namespace, it
is replaced.
Sourcepub fn get(&self, callee_ns: &str) -> Option<Arc<dyn ForwardPolicy>>
pub fn get(&self, callee_ns: &str) -> Option<Arc<dyn ForwardPolicy>>
Look up the policy declared for a callee namespace.
Returns None when no policy is registered; the dispatch path
interprets that as “fall back to plexus_auth_core::IdentityOnly”
— the spike-pinned safe default.
Trait Implementations§
Source§impl Clone for ForwardPolicyRegistry
impl Clone for ForwardPolicyRegistry
Source§fn clone(&self) -> ForwardPolicyRegistry
fn clone(&self) -> ForwardPolicyRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more