1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 // This source code is licensed under both the GPLv2 (found in the 3 // COPYING file in the root directory) and Apache 2.0 License 4 // (found in the LICENSE.Apache file in the root directory). 5 6 #pragma once 7 8 #include <memory> 9 10 #include "table/format.h" 11 12 namespace ROCKSDB_NAMESPACE { 13 14 class FilterBitsReader; 15 class FilterPolicy; 16 17 // The sharable/cachable part of the full filter. 18 class ParsedFullFilterBlock { 19 public: 20 ParsedFullFilterBlock(const FilterPolicy* filter_policy, 21 BlockContents&& contents); 22 ~ParsedFullFilterBlock(); 23 filter_bits_reader()24 FilterBitsReader* filter_bits_reader() const { 25 return filter_bits_reader_.get(); 26 } 27 28 // TODO: consider memory usage of the FilterBitsReader ApproximateMemoryUsage()29 size_t ApproximateMemoryUsage() const { 30 return block_contents_.ApproximateMemoryUsage(); 31 } 32 own_bytes()33 bool own_bytes() const { return block_contents_.own_bytes(); } 34 35 private: 36 BlockContents block_contents_; 37 std::unique_ptr<FilterBitsReader> filter_bits_reader_; 38 }; 39 40 } // namespace ROCKSDB_NAMESPACE 41