ClickHouse/dbms/Compression/CompressionCodecLZ4.h
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

54 lines
1.3 KiB
C++

#pragma once
#include <IO/WriteBuffer.h>
#include <Compression/ICompressionCodec.h>
#include <IO/BufferWithOwnMemory.h>
#include <Parsers/StringRange.h>
#include <Compression/LZ4_decompress_faster.h>
namespace DB
{
class CompressionCodecLZ4 : public ICompressionCodec
{
public:
uint8_t getMethodByte() const override;
String getCodecDesc() const override;
UInt32 getAdditionalSizeAtTheEndOfBuffer() const override { return LZ4::ADDITIONAL_BYTES_AT_END_OF_BUFFER; }
protected:
UInt32 doCompressData(const char * source, UInt32 source_size, char * dest) const override;
private:
void doDecompressData(const char * source, UInt32 source_size, char * dest, UInt32 uncompressed_size) const override;
UInt32 getMaxCompressedDataSize(UInt32 uncompressed_size) const override;
mutable LZ4::PerformanceStatistics lz4_stat;
};
class CompressionCodecFactory;
void registerCodecLZ4(CompressionCodecFactory & factory);
class CompressionCodecLZ4HC : public CompressionCodecLZ4
{
public:
CompressionCodecLZ4HC(int level_);
String getCodecDesc() const override;
protected:
UInt32 doCompressData(const char * source, UInt32 source_size, char * dest) const override;
private:
const int level;
};
class CompressionCodecFactory;
void registerCodecLZ4HC(CompressionCodecFactory & factory);
}