Skip to main content

NotifierRegistry

Struct NotifierRegistry 

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

Runtime-side registry of notifier plugins keyed by name, plus the routing table that decides which plugins receive each priority.

Constructed in ao-cli (Phase C) after plugin instantiation, attached to ReactionEngine via with_notifier_registry (Phase B). Existing call sites that don’t attach one keep working — identical opt-in pattern to ReactionEngine::with_scm.

§Warn-once policy

resolve logs exactly one tracing::warn! per distinct (priority, notifier_name) pair across the process lifetime, so a typo in the routing table can’t spam the log on every poll tick. Matches the dedup pattern used by reaction_engine::warn_once_parse_failure for malformed durations.

Implementations§

Source§

impl NotifierRegistry

Source

pub fn new(routing: NotificationRouting) -> Self

Construct an empty registry with the given routing table. Plugins are added via register.

Source

pub fn register(&mut self, name: impl Into<String>, plugin: Arc<dyn Notifier>)

Register a plugin under a name. Overwrites any existing entry for the same name — tests rely on this to stub plugins with replacements. Production wiring in ao-cli registers each plugin exactly once at startup.

Source

pub fn get(&self, name: &str) -> Option<Arc<dyn Notifier>>

Look up a plugin by name without going through routing. Primarily useful for ao-cli smoke tests and for future phases that may want direct-addressed notifications.

Source

pub fn len(&self) -> usize

Number of registered plugins.

Source

pub fn is_empty(&self) -> bool

true if no plugins have been registered.

Source

pub fn resolve( &self, priority: EventPriority, ) -> Vec<(String, Arc<dyn Notifier>)>

Resolve a priority against the routing table, returning the (name, plugin) pairs the engine should dispatch to.

Empty return vec means “do nothing for this priority”. That happens in three cases, all of which trigger a warn-once:

  1. Priority missing from the routing table entirely.
  2. Priority present but points at an empty list.
  3. The routing table names one or more plugins that are not registered — the registered subset (if any) is returned and the missing names are each warned once.

Case 3 can return a non-empty vec (the registered subset) even though some of the configured names were missing. That is deliberate: a partially-wired routing table should still deliver to the plugins that DO exist, not fail closed.

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
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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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, 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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more