Skip to main content

AuditQuery

Struct AuditQuery 

Source
pub struct AuditQuery<'a> { /* private fields */ }
Expand description

Audit-query builder reading the substrate’s admin audit ring. Constructed via DeckClient::audit; chain filter methods, then call Self::collect to materialize the matching entries.

§Scope

Reads the in-memory admin audit ring exported on every super::meshos::MeshOsSnapshot. The ring carries every admin commit the loop observed — signed ICE bundles AND unsigned admin events — bounded at super::meshos::DEFAULT_MAX_ADMIN_AUDIT_RECORDS. The unbounded historical replay path is the eventual admin audit subchain (substrate gap); this in-memory ring is the near-history surface Deck-the-binary renders against.

Per-method semantics:

Implementations§

Source§

impl<'a> AuditQuery<'a>

Source

pub fn recent(self, limit: usize) -> Self

Cap the result at the most-recent limit entries. Returned order is newest-first.

limit = 0 returns an empty result by design — useful in higher-level builder flows that compute the cap from runtime config (operator typed 0, no records wanted). Callers that want “as many as the ring holds” should omit recent() entirely; the builder’s default returns every entry.

Source

pub fn by_operator(self, op_id: u64) -> Self

Keep only entries that carry op_id in their operator_ids list. Records where one of several operators in a multi-op bundle matches still surface.

Source

pub fn between(self, start_ms: u64, end_ms: u64) -> Self

Keep only entries whose committed_at_ms falls inside [start_ms, end_ms] (inclusive on both ends). Milliseconds since UNIX_EPOCH.

Source

pub fn force_only(self) -> Self

Restrict the result to ICE force operations. The audit ring now interleaves ordinary signed-admin commits with ICE bundles, so this filter actively drops non-ICE records via super::meshos::AdminEvent::is_ice.

Source

pub fn since(self, since_seq: u64) -> Self

Restrict the result to records with seq > since_seq. Pagination primitive: consumers persist the last-seen seq and resume from there across restarts. For Self::stream the value seeds the stream’s watermark — the stream tails from since_seq + 1 onward rather than from “first new record after now”.

since(0) means “from the beginning of what’s still in the ring” — equivalent to omitting since() entirely in terms of what records are returned. To tail only records that arrive after subscribe time, pair this with DeckClient::audit_head_seq: read the head once, then since(head). The same convention applies to LogFilter::since and DeckClient::subscribe_failures.

Source

pub fn collect(self) -> Vec<AdminAuditRecord>

Materialize matching entries. Reads the runtime’s latest snapshot, applies the configured filters, and returns the matching entries newest-first. Cheap — one snapshot read + a single iterator pass.

Source

pub fn stream(self) -> AuditStream

Tail mode: convert the query into an async stream that yields each matching audit record as it arrives on the substrate’s ring. Polls the snapshot reader at DeckClientConfig::snapshot_poll_interval. The recent(limit) filter is ignored in tail mode — the stream emits continuously, not a bounded batch.

Uses super::meshos::AdminAuditRecord::seq to dedup across polls so two commits in the same millisecond never collapse.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for AuditQuery<'a>

§

impl<'a> !UnwindSafe for AuditQuery<'a>

§

impl<'a> Freeze for AuditQuery<'a>

§

impl<'a> Send for AuditQuery<'a>

§

impl<'a> Sync for AuditQuery<'a>

§

impl<'a> Unpin for AuditQuery<'a>

§

impl<'a> UnsafeUnpin for AuditQuery<'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.

Source§

impl<T> Instrument for T

Source§

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

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

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> 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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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