pub struct CMSketchAtomicU32 { /* private fields */ }Expand description
Count-Min Sketch that stores u32 counters using atomics for concurrent updates.
Each bucket is backed by AtomicU32, allowing lock-free increments and decrements.
Implementations§
Source§impl CMSketchAtomicU32
impl CMSketchAtomicU32
Sourcepub fn new(eps: f64, confidence: f64) -> Self
pub fn new(eps: f64, confidence: f64) -> Self
Creates a new atomic sketch sized by error eps and confidence.
See CMSketchU32::new for the mapping between
confidence and depth.
§Panics
Panics if eps <= 0.0 or confidence <= 0.0.
Sourcepub fn inc_by(&self, hash: u64, count: u32)
pub fn inc_by(&self, hash: u64, count: u32)
Atomically increments the count associated with hash by count.
Saturates at the maximum value representable by the counter type and leaves the bucket unchanged if the update would overflow.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CMSketchAtomicU32
impl RefUnwindSafe for CMSketchAtomicU32
impl Send for CMSketchAtomicU32
impl Sync for CMSketchAtomicU32
impl Unpin for CMSketchAtomicU32
impl UnwindSafe for CMSketchAtomicU32
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