pub struct AuditLog { /* private fields */ }Expand description
Append-only audit log backed by a VecDeque.
When the log reaches capacity entries the oldest entry is evicted before
the new one is inserted, keeping memory usage bounded.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new log with the given maximum capacity.
A capacity of 0 is legal but means every appended entry is immediately
evicted.
Sourcepub fn append(&mut self, entry: AuditEntry)
pub fn append(&mut self, entry: AuditEntry)
Append entry to the log, assigning a fresh id to it.
If the log is already at capacity the oldest entry is removed first.
Sourcepub fn query(&self, filter: &AuditFilter) -> Vec<&AuditEntry>
pub fn query(&self, filter: &AuditFilter) -> Vec<&AuditEntry>
Return all entries matching filter, in insertion order (oldest first).
Sourcepub fn stats(&self) -> AuditStats
pub fn stats(&self) -> AuditStats
Compute aggregate statistics over all entries currently in the log.
Sourcepub fn export_jsonl(&self, writer: &mut dyn Write) -> Result<()>
pub fn export_jsonl(&self, writer: &mut dyn Write) -> Result<()>
Serialize all entries to writer as newline-delimited JSON (JSONL).
Each line is a JSON object corresponding to one AuditEntry.
Auto Trait Implementations§
impl Freeze for AuditLog
impl RefUnwindSafe for AuditLog
impl Send for AuditLog
impl Sync for AuditLog
impl Unpin for AuditLog
impl UnsafeUnpin for AuditLog
impl UnwindSafe for AuditLog
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request