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/table.h" 12 13 namespace ROCKSDB_NAMESPACE { 14 // Release the cached entry and decrement its ref count. 15 extern void ForceReleaseCachedEntry(void* arg, void* h); 16 GetMemoryAllocator(const BlockBasedTableOptions & table_options)17inline MemoryAllocator* GetMemoryAllocator( 18 const BlockBasedTableOptions& table_options) { 19 return table_options.block_cache.get() 20 ? table_options.block_cache->memory_allocator() 21 : nullptr; 22 } 23 GetMemoryAllocatorForCompressedBlock(const BlockBasedTableOptions & table_options)24inline MemoryAllocator* GetMemoryAllocatorForCompressedBlock( 25 const BlockBasedTableOptions& table_options) { 26 return table_options.block_cache_compressed.get() 27 ? table_options.block_cache_compressed->memory_allocator() 28 : nullptr; 29 } 30 31 extern Status VerifyChecksum(const ChecksumType type, const char* buf, 32 size_t len, uint32_t expected); 33 } // namespace ROCKSDB_NAMESPACE 34