pub struct Doorkeeper { /* private fields */ }Expand description
1-bit Bloom filter used as a doorkeeper to filter one-hit wonders.
On first access within an epoch, the doorkeeper sets a bit. Only on the second access does the item get promoted to the Count-Min Sketch. The doorkeeper is cleared whenever the CMS resets (halves).
Implementations§
Source§impl Doorkeeper
impl Doorkeeper
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a doorkeeper with the default size (2048 bits).
Sourcepub fn check_and_set(&mut self, hash: u64) -> bool
pub fn check_and_set(&mut self, hash: u64) -> bool
Check if a key has been seen. Returns true if the bit was already set.
Trait Implementations§
Source§impl Clone for Doorkeeper
impl Clone for Doorkeeper
Source§fn clone(&self) -> Doorkeeper
fn clone(&self) -> Doorkeeper
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 moreAuto Trait Implementations§
impl Freeze for Doorkeeper
impl RefUnwindSafe for Doorkeeper
impl Send for Doorkeeper
impl Sync for Doorkeeper
impl Unpin for Doorkeeper
impl UnwindSafe for Doorkeeper
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