pub struct DedupSet { /* private fields */ }Expand description
In-memory set of dedup keys with snapshot / restore for opt-in cross-process persistence.
Implementations§
Source§impl DedupSet
impl DedupSet
Sourcepub fn contains(&self, key: &DedupKey) -> Result<bool, PolicyError>
pub fn contains(&self, key: &DedupKey) -> Result<bool, PolicyError>
Returns true if key has already been recorded.
Returns PolicyError::Poisoned if a previous holder of the internal
lock panicked.
Sourcepub fn snapshot(&self) -> Result<Vec<String>, PolicyError>
pub fn snapshot(&self) -> Result<Vec<String>, PolicyError>
Snapshot the current set as a sorted list of hex-encoded keys, suitable for writing to a sidecar file.
Sourcepub fn extend_from_snapshot(&self, hexes: &[String]) -> Result<(), PolicyError>
pub fn extend_from_snapshot(&self, hexes: &[String]) -> Result<(), PolicyError>
Replay a snapshot produced by Self::snapshot back into this set.
Malformed entries are skipped with a tracing::warn!.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DedupSet
impl RefUnwindSafe for DedupSet
impl Send for DedupSet
impl Sync for DedupSet
impl Unpin for DedupSet
impl UnsafeUnpin for DedupSet
impl UnwindSafe for DedupSet
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