diff options
author | Sage Weil <sage@inktank.com> | 2013-10-03 09:20:34 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-10-03 09:22:05 -0700 |
commit | 8cfeb8342a08774fb1030830859c3fc30514f0b5 (patch) | |
tree | ccd8c0ca8f8dd53e690c23dd0336c31b081d364c | |
parent | 9299f501ea07fce83dcd03cb8e6c9fec5496de57 (diff) | |
download | ceph-8cfeb8342a08774fb1030830859c3fc30514f0b5.tar.gz |
common/bloom_filter: note that uint32_t interface requires well-mixed values
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/common/bloom_filter.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
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; |