pub struct EventBus { /* private fields */ }Expand description
The bounded event queue plus its identity and counters. Share via
Arc; emitters hold an Emitter (a cheap clone of that Arc).
Construction: EventBus::with_receiver hands the single-consumer
receiver to the deliverer; EventBus::new creates a bus nobody
drains yet (the DataPlane does this before spawning its deliverer,
so startup publishes are queued, not lost — and if no deliverer is
ever spawned, every emit is a counted drop, never a block).
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn new() -> Arc<Self>
pub fn new() -> Arc<Self>
New bus with EVENT_CHANNEL_CAPACITY and no receiver taken.
Sourcepub fn with_capacity(capacity: usize) -> Arc<Self>
pub fn with_capacity(capacity: usize) -> Arc<Self>
New bus with an explicit capacity (tests).
Sourcepub fn with_receiver(capacity: usize) -> (Arc<Self>, Receiver<Event>)
pub fn with_receiver(capacity: usize) -> (Arc<Self>, Receiver<Event>)
New bus, returning the receiver alongside (the deliverer’s end).
Sourcepub fn with_durability(
capacity: usize,
durability: Arc<dyn EventDurability>,
) -> (Arc<Self>, Receiver<Event>)
pub fn with_durability( capacity: usize, durability: Arc<dyn EventDurability>, ) -> (Arc<Self>, Receiver<Event>)
REL-14 (#249): new bus with a durability layer attached. On construction, un-acked events from the WAL are replayed into the channel (so they are delivered on the next deliverer spawn). Critical events emitted after this point are persisted to the WAL before being sent to the channel.
Sourcepub fn attach_durability(&self, durability: Arc<dyn EventDurability>)
pub fn attach_durability(&self, durability: Arc<dyn EventDurability>)
REL-14 (#249): attach a durability layer to an existing bus. The bus may already have emitted events (e.g. the startup config_published); those are NOT retroactively persisted. After this call, critical events are persisted to the WAL before emission, and un-acked events from the WAL are replayed into the channel for the next deliverer to drain. First attach wins; a second call is a no-op.
Sourcepub fn take_receiver(&self) -> Option<Receiver<Event>>
pub fn take_receiver(&self) -> Option<Receiver<Event>>
Take the single-consumer receiver (the first caller wins; later
callers get None — one deliverer per bus, by design).
Sourcepub fn emitted_total(&self) -> u64
pub fn emitted_total(&self) -> u64
Events handed to the channel since process start.
Sourcepub fn dropped_total(&self) -> u64
pub fn dropped_total(&self) -> u64
Events dropped at emit time (queue full, or no deliverer
draining). Surfaced as dwara_events_dropped_total.
Sourcepub fn durability(&self) -> Option<Arc<dyn EventDurability>>
pub fn durability(&self) -> Option<Arc<dyn EventDurability>>
REL-14 (#249): the durability layer, if attached. The webhook deliverer uses this to ack events after dispatch.
Auto Trait Implementations§
impl !Freeze for EventBus
impl RefUnwindSafe for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnwindSafe for EventBus
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more