pub struct RecentEvents { /* private fields */ }Expand description
Bounded ring buffer of recent lifecycle events.
The ring is held inside an Arc<Mutex<...>> so the gossip
task and the dump endpoint can share it without contention on
the steady-state path. New entries push to the back; once the
length reaches MAX_RECENT_EVENTS the oldest entry is
dropped.
§Examples
use dynomite::admin::cluster_info::{RecentEvent, RecentEvents};
let log = RecentEvents::new();
log.push(RecentEvent::new(1, "restart", ""));
assert_eq!(log.snapshot().len(), 1);Implementations§
Source§impl RecentEvents
impl RecentEvents
Sourcepub fn push(&self, event: RecentEvent)
pub fn push(&self, event: RecentEvent)
Append event, dropping the oldest entry when the ring
is full.
Sourcepub fn snapshot(&self) -> Vec<RecentEvent>
pub fn snapshot(&self) -> Vec<RecentEvent>
Cloned snapshot of the ring contents (oldest first).
Trait Implementations§
Source§impl Clone for RecentEvents
impl Clone for RecentEvents
Source§fn clone(&self) -> RecentEvents
fn clone(&self) -> RecentEvents
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RecentEvents
impl Debug for RecentEvents
Source§impl Default for RecentEvents
impl Default for RecentEvents
Source§fn default() -> RecentEvents
fn default() -> RecentEvents
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RecentEvents
impl !RefUnwindSafe for RecentEvents
impl Send for RecentEvents
impl Sync for RecentEvents
impl Unpin for RecentEvents
impl UnsafeUnpin for RecentEvents
impl !UnwindSafe for RecentEvents
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