Skip to main content

SuppressionStore

Struct SuppressionStore 

Source
pub struct SuppressionStore { /* private fields */ }
Expand description

Sled-backed store for suppressions

§Sled Layout

  • by_id: Primary store, key=id, value=SuppressionEntry JSON
  • by_fingerprint: Index fingerprint -> id for fast lookup
  • by_rule: Index rule_id:id -> () for filtering by rule
  • by_file: Index file_path:id -> () for filtering by file
  • audit_log: key=timestamp-id, value=AuditEvent JSON

Implementations§

Source§

impl SuppressionStore

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Open or create a suppression store at the given path

Source

pub fn db_path(&self) -> Option<PathBuf>

Get the database path

Source

pub fn entry_count(&self) -> usize

Get the entry count

Source

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

Source

pub fn is_suppressed( &self, fingerprint: &str, ) -> Result<Option<SuppressionEntry>>

Check if a fingerprint is suppressed

Returns the suppression entry if found and active

Source

pub fn suppress(&self, entry: SuppressionEntry) -> Result<String>

Add a new suppression

Returns the suppression ID

Source

pub fn revoke(&self, id: &str, actor: &str) -> Result<bool>

Revoke a suppression by ID

Source

pub fn revoke_with_reason( &self, id: &str, actor: &str, reason: Option<&str>, ) -> Result<bool>

Revoke a suppression by ID with optional reason

Source

pub fn get(&self, id: &str) -> Result<Option<SuppressionEntry>>

Get a suppression by ID

Source

pub fn list(&self, filter: SuppressionFilter) -> Result<Vec<SuppressionEntry>>

List suppressions with optional filtering

Source

pub fn export(&self, actor: &str) -> Result<String>

Export all active suppressions to JSON

Source

pub fn import(&self, json: &str, actor: &str) -> Result<usize>

Import suppressions from JSON

Source

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

Source

pub fn cleanup_expired(&self, actor: &str) -> Result<usize>

Clean up expired suppressions

Returns the number of suppressions cleaned up

Source

pub fn get_audit_log(&self, suppression_id: &str) -> Result<Vec<AuditEvent>>

Get the audit log for a specific suppression

Source

pub fn get_recent_audit(&self, limit: usize) -> Result<Vec<AuditEvent>>

Get recent audit events

Source

pub fn stats(&self) -> Result<StoreStats>

Get statistics about the store

Source

pub fn update(&self, entry: &SuppressionEntry, actor: &str) -> Result<()>

Update an existing entry (public version with audit logging)

Source

pub fn submit_for_approval(&self, id: &str, actor: &str) -> Result<bool>

Submit a suppression for approval

Source

pub fn approve( &self, id: &str, approver: &str, comment: Option<&str>, ) -> Result<bool>

Approve a suppression

Source

pub fn reject(&self, id: &str, rejector: &str, reason: &str) -> Result<bool>

Reject a suppression

Source

pub fn add_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>

Add a tag to a suppression

Source

pub fn remove_tag(&self, id: &str, tag: &str, actor: &str) -> Result<bool>

Remove a tag from a suppression

Source

pub fn add_to_group(&self, id: &str, group: &str, actor: &str) -> Result<bool>

Add a suppression to a group

Source

pub fn remove_from_group( &self, id: &str, group: &str, actor: &str, ) -> Result<bool>

Remove a suppression from a group

Source

pub fn schedule_revocation( &self, id: &str, scheduled_for: &str, actor: &str, reason: &str, ) -> Result<bool>

Schedule a suppression for auto-revocation

Source

pub fn cancel_revocation(&self, id: &str, actor: &str) -> Result<bool>

Cancel a scheduled revocation

Source

pub fn process_scheduled_revocations(&self, actor: &str) -> Result<Vec<String>>

Process scheduled revocations that are due

Source

pub fn list_by_tag(&self, tag: &str) -> Result<Vec<SuppressionEntry>>

List suppressions by tag

Source

pub fn list_by_group(&self, group: &str) -> Result<Vec<SuppressionEntry>>

List suppressions by group

Source

pub fn list_tags(&self) -> Result<Vec<String>>

List all unique tags in the store

Source

pub fn list_groups(&self) -> Result<Vec<String>>

List all unique groups in the store

Source

pub fn bulk_add_tag( &self, ids: &[&str], tag: &str, actor: &str, ) -> Result<usize>

Bulk add tag to multiple suppressions

Source

pub fn bulk_revoke( &self, ids: &[&str], actor: &str, reason: Option<&str>, ) -> Result<usize>

Bulk revoke suppressions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.