pub struct SuppressionStore { /* private fields */ }Expand description
Sled-backed store for suppressions
§Sled Layout
by_id: Primary store, key=id, value=SuppressionEntry JSONby_fingerprint: Index fingerprint -> id for fast lookupby_rule: Index rule_id:id -> () for filtering by ruleby_file: Index file_path:id -> () for filtering by fileaudit_log: key=timestamp-id, value=AuditEvent JSON
Implementations§
Source§impl SuppressionStore
impl SuppressionStore
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open or create a suppression store at the given path
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Get the entry count
Sourcepub fn open_project(project_root: impl AsRef<Path>) -> Result<Self>
pub fn open_project(project_root: impl AsRef<Path>) -> Result<Self>
Open or create a suppression store for a project
Uses .rma/suppressions.db within the project root
Sourcepub fn is_suppressed(
&self,
fingerprint: &str,
) -> Result<Option<SuppressionEntry>>
pub fn is_suppressed( &self, fingerprint: &str, ) -> Result<Option<SuppressionEntry>>
Check if a fingerprint is suppressed
Returns the suppression entry if found and active
Sourcepub fn suppress(&self, entry: SuppressionEntry) -> Result<String>
pub fn suppress(&self, entry: SuppressionEntry) -> Result<String>
Add a new suppression
Returns the suppression ID
Sourcepub fn revoke_with_reason(
&self,
id: &str,
actor: &str,
reason: Option<&str>,
) -> Result<bool>
pub fn revoke_with_reason( &self, id: &str, actor: &str, reason: Option<&str>, ) -> Result<bool>
Revoke a suppression by ID with optional reason
Sourcepub fn list(&self, filter: SuppressionFilter) -> Result<Vec<SuppressionEntry>>
pub fn list(&self, filter: SuppressionFilter) -> Result<Vec<SuppressionEntry>>
List suppressions with optional filtering
Sourcepub fn check_staleness<F>(
&self,
get_snippet: F,
) -> Result<Vec<SuppressionEntry>>
pub fn check_staleness<F>( &self, get_snippet: F, ) -> Result<Vec<SuppressionEntry>>
Check for stale suppressions based on current findings
Returns a list of suppressions that no longer match their original code
Sourcepub fn cleanup_expired(&self, actor: &str) -> Result<usize>
pub fn cleanup_expired(&self, actor: &str) -> Result<usize>
Clean up expired suppressions
Returns the number of suppressions cleaned up
Sourcepub fn get_audit_log(&self, suppression_id: &str) -> Result<Vec<AuditEvent>>
pub fn get_audit_log(&self, suppression_id: &str) -> Result<Vec<AuditEvent>>
Get the audit log for a specific suppression
Sourcepub fn get_recent_audit(&self, limit: usize) -> Result<Vec<AuditEvent>>
pub fn get_recent_audit(&self, limit: usize) -> Result<Vec<AuditEvent>>
Get recent audit events
Sourcepub fn stats(&self) -> Result<StoreStats>
pub fn stats(&self) -> Result<StoreStats>
Get statistics about the store
Sourcepub fn update(&self, entry: &SuppressionEntry, actor: &str) -> Result<()>
pub fn update(&self, entry: &SuppressionEntry, actor: &str) -> Result<()>
Update an existing entry (public version with audit logging)
Sourcepub fn submit_for_approval(&self, id: &str, actor: &str) -> Result<bool>
pub fn submit_for_approval(&self, id: &str, actor: &str) -> Result<bool>
Submit a suppression for approval
Sourcepub fn approve(
&self,
id: &str,
approver: &str,
comment: Option<&str>,
) -> Result<bool>
pub fn approve( &self, id: &str, approver: &str, comment: Option<&str>, ) -> Result<bool>
Approve a suppression
Sourcepub fn reject(&self, id: &str, rejector: &str, reason: &str) -> Result<bool>
pub fn reject(&self, id: &str, rejector: &str, reason: &str) -> Result<bool>
Reject a suppression
Sourcepub fn add_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>
pub fn add_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>
Add a tag to a suppression
Sourcepub fn remove_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>
pub fn remove_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>
Remove a tag from a suppression
Sourcepub fn add_to_group(&self, id: &str, group: &str, actor: &str) -> Result<bool>
pub fn add_to_group(&self, id: &str, group: &str, actor: &str) -> Result<bool>
Add a suppression to a group
Sourcepub fn remove_from_group(
&self,
id: &str,
group: &str,
actor: &str,
) -> Result<bool>
pub fn remove_from_group( &self, id: &str, group: &str, actor: &str, ) -> Result<bool>
Remove a suppression from a group
Sourcepub fn schedule_revocation(
&self,
id: &str,
scheduled_for: &str,
actor: &str,
reason: &str,
) -> Result<bool>
pub fn schedule_revocation( &self, id: &str, scheduled_for: &str, actor: &str, reason: &str, ) -> Result<bool>
Schedule a suppression for auto-revocation
Sourcepub fn cancel_revocation(&self, id: &str, actor: &str) -> Result<bool>
pub fn cancel_revocation(&self, id: &str, actor: &str) -> Result<bool>
Cancel a scheduled revocation
Sourcepub fn process_scheduled_revocations(&self, actor: &str) -> Result<Vec<String>>
pub fn process_scheduled_revocations(&self, actor: &str) -> Result<Vec<String>>
Process scheduled revocations that are due
Sourcepub fn list_by_tag(&self, tag: &str) -> Result<Vec<SuppressionEntry>>
pub fn list_by_tag(&self, tag: &str) -> Result<Vec<SuppressionEntry>>
List suppressions by tag
Sourcepub fn list_by_group(&self, group: &str) -> Result<Vec<SuppressionEntry>>
pub fn list_by_group(&self, group: &str) -> Result<Vec<SuppressionEntry>>
List suppressions by group
List all unique tags in the store
Sourcepub fn list_groups(&self) -> Result<Vec<String>>
pub fn list_groups(&self) -> Result<Vec<String>>
List all unique groups in the store