Skip to content

Commit

Permalink
Rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
zncleon committed Sep 17, 2023
1 parent f85f2a9 commit 8c96016
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/types/bloom_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool BlockSplitBloomFilter::Init(std::string bitset) {
return true;
}

std::unique_ptr<const BlockSplitBloomFilter> BlockSplitBloomFilter::CreateNonOwned(const std::string& bitset) {
std::unique_ptr<const BlockSplitBloomFilter> BlockSplitBloomFilter::CreateReadOnlyBloomFilter(const std::string& bitset) {
return std::unique_ptr<const BlockSplitBloomFilter>(new BlockSplitBloomFilter(bitset));
}

Expand Down
6 changes: 3 additions & 3 deletions src/types/bloom_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<const BlockSplitBloomFilter> CreateNonOwned(const std::string& bitset);
static std::unique_ptr<const BlockSplitBloomFilter> 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;
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/types/redis_bloom_chain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void BloomChain::bloomAdd(const Slice &item, std::string *bf_data) {

bool BloomChain::bloomCheck(const Slice &item, std::string &bf_data) {
std::unique_ptr<const BlockSplitBloomFilter> block_split_bloom_filter_non_owned =
BlockSplitBloomFilter::CreateNonOwned(bf_data);
BlockSplitBloomFilter::CreateReadOnlyBloomFilter(bf_data);

uint64_t h = BlockSplitBloomFilter::Hash(item.data(), item.size());
return block_split_bloom_filter_non_owned->FindHash(h);
Expand Down

0 comments on commit 8c96016

Please sign in to comment.