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:
Greg Fitzgerald
2019-01-10 11:05:46 -07:00
committed by Grimes
parent 2dbe8fc1a9
commit 885fe38c01
3 changed files with 8 additions and 8 deletions

View File

@@ -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>,