pub struct EventSnapshotBuilder { /* private fields */ }Expand description
Builder for EventSnapshot.
Either set fields explicitly, or fold a batch of Events into the running
counts via EventSnapshotBuilder::observe / EventSnapshotBuilder::observe_all.
Implementations§
Source§impl EventSnapshotBuilder
impl EventSnapshotBuilder
Sourcepub fn timestamp(self, ts: DateTime<Utc>) -> Self
pub fn timestamp(self, ts: DateTime<Utc>) -> Self
Set the snapshot timestamp (defaults to Utc::now at build time).
Sourcepub fn worker_count(self, n: u64) -> Self
pub fn worker_count(self, n: u64) -> Self
Set the worker count explicitly (overrides workers inferred from events).
Sourcepub fn queue_depth(self, queue: impl Into<String>, depth: u64) -> Self
pub fn queue_depth(self, queue: impl Into<String>, depth: u64) -> Self
Set the depth for a specific queue (also adds to the total).
Sourcepub fn total_queue_depth(self, depth: u64) -> Self
pub fn total_queue_depth(self, depth: u64) -> Self
Set the aggregate queue depth directly (when per-queue detail is absent).
Sourcepub fn observe(&mut self, event: &Event) -> &mut Self
pub fn observe(&mut self, event: &Event) -> &mut Self
Fold a single event into the running aggregate.
Task lifecycle events bump the corresponding counters; worker online/heartbeat events register a worker as present, and worker offline removes it.
Sourcepub fn observe_all<'a, I>(&mut self, events: I) -> &mut Selfwhere
I: IntoIterator<Item = &'a Event>,
pub fn observe_all<'a, I>(&mut self, events: I) -> &mut Selfwhere
I: IntoIterator<Item = &'a Event>,
Fold a batch of events into the running aggregate.
Sourcepub fn build(self) -> EventSnapshot
pub fn build(self) -> EventSnapshot
Finalize the snapshot.
Trait Implementations§
Source§impl Clone for EventSnapshotBuilder
impl Clone for EventSnapshotBuilder
Source§impl Debug for EventSnapshotBuilder
impl Debug for EventSnapshotBuilder
Auto Trait Implementations§
impl Freeze for EventSnapshotBuilder
impl RefUnwindSafe for EventSnapshotBuilder
impl Send for EventSnapshotBuilder
impl Sync for EventSnapshotBuilder
impl Unpin for EventSnapshotBuilder
impl UnsafeUnpin for EventSnapshotBuilder
impl UnwindSafe for EventSnapshotBuilder
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
Mutably borrows from an owned value. Read more