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 | |
8 | namespace DB |
9 | { |
10 | |
11 | class CompressionCodecZSTD : public ICompressionCodec |
12 | { |
13 | public: |
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 | |
24 | protected: |
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 | |
29 | private: |
30 | const int level; |
31 | }; |
32 | |
33 | |
34 | class CompressionCodecFactory; |
35 | void registerCodecZSTD(CompressionCodecFactory & factory); |
36 | |
37 | } |
38 |