1#pragma once
2
3#include <IO/WriteBuffer.h>
4#include <Compression/ICompressionCodec.h>
5#include <IO/BufferWithOwnMemory.h>
6#include <Parsers/StringRange.h>
7
8namespace DB
9{
10
11class CompressionCodecZSTD : public ICompressionCodec
12{
13public:
14 static constexpr auto ZSTD_DEFAULT_LEVEL = 1;
15
16 CompressionCodecZSTD(int level_);
17
18 UInt8 getMethodByte() const override;
19
20 String getCodecDesc() const override;
21
22 UInt32 getMaxCompressedDataSize(UInt32 uncompressed_size) const override;
23
24protected:
25 UInt32 doCompressData(const char * source, UInt32 source_size, char * dest) const override;
26
27 void doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 uncompressed_size) const override;
28
29private:
30 const int level;
31};
32
33
34class CompressionCodecFactory;
35void registerCodecZSTD(CompressionCodecFactory & factory);
36
37}
38