Summary: In follow-up to https://github.com/facebook/rocksdb/issues/14315 Remove obsolete code replaced by new Compressor/Decompressor interface: * OLD_CompressData and OLD_UncompressData * Individual compression/decompression functions (Snappy_*, Zlib_*, BZip2_*, LZ4_*, LZ4HC_*, XPRESS_*, ZSTD_Compress, ZSTD_Uncompress) * CompressionInfo and UncompressionInfo classes * UncompressionDict class * compression::PutDecompressedSizeInfo and GetDecompressedSizeInfo The only small refactoring in this change that is not pure code removal or movement is in blob_file_builder_test.cc. Move some function implementations etc. from compression.h to compression.cc: * CompressionTypeToString, CompressionTypeFromString, CompressionOptionsToString * ZSTD_TrainDictionary (both overloads), ZSTD_FinalizeDictionary * DecompressorDict::Populate * Most compression library includes Also cleaned up other includes of compression.h, which caused some other files to need new includes. Pull Request resolved: https://github.com/facebook/rocksdb/pull/14325 Test Plan: existing tests Reviewed By: hx235 Differential Revision: D93120580 Pulled By: pdillinger fbshipit-source-id: ab5c50db7379c0387a8c0e379642c9ea2799eae5
59 lines
2 KiB
C++
59 lines
2 KiB
C++
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include <cassert>
|
|
|
|
#include "table/block_based/cachable_entry.h"
|
|
#include "table/format.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
class BlockBasedTable;
|
|
struct BlockCacheLookupContext;
|
|
class FilePrefetchBuffer;
|
|
class GetContext;
|
|
struct ReadOptions;
|
|
|
|
// Provides access to the uncompression dictionary regardless of whether
|
|
// it is owned by the reader or stored in the cache, or whether it is pinned
|
|
// in the cache or not.
|
|
class UncompressionDictReader {
|
|
public:
|
|
static Status Create(
|
|
const BlockBasedTable* table, const ReadOptions& ro,
|
|
FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
|
|
bool pin, BlockCacheLookupContext* lookup_context,
|
|
std::unique_ptr<UncompressionDictReader>* uncompression_dict_reader);
|
|
|
|
Status GetOrReadUncompressionDictionary(
|
|
FilePrefetchBuffer* prefetch_buffer, const ReadOptions& ro,
|
|
GetContext* get_context, BlockCacheLookupContext* lookup_context,
|
|
CachableEntry<DecompressorDict>* uncompression_dict) const;
|
|
|
|
size_t ApproximateMemoryUsage() const;
|
|
|
|
private:
|
|
UncompressionDictReader(const BlockBasedTable* t,
|
|
CachableEntry<DecompressorDict>&& uncompression_dict)
|
|
: table_(t), uncompression_dict_(std::move(uncompression_dict)) {
|
|
assert(table_);
|
|
}
|
|
|
|
bool cache_dictionary_blocks() const;
|
|
|
|
static Status ReadUncompressionDictionary(
|
|
const BlockBasedTable* table, FilePrefetchBuffer* prefetch_buffer,
|
|
const ReadOptions& read_options, bool use_cache, GetContext* get_context,
|
|
BlockCacheLookupContext* lookup_context,
|
|
CachableEntry<DecompressorDict>* uncompression_dict);
|
|
|
|
const BlockBasedTable* table_;
|
|
CachableEntry<DecompressorDict> uncompression_dict_;
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|