2018-10-11 02:57:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Compression/ICompressionCodec.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class CompressionCodecMultiple final : public ICompressionCodec
|
|
|
|
{
|
|
|
|
public:
|
2020-07-09 05:08:41 +00:00
|
|
|
CompressionCodecMultiple() = default; /// Need for CompressionFactory to register codec by method byte.
|
2021-08-19 15:19:07 +00:00
|
|
|
explicit CompressionCodecMultiple(Codecs codecs_);
|
2018-10-11 02:57:48 +00:00
|
|
|
|
2020-01-03 14:39:24 +00:00
|
|
|
uint8_t getMethodByte() const override;
|
2018-10-11 02:57:48 +00:00
|
|
|
|
2019-01-15 14:20:34 +00:00
|
|
|
UInt32 getMaxCompressedDataSize(UInt32 uncompressed_size) const override;
|
2018-10-11 02:57:48 +00:00
|
|
|
|
2020-08-28 09:07:20 +00:00
|
|
|
static std::vector<uint8_t> getCodecsBytesFromData(const char * source);
|
|
|
|
|
2020-09-03 22:04:46 +00:00
|
|
|
void updateHash(SipHash & hash) const override;
|
|
|
|
|
2018-12-19 17:20:18 +00:00
|
|
|
protected:
|
2020-09-03 22:04:46 +00:00
|
|
|
|
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
|
|
|
|
2020-03-08 22:08:39 +00:00
|
|
|
void doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 decompressed_size) const override;
|
2018-10-11 02:57:48 +00:00
|
|
|
|
2020-05-04 00:11:49 +00:00
|
|
|
bool isCompression() const override;
|
|
|
|
bool isGenericCompression() const override { return false; }
|
|
|
|
|
2018-10-11 02:57:48 +00:00
|
|
|
private:
|
|
|
|
Codecs codecs;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|