]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/table/block_based/uncompression_dict_reader.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / table / block_based / uncompression_dict_reader.h
CommitLineData
f67539c2
TL
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
7#pragma once
8
9#include <cassert>
1e59de90 10
f67539c2
TL
11#include "table/block_based/cachable_entry.h"
12#include "table/format.h"
13
14namespace ROCKSDB_NAMESPACE {
15
16class BlockBasedTable;
17struct BlockCacheLookupContext;
18class FilePrefetchBuffer;
19class GetContext;
20struct ReadOptions;
21struct UncompressionDict;
22
23// Provides access to the uncompression dictionary regardless of whether
24// it is owned by the reader or stored in the cache, or whether it is pinned
25// in the cache or not.
26class UncompressionDictReader {
27 public:
28 static Status Create(
20effc67
TL
29 const BlockBasedTable* table, const ReadOptions& ro,
30 FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
31 bool pin, BlockCacheLookupContext* lookup_context,
f67539c2
TL
32 std::unique_ptr<UncompressionDictReader>* uncompression_dict_reader);
33
34 Status GetOrReadUncompressionDictionary(
1e59de90
TL
35 FilePrefetchBuffer* prefetch_buffer, bool no_io, bool verify_checksums,
36 GetContext* get_context, BlockCacheLookupContext* lookup_context,
f67539c2
TL
37 CachableEntry<UncompressionDict>* uncompression_dict) const;
38
39 size_t ApproximateMemoryUsage() const;
40
41 private:
42 UncompressionDictReader(const BlockBasedTable* t,
43 CachableEntry<UncompressionDict>&& uncompression_dict)
44 : table_(t), uncompression_dict_(std::move(uncompression_dict)) {
45 assert(table_);
46 }
47
48 bool cache_dictionary_blocks() const;
49
50 static Status ReadUncompressionDictionary(
51 const BlockBasedTable* table, FilePrefetchBuffer* prefetch_buffer,
52 const ReadOptions& read_options, bool use_cache, GetContext* get_context,
53 BlockCacheLookupContext* lookup_context,
54 CachableEntry<UncompressionDict>* uncompression_dict);
55
56 const BlockBasedTable* table_;
57 CachableEntry<UncompressionDict> uncompression_dict_;
58};
59
60} // namespace ROCKSDB_NAMESPACE