pub struct AuditLog { /* private fields */ }Expand description
An append-only, tamper-evident fight record.
Entries form a Merkle hash chain: each entry’s hash incorporates the
previous entry’s hash. Call verify_chain to
confirm the log has not been altered since it was written.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn append(
&mut self,
action: AuditAction,
actor: &str,
metadata: Value,
) -> &AuditEntry
pub fn append( &mut self, action: AuditAction, actor: &str, metadata: Value, ) -> &AuditEntry
Record a new action in the bout log.
The entry is appended with a hash that chains to the previous entry, making the entire log tamper-evident.
Sourcepub fn verify_chain(&self) -> Result<(), AuditVerifyError>
pub fn verify_chain(&self) -> Result<(), AuditVerifyError>
Verify the entire hash chain from genesis to the latest entry.
Returns Ok(()) if the bout log is intact, or an error describing the
first inconsistency found.
Sourcepub fn entries(&self) -> &[AuditEntry]
pub fn entries(&self) -> &[AuditEntry]
Return all entries in the bout log.
Sourcepub fn last_entry(&self) -> Option<&AuditEntry>
pub fn last_entry(&self) -> Option<&AuditEntry>
Return the most recent entry, if any.
Sourcepub fn entries_since(&self, sequence: u64) -> &[AuditEntry]
pub fn entries_since(&self, sequence: u64) -> &[AuditEntry]
Return all entries with a sequence number strictly greater than sequence.
Sourcepub fn entries_by_actor(&self, actor: &str) -> Vec<&AuditEntry>
pub fn entries_by_actor(&self, actor: &str) -> Vec<&AuditEntry>
Return entries performed by the given actor.
Sourcepub fn entries_by_action_type(&self, action_type: &str) -> Vec<&AuditEntry>
pub fn entries_by_action_type(&self, action_type: &str) -> Vec<&AuditEntry>
Return entries matching the given action type name (e.g. "ToolExecuted").