pub struct AuditStats { /* private fields */ }Expand description
Thread-safe audit stats tracker, shared between the audit write path and the session close query path.
Implementations§
Source§impl AuditStats
impl AuditStats
pub fn new() -> Self
Sourcepub async fn record(&self, entry: &AuditEntry)
pub async fn record(&self, entry: &AuditEntry)
Record an audit entry. Inspects the entry to update per-session counters.
Sourcepub async fn stats_for_session(&self, session_id: &str) -> SessionAuditStats
pub async fn stats_for_session(&self, session_id: &str) -> SessionAuditStats
Query stats for a specific session.
Sourcepub async fn remove_session(&self, session_id: &str)
pub async fn remove_session(&self, session_id: &str)
Remove stats for a session (called after session close to prevent unbounded growth).
Sourcepub async fn aggregate(&self) -> AggregateAuditStats
pub async fn aggregate(&self) -> AggregateAuditStats
Aggregate stats across all tracked sessions. Returns totals and counts of sessions that have anomalies or denials.
Trait Implementations§
Source§impl Clone for AuditStats
impl Clone for AuditStats
Source§fn clone(&self) -> AuditStats
fn clone(&self) -> AuditStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for AuditStats
impl Default for AuditStats
Source§fn default() -> AuditStats
fn default() -> AuditStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuditStats
impl !RefUnwindSafe for AuditStats
impl Send for AuditStats
impl Sync for AuditStats
impl Unpin for AuditStats
impl UnsafeUnpin for AuditStats
impl !UnwindSafe for AuditStats
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