pub struct BloomSegment { /* private fields */ }Expand description
Owning bloom header that can be embedded in a segment.
Implementations§
Source§impl BloomSegment
impl BloomSegment
Sourcepub fn with_capacity(expected: usize) -> BloomSegment
pub fn with_capacity(expected: usize) -> BloomSegment
Build a bloom sized for expected elements at a 1% false-positive
rate. Cheap — allocates ~9.6 * expected / 8 bytes.
Sourcepub fn with_rate(expected: usize, fp_rate: f64) -> BloomSegment
pub fn with_rate(expected: usize, fp_rate: f64) -> BloomSegment
Custom false-positive rate.
Sourcepub fn contains(&self, key: &[u8]) -> bool
pub fn contains(&self, key: &[u8]) -> bool
Might key be present? (May return a false positive, never a false
negative.)
Sourcepub fn definitely_absent(&self, key: &[u8]) -> bool
pub fn definitely_absent(&self, key: &[u8]) -> bool
Inverse of contains — the thing callers usually want.
Sourcepub fn estimated_fp_rate(&self) -> f64
pub fn estimated_fp_rate(&self) -> f64
Estimated current false-positive rate given the number of insertions.
Sourcepub fn inserted_count(&self) -> u32
pub fn inserted_count(&self) -> u32
Number of elements recorded so far (best-effort).
Sourcepub fn filter(&self) -> &BloomFilter
pub fn filter(&self) -> &BloomFilter
Access the underlying bloom filter (e.g. to pass to
crate::storage::index::IndexBase::bloom).
Sourcepub fn union_inplace(&mut self, other: &BloomSegment) -> bool
pub fn union_inplace(&mut self, other: &BloomSegment) -> bool
Merge another bloom segment into this one. Both must have the same
size and hash count. Returns false on mismatch.
Sourcepub fn decode(bytes: &[u8]) -> Result<(BloomSegment, usize), BloomSegmentError>
pub fn decode(bytes: &[u8]) -> Result<(BloomSegment, usize), BloomSegmentError>
Parse a previously encoded header. Returns a fresh BloomSegment and
the number of bytes consumed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BloomSegment
impl RefUnwindSafe for BloomSegment
impl Send for BloomSegment
impl Sync for BloomSegment
impl Unpin for BloomSegment
impl UnsafeUnpin for BloomSegment
impl UnwindSafe for BloomSegment
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request