]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/table/persistent_cache_helper.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / table / persistent_cache_helper.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5 #pragma once
6
7 #include <string>
8
9 #include "monitoring/statistics.h"
10 #include "table/format.h"
11 #include "table/persistent_cache_options.h"
12
13 namespace rocksdb {
14
15 struct BlockContents;
16
17 // PersistentCacheHelper
18 //
19 // Encapsulates some of the helper logic for read and writing from the cache
20 class PersistentCacheHelper {
21 public:
22 // insert block into raw page cache
23 static void InsertRawPage(const PersistentCacheOptions& cache_options,
24 const BlockHandle& handle, const char* data,
25 const size_t size);
26
27 // insert block into uncompressed cache
28 static void InsertUncompressedPage(
29 const PersistentCacheOptions& cache_options, const BlockHandle& handle,
30 const BlockContents& contents);
31
32 // lookup block from raw page cacge
33 static Status LookupRawPage(const PersistentCacheOptions& cache_options,
34 const BlockHandle& handle,
35 std::unique_ptr<char[]>* raw_data,
36 const size_t raw_data_size);
37
38 // lookup block from uncompressed cache
39 static Status LookupUncompressedPage(
40 const PersistentCacheOptions& cache_options, const BlockHandle& handle,
41 BlockContents* contents);
42 };
43
44 } // namespace rocksdb