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

Method FilterBlockReader

src/leveldb/table/filter_block.cc:77–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77FilterBlockReader::FilterBlockReader(const FilterPolicy* policy,
78 const Slice& contents)
79 : policy_(policy), data_(nullptr), offset_(nullptr), num_(0), base_lg_(0) {
80 size_t n = contents.size();
81 if (n < 5) return; // 1 byte for base_lg_ and 4 for start of offset array
82 base_lg_ = contents[n - 1];
83 uint32_t last_word = DecodeFixed32(contents.data() + n - 5);
84 if (last_word > n - 5) return;
85 data_ = contents.data();
86 offset_ = data_ + last_word;
87 num_ = (n - 5 - last_word) / 4;
88}
89
90bool FilterBlockReader::KeyMayMatch(uint64_t block_offset, const Slice& key) {
91 uint64_t index = block_offset >> base_lg_;

Callers

nothing calls this directly

Calls 3

DecodeFixed32Function · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected