pub struct BloomCascade<T> { /* private fields */ }Expand description
Two-level cascading filter: 8-byte coarse + 32-byte fine. Layer 0 (coarse) rejects in one register-compare. Layer 1 (fine) holds 4x as many bits + 8 hash functions; rejects most of the remainder before the target is touched.
Architectural shape: same as LSM-tree multi-level Blooms or the nested-cache pattern in Bitcoin SPV / LevelDB / RocksDB - exposed as a typed primitive.
Implementations§
Source§impl<T> BloomCascade<T>
impl<T> BloomCascade<T>
pub fn new(target: Arc<T>, coarse: Bloom64, fine: BloomFine) -> Self
Sourcepub fn from_keys<K, I>(target: Arc<T>, keys: I) -> Selfwhere
K: Hash,
I: IntoIterator<Item = K>,
pub fn from_keys<K, I>(target: Arc<T>, keys: I) -> Selfwhere
K: Hash,
I: IntoIterator<Item = K>,
Build both filter levels from the same key iterator.
pub fn target(&self) -> &Arc<T> ⓘ
pub fn coarse(&self) -> Bloom64
pub fn fine(&self) -> &BloomFine
Sourcepub fn cascade_check<K: Hash + ?Sized>(&self, key: &K) -> CascadeOutcome
pub fn cascade_check<K: Hash + ?Sized>(&self, key: &K) -> CascadeOutcome
Cascade rejection: coarse first (register-only), fine second (32 bytes, 4 cache lines worst case). Returns the LEVEL where the reject fired (0 = coarse rejected, 1 = fine rejected, 2 = both layers said maybe-yes).
Trait Implementations§
Source§impl<T: Clone> Clone for BloomCascade<T>
impl<T: Clone> Clone for BloomCascade<T>
Source§fn clone(&self) -> BloomCascade<T>
fn clone(&self) -> BloomCascade<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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<T> Freeze for BloomCascade<T>
impl<T> RefUnwindSafe for BloomCascade<T>where
Arc<T>: RefUnwindSafe,
impl<T> Send for BloomCascade<T>
impl<T> Sync for BloomCascade<T>
impl<T> Unpin for BloomCascade<T>
impl<T> UnsafeUnpin for BloomCascade<T>where
Arc<T>: UnsafeUnpin,
impl<T> UnwindSafe for BloomCascade<T>where
Arc<T>: UnwindSafe,
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