ClickHouse/src/Compression/CompressionCodecZSTD.h

43 lines
1.0 KiB
C++
Raw Normal View History

2018-10-11 02:57:48 +00:00
#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:
2018-12-21 12:17:30 +00:00
static constexpr auto ZSTD_DEFAULT_LEVEL = 1;
static constexpr auto ZSTD_DEFAULT_LOG_WINDOW = 24;
2018-12-21 12:17:30 +00:00
2018-12-19 17:20:18 +00:00
CompressionCodecZSTD(int level_);
2018-10-11 02:57:48 +00:00
CompressionCodecZSTD(int level_, int window_log);
2020-01-03 14:39:24 +00:00
uint8_t getMethodByte() const override;
2018-10-11 02:57:48 +00:00
UInt32 getMaxCompressedDataSize(UInt32 uncompressed_size) const override;
2018-10-11 02:57:48 +00:00
void updateHash(SipHash & hash) const override;
2018-12-19 17:20:18 +00:00
protected:
2018-12-19 17:20:18 +00:00
UInt32 doCompressData(const char * source, UInt32 source_size, char * dest) const override;
2018-10-11 02:57:48 +00:00
2018-12-19 17:20:18 +00:00
void doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 uncompressed_size) const override;
2018-10-11 02:57:48 +00:00
2020-05-04 00:11:49 +00:00
bool isCompression() const override { return true; }
bool isGenericCompression() const override { return true; }
2018-10-11 02:57:48 +00:00
private:
const int level;
const bool enable_long_range;
const int window_log;
2018-10-11 02:57:48 +00:00
};
2018-12-19 17:20:18 +00:00
}