Skip to main content

SignalRouter

Struct SignalRouter 

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

High-performance signal router with deduplication and priority queuing.

Implementations§

Source§

impl SignalRouter

Source

pub fn new(max_queue_size: usize) -> Self

Source

pub fn with_policy( max_queue_size: usize, policy: Box<dyn AttentionPolicy>, ) -> Self

Source

pub fn ingest( &mut self, signal: RuntimeSignal, is_running: bool, ) -> SignalDisposition

Ingest a signal. Returns the disposition after dedup + attention evaluation. Queue dispositions are buffered; if the queue is full, returns Dropped so the SDK can apply backpressure or surface the loss to telemetry. All other dispositions are returned directly to the caller.

Source

pub fn next(&mut self) -> Option<RuntimeSignal>

Pull next queued signal.

Source

pub fn next_for(&mut self, recipient: Option<&str>) -> Option<RuntimeSignal>

Pull the next queued signal visible to recipient (broadcasts plus signals addressed to it); other recipients’ signals stay queued. None ⇒ no filter.

Source

pub fn depth(&self) -> usize

Number of queued signals.

Source

pub fn clear_dedup(&mut self)

Clear the dedup set (call at session boundaries to prevent unbounded growth).

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