diff --git a/src/types/bloom_filter.cc b/src/types/bloom_filter.cc index c9b936b05ef..8de1de83ccd 100644 --- a/src/types/bloom_filter.cc +++ b/src/types/bloom_filter.cc @@ -67,7 +67,7 @@ bool BlockSplitBloomFilter::Init(std::string bitset) { return true; } -std::unique_ptr BlockSplitBloomFilter::CreateNonOwned(const std::string& bitset) { +std::unique_ptr BlockSplitBloomFilter::CreateReadOnlyBloomFilter(const std::string& bitset) { return std::unique_ptr(new BlockSplitBloomFilter(bitset)); } diff --git a/src/types/bloom_filter.h b/src/types/bloom_filter.h index 91ed59cb4c9..7dbbebeba6c 100644 --- a/src/types/bloom_filter.h +++ b/src/types/bloom_filter.h @@ -84,12 +84,12 @@ class BlockSplitBloomFilter { /// @return false if the number of bytes of Bloom filter bitset is not a power of 2, and true means successfully init bool Init(std::string bitset); - /// Create the non-owned BlockSplitBloomFilter. It use the bitset as underlying bitset. It is the caller's + /// Create the read-only BlockSplitBloomFilter. It use the caller's bitset as underlying bitset. It is the caller's /// responsibility to ensure the bitset would not to change. /// /// @param bitset The given bitset for the Bloom filter underlying bitset. /// @return the unique_ptr of the const non-owned BlockSplitBloomFilter - static std::unique_ptr CreateNonOwned(const std::string& bitset); + static std::unique_ptr CreateReadOnlyBloomFilter(const std::string& bitset); /// Minimum Bloom filter size, it sets to 32 bytes to fit a tiny Bloom filter. static constexpr uint32_t kMinimumBloomFilterBytes = 32; @@ -173,7 +173,7 @@ class BlockSplitBloomFilter { static uint64_t Hash(const char* data, size_t length); private: - // The private constructor of BlockSplitBloomFilter. It's only used for CreateNonOwned + // The private constructor of BlockSplitBloomFilter. It's only used for CreateReadOnlyBloomFilter explicit BlockSplitBloomFilter(const std::string& bitset); // Bytes in a tiny Bloom filter block. diff --git a/src/types/redis_bloom_chain.cc b/src/types/redis_bloom_chain.cc index f36524d1653..c01f19c72b1 100644 --- a/src/types/redis_bloom_chain.cc +++ b/src/types/redis_bloom_chain.cc @@ -112,11 +112,11 @@ void BloomChain::bloomAdd(const Slice &item, std::string *bf_data) { } bool BloomChain::bloomCheck(const Slice &item, std::string &bf_data) { - std::unique_ptr block_split_bloom_filter_non_owned = - BlockSplitBloomFilter::CreateNonOwned(bf_data); + std::unique_ptr bloom_filter_read_only = + BlockSplitBloomFilter::CreateReadOnlyBloomFilter(bf_data); uint64_t h = BlockSplitBloomFilter::Hash(item.data(), item.size()); - return block_split_bloom_filter_non_owned->FindHash(h); + return bloom_filter_read_only->FindHash(h); } rocksdb::Status BloomChain::Reserve(const Slice &user_key, uint32_t capacity, double error_rate, uint16_t expansion) {