SnapshotMap

Struct SnapshotMap 

Source
#[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>

Source

pub fn name(&self) -> &'a str

Map name as captured.

Source

pub fn raw(&self) -> &'a FailureDumpMap

Underlying FailureDumpMap.

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn filter( &self, predicate: impl Fn(&SnapshotEntry<'a>) -> bool, ) -> Vec<SnapshotEntry<'a>>

Collect every entry matching predicate into a Vec.

Source

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§

Source§

impl<'a> Debug for SnapshotMap<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,