| 75 | } |
| 76 | |
| 77 | FilterBlockReader::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 | |
| 90 | bool FilterBlockReader::KeyMayMatch(uint64_t block_offset, const Slice& key) { |
| 91 | uint64_t index = block_offset >> base_lg_; |
nothing calls this directly
no test coverage detected