]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/bloom_filter: note that uint32_t interface requires well-mixed values 638/head
authorSage Weil <sage@inktank.com>
Thu, 3 Oct 2013 16:20:34 +0000 (09:20 -0700)
committerSage Weil <sage@inktank.com>
Thu, 3 Oct 2013 16:22:05 +0000 (09:22 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/common/bloom_filter.hpp

index 6d5f645d8c904fb533ab26385d143ffb7ce9f8a7..6216c7fb34d42e1918b22dec1bcb58cef5a58d66 100644 (file)
@@ -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;