pub struct AuditLog { /* private fields */ }Expand description
Append-only audit log with hash chaining.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn append(
&mut self,
id: impl Into<String>,
timestamp: impl Into<String>,
action: AuditAction,
actor: impl Into<String>,
details: Value,
) -> &AuditEntry
pub fn append( &mut self, id: impl Into<String>, timestamp: impl Into<String>, action: AuditAction, actor: impl Into<String>, details: Value, ) -> &AuditEntry
Append an entry to the log. The previous hash and sequence are set automatically.
Sourcepub fn entries(&self) -> &[AuditEntry]
pub fn entries(&self) -> &[AuditEntry]
Get all entries.
Sourcepub fn verify_chain(&self) -> bool
pub fn verify_chain(&self) -> bool
Verify the hash chain integrity.
Sourcepub fn by_actor(&self, actor: &str) -> Vec<&AuditEntry>
pub fn by_actor(&self, actor: &str) -> Vec<&AuditEntry>
Query entries by actor.
Sourcepub fn by_action(&self, action: AuditAction) -> Vec<&AuditEntry>
pub fn by_action(&self, action: AuditAction) -> Vec<&AuditEntry>
Query entries by action type.
Sourcepub fn by_time_range(&self, from: &str, to: &str) -> Vec<&AuditEntry>
pub fn by_time_range(&self, from: &str, to: &str) -> Vec<&AuditEntry>
Query entries within a time range (inclusive, RFC 3339 string comparison).
Sourcepub fn export(&self, policy: &RedactionPolicy) -> String
pub fn export(&self, policy: &RedactionPolicy) -> String
Export the log as JSON Lines with optional redaction.
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 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