pub struct SnapshotRing { /* private fields */ }Expand description
Bounded ring of IncrementalSnapshot values.
Newest snapshot at the back; the oldest is dropped when the ring fills (single-producer-single-consumer pattern — the freeze coordinator pushes, the failure-dump renderer drains).
Cheap to clone for sidecar persistence: Vec of Vec<u8>
shares no internal state, so the capture-mode binary can
snapshot the ring at trigger time without blocking the
coordinator’s continued sampling.
Implementations§
Source§impl SnapshotRing
impl SnapshotRing
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
New ring with the requested capacity. Pass
DEFAULT_SNAPSHOT_RING_DEPTH for the storage-budget-tuned
default (60 entries).
Sourcepub fn push(&mut self, snap: IncrementalSnapshot)
pub fn push(&mut self, snap: IncrementalSnapshot)
Push a new snapshot. When the ring is full, the oldest entry is dropped (FIFO eviction).
Sourcepub fn drain(&mut self) -> Vec<IncrementalSnapshot>
pub fn drain(&mut self) -> Vec<IncrementalSnapshot>
Drain every held snapshot into a vec, oldest-first. Used by the failure-dump renderer at trigger time to consume the pre-trigger window.
Sourcepub fn snapshots(&self) -> impl Iterator<Item = &IncrementalSnapshot>
pub fn snapshots(&self) -> impl Iterator<Item = &IncrementalSnapshot>
Borrow the held snapshots for read-only inspection (e.g. the capture-mode binary’s “show me what’s in the ring right now” diagnostic).
Trait Implementations§
Source§impl Clone for SnapshotRing
impl Clone for SnapshotRing
Source§fn clone(&self) -> SnapshotRing
fn clone(&self) -> SnapshotRing
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnapshotRing
impl Debug for SnapshotRing
Source§impl Default for SnapshotRing
impl Default for SnapshotRing
Source§fn default() -> SnapshotRing
fn default() -> SnapshotRing
Auto Trait Implementations§
impl Freeze for SnapshotRing
impl RefUnwindSafe for SnapshotRing
impl Send for SnapshotRing
impl Sync for SnapshotRing
impl Unpin for SnapshotRing
impl UnwindSafe for SnapshotRing
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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