]>
git.proxmox.com Git - ceph.git/blob - 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 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).
9 #include "monitoring/statistics.h"
10 #include "table/format.h"
11 #include "table/persistent_cache_options.h"
13 namespace ROCKSDB_NAMESPACE
{
17 // PersistentCacheHelper
19 // Encapsulates some of the helper logic for read and writing from the cache
20 class PersistentCacheHelper
{
22 // Insert block into cache of serialized blocks. Size includes block trailer
24 static void InsertSerialized(const PersistentCacheOptions
& cache_options
,
25 const BlockHandle
& handle
, const char* data
,
28 // Insert block into cache of uncompressed blocks. No block trailer.
29 static void InsertUncompressed(const PersistentCacheOptions
& cache_options
,
30 const BlockHandle
& handle
,
31 const BlockContents
& contents
);
33 // Lookup block from cache of serialized blocks. Size includes block trailer
35 static Status
LookupSerialized(const PersistentCacheOptions
& cache_options
,
36 const BlockHandle
& handle
,
37 std::unique_ptr
<char[]>* out_data
,
38 const size_t expected_data_size
);
40 // Lookup block from uncompressed cache. No block trailer.
41 static Status
LookupUncompressed(const PersistentCacheOptions
& cache_options
,
42 const BlockHandle
& handle
,
43 BlockContents
* contents
);
46 } // namespace ROCKSDB_NAMESPACE