pub struct AuditLedger { /* private fields */ }Expand description
Indexed bilateral audit ledger that records and queries interactions.
Implementations§
Source§impl AuditLedger
impl AuditLedger
Sourcepub fn rebuild_indexes(&mut self)
pub fn rebuild_indexes(&mut self)
Rebuild all indexes from the entries vector.
Call this after deserialization to restore index state.
Sourcepub fn record(
&mut self,
caller: &str,
target: &str,
action: AuditAction,
tool: &str,
evidence_class: EvidenceClass,
duration_ms: u64,
success: bool,
) -> &AuditEntry
pub fn record( &mut self, caller: &str, target: &str, action: AuditAction, tool: &str, evidence_class: EvidenceClass, duration_ms: u64, success: bool, ) -> &AuditEntry
Record a new audit entry and return a reference to it.
Sourcepub fn query_caller(&self, name: &str) -> Vec<&AuditEntry>
pub fn query_caller(&self, name: &str) -> Vec<&AuditEntry>
Return all entries for a given caller.
Sourcepub fn query_target(&self, resource: &str) -> Vec<&AuditEntry>
pub fn query_target(&self, resource: &str) -> Vec<&AuditEntry>
Return all entries targeting a given resource.
Sourcepub fn query_tool(&self, tool: &str) -> Vec<&AuditEntry>
pub fn query_tool(&self, tool: &str) -> Vec<&AuditEntry>
Return all entries that used a given tool.
Sourcepub fn hot_targets(&self, n: usize) -> Vec<(&str, usize)>
pub fn hot_targets(&self, n: usize) -> Vec<(&str, usize)>
Return the top n most-touched targets by entry count.
Sourcepub fn active_callers(&self, n: usize) -> Vec<(&str, usize)>
pub fn active_callers(&self, n: usize) -> Vec<(&str, usize)>
Return the top n most-active callers by entry count.
Sourcepub fn cross_reference(&self, caller: &str, target: &str) -> Vec<&AuditEntry>
pub fn cross_reference(&self, caller: &str, target: &str) -> Vec<&AuditEntry>
Return all entries where a specific caller touched a specific target.
Trait Implementations§
Source§impl Clone for AuditLedger
impl Clone for AuditLedger
Source§fn clone(&self) -> AuditLedger
fn clone(&self) -> AuditLedger
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 Debug for AuditLedger
impl Debug for AuditLedger
Source§impl Default for AuditLedger
impl Default for AuditLedger
Source§impl<'de> Deserialize<'de> for AuditLedger
impl<'de> Deserialize<'de> for AuditLedger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AuditLedger
impl RefUnwindSafe for AuditLedger
impl Send for AuditLedger
impl Sync for AuditLedger
impl Unpin for AuditLedger
impl UnsafeUnpin for AuditLedger
impl UnwindSafe for AuditLedger
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