pub struct AuditLog { /* private fields */ }Expand description
The append-only audit log.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn with_capacity(max: usize) -> Self
pub fn with_capacity(max: usize) -> Self
Create an audit log with a maximum number of retained events (oldest are dropped).
Sourcepub fn append(
&mut self,
kind: AuditEventKind,
actor: Actor,
workflow_id: &str,
task_id: Option<&str>,
timestamp: u64,
detail: Option<String>,
) -> u64
pub fn append( &mut self, kind: AuditEventKind, actor: Actor, workflow_id: &str, task_id: Option<&str>, timestamp: u64, detail: Option<String>, ) -> u64
Append a new event to the log.
Sourcepub fn append_with_metadata(
&mut self,
kind: AuditEventKind,
actor: Actor,
workflow_id: &str,
task_id: Option<&str>,
timestamp: u64,
detail: Option<String>,
metadata: Vec<(String, String)>,
) -> u64
pub fn append_with_metadata( &mut self, kind: AuditEventKind, actor: Actor, workflow_id: &str, task_id: Option<&str>, timestamp: u64, detail: Option<String>, metadata: Vec<(String, String)>, ) -> u64
Append an event with additional metadata.
Sourcepub fn events_for_workflow(&self, workflow_id: &str) -> Vec<&AuditEvent>
pub fn events_for_workflow(&self, workflow_id: &str) -> Vec<&AuditEvent>
Filter events by workflow ID.
Sourcepub fn events_for_actor(&self, actor_id: &str) -> Vec<&AuditEvent>
pub fn events_for_actor(&self, actor_id: &str) -> Vec<&AuditEvent>
Filter events by actor ID.
Sourcepub fn events_by_kind(&self, kind: &AuditEventKind) -> Vec<&AuditEvent>
pub fn events_by_kind(&self, kind: &AuditEventKind) -> Vec<&AuditEvent>
Filter events by kind label (string match).
Sourcepub fn events_in_range(
&self,
from_epoch: u64,
to_epoch: u64,
) -> Vec<&AuditEvent>
pub fn events_in_range( &self, from_epoch: u64, to_epoch: u64, ) -> Vec<&AuditEvent>
Return events in a timestamp range (inclusive).
Sourcepub fn export_csv(&self) -> Vec<String>
pub fn export_csv(&self) -> Vec<String>
Export all events as CSV lines for compliance reporting.
Sourcepub fn next_sequence(&self) -> u64
pub fn next_sequence(&self) -> u64
Return next sequence number (useful for assertions in tests).
Trait Implementations§
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