MCPcopy Create free account
hub / github.com/ElementsProject/elements / KeyMayMatch

Method KeyMayMatch

src/leveldb/table/filter_block.cc:90–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool FilterBlockReader::KeyMayMatch(uint64_t block_offset, const Slice& key) {
91 uint64_t index = block_offset >> base_lg_;
92 if (index < num_) {
93 uint32_t start = DecodeFixed32(offset_ + index * 4);
94 uint32_t limit = DecodeFixed32(offset_ + index * 4 + 4);
95 if (start <= limit && limit <= static_cast<size_t>(offset_ - data_)) {
96 Slice filter = Slice(data_ + start, limit - start);
97 return policy_->KeyMayMatch(key, filter);
98 } else if (start == limit) {
99 // Empty filters do not match any keys
100 return false;
101 }
102 }
103 return true; // Errors are treated as potential matches
104}
105
106} // namespace leveldb

Callers 1

InternalGetMethod · 0.45

Calls 2

DecodeFixed32Function · 0.85
SliceClass · 0.50

Tested by

no test coverage detected