pub struct MaskingAuditLog { /* private fields */ }Expand description
脱敏审计日志:记录所有脱敏操作,支持查询、统计、导出。
Implementations§
Source§impl MaskingAuditLog
impl MaskingAuditLog
Sourcepub fn with_capacity(max_entries: usize) -> Self
pub fn with_capacity(max_entries: usize) -> Self
创建有上限的审计日志(超出时丢弃最旧条目)
Sourcepub fn log(&mut self, entry: MaskingAuditEntry)
pub fn log(&mut self, entry: MaskingAuditEntry)
记录一次脱敏操作
Sourcepub fn log_simple(
&mut self,
field: &str,
rule: &str,
original: &str,
masked: &str,
timestamp: u64,
)
pub fn log_simple( &mut self, field: &str, rule: &str, original: &str, masked: &str, timestamp: u64, )
便捷记录:字段名 + 规则 + 原始值 + 脱敏值 + 时间戳
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
条目数
Sourcepub fn entries(&self) -> &[MaskingAuditEntry]
pub fn entries(&self) -> &[MaskingAuditEntry]
所有条目
Sourcepub fn find_by_field(&self, field: &str) -> Vec<&MaskingAuditEntry>
pub fn find_by_field(&self, field: &str) -> Vec<&MaskingAuditEntry>
按字段名查询条目
Sourcepub fn find_by_time_range(
&self,
start: u64,
end: u64,
) -> Vec<&MaskingAuditEntry>
pub fn find_by_time_range( &self, start: u64, end: u64, ) -> Vec<&MaskingAuditEntry>
按时间范围查询条目
Sourcepub fn find_by_operator(&self, operator: &str) -> Vec<&MaskingAuditEntry>
pub fn find_by_operator(&self, operator: &str) -> Vec<&MaskingAuditEntry>
按操作者查询条目
Sourcepub fn total_masked_chars(&self) -> usize
pub fn total_masked_chars(&self) -> usize
被掩码的字符总数
Sourcepub fn unique_field_count(&self) -> usize
pub fn unique_field_count(&self) -> usize
涉及的不同字段数
Sourcepub fn field_stats(&self) -> HashMap<String, usize>
pub fn field_stats(&self) -> HashMap<String, usize>
各字段的脱敏次数
Sourcepub fn rule_stats(&self) -> HashMap<String, usize>
pub fn rule_stats(&self) -> HashMap<String, usize>
各脱敏规则的使用次数
Trait Implementations§
Source§impl Clone for MaskingAuditLog
impl Clone for MaskingAuditLog
Source§fn clone(&self) -> MaskingAuditLog
fn clone(&self) -> MaskingAuditLog
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MaskingAuditLog
impl Debug for MaskingAuditLog
Source§impl Default for MaskingAuditLog
impl Default for MaskingAuditLog
Source§fn default() -> MaskingAuditLog
fn default() -> MaskingAuditLog
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MaskingAuditLog
impl RefUnwindSafe for MaskingAuditLog
impl Send for MaskingAuditLog
impl Sync for MaskingAuditLog
impl Unpin for MaskingAuditLog
impl UnsafeUnpin for MaskingAuditLog
impl UnwindSafe for MaskingAuditLog
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