From: Sage Weil Date: Thu, 3 Oct 2013 16:20:34 +0000 (-0700) Subject: common/bloom_filter: note that uint32_t interface requires well-mixed values X-Git-Tag: v0.71~35^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F638%2Fhead;p=ceph.git common/bloom_filter: note that uint32_t interface requires well-mixed values Signed-off-by: Sage Weil --- diff --git a/src/common/bloom_filter.hpp b/src/common/bloom_filter.hpp index 6d5f645d8c9..6216c7fb34d 100644 --- a/src/common/bloom_filter.hpp +++ b/src/common/bloom_filter.hpp @@ -131,6 +131,15 @@ public: inserted_element_count_ = 0; } + /** + * insert a u32 into the set + * + * NOTE: the internal hash is weak enough that consecutive inputs do + * not achieve the desired fpp. Well-mixed values should be used + * here (e.g., put rjhash(x) into the filter instead of just x). + * + * @param val integer value to insert + */ inline void insert(uint32_t val) { std::size_t bit_index = 0; std::size_t bit = 0; @@ -181,6 +190,16 @@ public: } } + /** + * check if a u32 is contained by set + * + * NOTE: the internal hash is weak enough that consecutive inputs do + * not achieve the desired fpp. Well-mixed values should be used + * here (e.g., put rjhash(x) into the filter instead of just x). + * + * @param val integer value to query + * @returns true if value is (probably) in the set, false if it definitely is not + */ inline virtual bool contains(uint32_t val) const { std::size_t bit_index = 0;