mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
8f2a830d83
* add zstd long compression option * tests: add zstd long read-write test Co-authored-by: Joris Giovannangeli <joris.giovannangeli@ahrefs.com> Co-authored-by: ip <igor@ahrefs.com>
43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <IO/WriteBuffer.h>
|
|
#include <Compression/ICompressionCodec.h>
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
#include <Parsers/StringRange.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class CompressionCodecZSTD : public ICompressionCodec
|
|
{
|
|
public:
|
|
static constexpr auto ZSTD_DEFAULT_LEVEL = 1;
|
|
static constexpr auto ZSTD_DEFAULT_LOG_WINDOW = 24;
|
|
|
|
CompressionCodecZSTD(int level_);
|
|
|
|
CompressionCodecZSTD(int level_, int window_log);
|
|
|
|
uint8_t getMethodByte() const override;
|
|
|
|
UInt32 getMaxCompressedDataSize(UInt32 uncompressed_size) const override;
|
|
|
|
void updateHash(SipHash & hash) const override;
|
|
|
|
protected:
|
|
|
|
UInt32 doCompressData(const char * source, UInt32 source_size, char * dest) const override;
|
|
|
|
void doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 uncompressed_size) const override;
|
|
|
|
bool isCompression() const override { return true; }
|
|
bool isGenericCompression() const override { return true; }
|
|
|
|
private:
|
|
const int level;
|
|
const bool enable_long_range;
|
|
const int window_log;
|
|
};
|
|
|
|
}
|