pub struct TypedBus { /* private fields */ }Expand description
Typed in-Node event bus. Carries published events from one
poll cycle to the next; the engine’s bus-routing pass drains
the queue and routes to subscribed NodeSiteIds.
Bounded by NodeConfig.bus_capacity (default 1024). When a
publish would exceed the cap, the oldest event is FIFO-dropped
and a counter increments. The routing pass reads the counter
and emits InfraEvent::BusOverflow { count } so the host sees
the loss.
Implementations§
Source§impl TypedBus
impl TypedBus
Sourcepub fn with_cap(cap: Option<usize>) -> Self
pub fn with_cap(cap: Option<usize>) -> Self
Construct a fresh empty bus with the given FIFO-drop cap.
Sourcepub fn publish(&mut self, event: NodeEvent)
pub fn publish(&mut self, event: NodeEvent)
Publish an event. The engine’s bus-routing pass delivers published events to subscribed Components in the next poll cycle.
Sourcepub fn drain(&mut self) -> Vec<NodeEvent>
pub fn drain(&mut self) -> Vec<NodeEvent>
Drain all queued events. Called by the engine’s bus-routing pass.
Sourcepub fn take_dropped_count(&mut self) -> usize
pub fn take_dropped_count(&mut self) -> usize
Read + reset the count of FIFO-dropped events since the last call. Returns 0 when no drops occurred.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TypedBus
impl RefUnwindSafe for TypedBus
impl Send for TypedBus
impl Sync for TypedBus
impl Unpin for TypedBus
impl UnsafeUnpin for TypedBus
impl UnwindSafe for TypedBus
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedComponent for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request