]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/table/block_based/reader_common.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / table / block_based / reader_common.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).
5 //
6 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. See the AUTHORS file for names of contributors.
9 #pragma once
10
11 #include "rocksdb/cache.h"
12 #include "rocksdb/table.h"
13
14 namespace ROCKSDB_NAMESPACE {
15 // Release the cached entry and decrement its ref count.
16 extern void ForceReleaseCachedEntry(void* arg, void* h);
17
18 inline MemoryAllocator* GetMemoryAllocator(
19 const BlockBasedTableOptions& table_options) {
20 return table_options.block_cache.get()
21 ? table_options.block_cache->memory_allocator()
22 : nullptr;
23 }
24
25 inline MemoryAllocator* GetMemoryAllocatorForCompressedBlock(
26 const BlockBasedTableOptions& table_options) {
27 return table_options.block_cache_compressed.get()
28 ? table_options.block_cache_compressed->memory_allocator()
29 : nullptr;
30 }
31
32 // Assumes block has a trailer as in format.h. file_name and offset provided
33 // for generating a diagnostic message in returned status.
34 extern Status VerifyBlockChecksum(ChecksumType type, const char* data,
35 size_t block_size,
36 const std::string& file_name,
37 uint64_t offset);
38 } // namespace ROCKSDB_NAMESPACE