#[non_exhaustive]pub struct SnapshotMap<'a> { /* private fields */ }Expand description
One map’s view, possibly narrowed to a specific per-CPU slot via
Self::cpu. Returned by Snapshot::map.
Implementations§
Source§impl<'a> SnapshotMap<'a>
impl<'a> SnapshotMap<'a>
Sourcepub fn raw(&self) -> &'a FailureDumpMap
pub fn raw(&self) -> &'a FailureDumpMap
Underlying FailureDumpMap.
Sourcepub fn ringbuf(&self) -> Option<&'a FailureDumpRingbuf>
pub fn ringbuf(&self) -> Option<&'a FailureDumpRingbuf>
Ringbuf occupancy snapshot for BPF_MAP_TYPE_RINGBUF /
BPF_MAP_TYPE_USER_RINGBUF maps — capacity, consumer /
producer / pending positions, and the cumulative
pending_bytes gap. None for non-ringbuf maps or when
the BTF offsets for bpf_ringbuf_map / bpf_ringbuf
weren’t resolvable at capture time.
Sourcepub fn arena(&self) -> Option<&'a ArenaSnapshot>
pub fn arena(&self) -> Option<&'a ArenaSnapshot>
Mapped-page snapshot for BPF_MAP_TYPE_ARENA maps. Borrows
the per-page (user_addr, bytes) records plus the declared
span / truncation flags. None for non-arena maps or when
the arena walker failed to translate the user_vm window.
Sourcepub fn fd_array(&self) -> Option<&'a FailureDumpFdArray>
pub fn fd_array(&self) -> Option<&'a FailureDumpFdArray>
Populated-slot summary for FD-array families (PROG_ARRAY,
PERF_EVENT_ARRAY, ARRAY_OF_MAPS, SOCKMAP*, etc.).
None for non-FD-array maps. Surfaces the populated count,
scanned slot count, populated-index list, and the two
truncation flags (FailureDumpFdArray::truncated for the
scan limit, FailureDumpFdArray::indices_truncated for the
index list limit).
Sourcepub fn stack_trace(&self) -> Option<&'a FailureDumpStackTrace>
pub fn stack_trace(&self) -> Option<&'a FailureDumpStackTrace>
Per-bucket summary for BPF_MAP_TYPE_STACK_TRACE maps.
None for non-STACK_TRACE maps or when the BTF offsets for
bpf_stack_map / stack_map_bucket weren’t resolvable.
Sourcepub fn map_error(&self) -> Option<&'a str>
pub fn map_error(&self) -> Option<&'a str>
Per-map decode-error string set by the freeze coordinator
when this map’s contents are missing or partial. None on a
successful render. Distinct from SnapshotError (which
flows through the accessor API) — map_error surfaces the
capture-side diagnostic the kernel-walker recorded before
the snapshot was handed to test code.
Sourcepub fn cpu(self, n: usize) -> SnapshotMap<'a>
pub fn cpu(self, n: usize) -> SnapshotMap<'a>
Narrow this map view to a specific per-CPU slot. On a
non-per-CPU map this is recorded but ignored when the
underlying entries are not per-CPU. Use on
BPF_MAP_TYPE_PERCPU_ARRAY / BPF_MAP_TYPE_PERCPU_HASH /
BPF_MAP_TYPE_LRU_PERCPU_HASH.
Sourcepub fn at(&self, n: usize) -> SnapshotEntry<'a>
pub fn at(&self, n: usize) -> SnapshotEntry<'a>
Get an entry by ordinal index.
For HASH-style entry lists, returns the n-th
crate::monitor::dump::FailureDumpEntry in the captured order. For per-CPU
array maps narrowed via Self::cpu, returns the entry
at key n with its per-CPU slot pre-resolved. For ARRAY
maps with a single value, n == 0 returns the value.
Sourcepub fn find(
&self,
predicate: impl Fn(&SnapshotEntry<'a>) -> bool,
) -> SnapshotEntry<'a>
pub fn find( &self, predicate: impl Fn(&SnapshotEntry<'a>) -> bool, ) -> SnapshotEntry<'a>
Find the first entry matching predicate. Returns
SnapshotEntry::Missing with SnapshotError::NoMatch
when no entry matches. The NoMatch payload carries the
total entry count traversed and a small sample of rendered
keys so the failure message can tell empty map apart from
populated map, predicate never matched.
Sourcepub fn filter(
&self,
predicate: impl Fn(&SnapshotEntry<'a>) -> bool,
) -> Vec<SnapshotEntry<'a>>
pub fn filter( &self, predicate: impl Fn(&SnapshotEntry<'a>) -> bool, ) -> Vec<SnapshotEntry<'a>>
Collect every entry matching predicate into a Vec.
Sourcepub fn max_by(
&self,
key_fn: impl Fn(&SnapshotEntry<'a>) -> u64,
) -> SnapshotEntry<'a>
pub fn max_by( &self, key_fn: impl Fn(&SnapshotEntry<'a>) -> u64, ) -> SnapshotEntry<'a>
Find the entry whose key_fn produces the maximum u64.
Returns SnapshotEntry::Missing when the map has no
entries. The NoMatch payload’s len is 0 in that case;
available_keys is empty (the map has no keys to sample).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SnapshotMap<'a>
impl<'a> RefUnwindSafe for SnapshotMap<'a>
impl<'a> Send for SnapshotMap<'a>
impl<'a> Sync for SnapshotMap<'a>
impl<'a> Unpin for SnapshotMap<'a>
impl<'a> UnwindSafe for SnapshotMap<'a>
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<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