Move BloomHashIndex into its own module
This trait is for bloom, not crds. Slightly better would be to put it in the SDK so that the trait implementations could go into hash and pubkey, but if we don't want compatibility constraints, this is the next best thing.
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
//! Simple Bloom Filter
|
||||
use crate::bloom_hash_index::BloomHashIndex;
|
||||
use bv::BitVec;
|
||||
use rand::{self, Rng};
|
||||
use std::cmp;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// Generate a stable hash of `self` for each `hash_index`
|
||||
/// Best effort can be made for uniqueness of each hash.
|
||||
pub trait BloomHashIndex {
|
||||
fn hash(&self, hash_index: u64) -> u64;
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
||||
pub struct Bloom<T: BloomHashIndex> {
|
||||
pub keys: Vec<u64>,
|
||||
|
Reference in New Issue
Block a user