ClickHouse/src/Compression/CompressionCodecNone.cpp

45 lines
1.1 KiB
C++
Raw Normal View History

2018-10-11 02:57:48 +00:00
#include <Compression/CompressionCodecNone.h>
#include <Compression/CompressionInfo.h>
2018-10-11 02:57:48 +00:00
#include <Compression/CompressionFactory.h>
#include <Parsers/ASTIdentifier.h>
2018-10-11 02:57:48 +00:00
namespace DB
{
2020-09-14 19:15:25 +00:00
CompressionCodecNone::CompressionCodecNone()
2018-10-11 02:57:48 +00:00
{
2020-09-14 19:15:25 +00:00
setCodecDescription("NONE");
2018-10-11 02:57:48 +00:00
}
2020-09-14 19:15:25 +00:00
uint8_t CompressionCodecNone::getMethodByte() const
2018-10-11 02:57:48 +00:00
{
2020-09-14 19:15:25 +00:00
return static_cast<uint8_t>(CompressionMethodByte::NONE);
2018-10-11 02:57:48 +00:00
}
void CompressionCodecNone::updateHash(SipHash & hash) const
{
getCodecDesc()->updateTreeHash(hash);
}
2018-12-19 17:20:18 +00:00
UInt32 CompressionCodecNone::doCompressData(const char * source, UInt32 source_size, char * dest) const
2018-10-11 02:57:48 +00:00
{
memcpy(dest, source, source_size);
return source_size;
}
2018-12-19 17:20:18 +00:00
void CompressionCodecNone::doDecompressData(const char * source, UInt32 /*source_size*/, char * dest, UInt32 uncompressed_size) const
2018-10-11 02:57:48 +00:00
{
2018-12-19 17:20:18 +00:00
memcpy(dest, source, uncompressed_size);
2018-10-11 02:57:48 +00:00
}
void registerCodecNone(CompressionCodecFactory & factory)
{
2018-12-24 14:10:37 +00:00
factory.registerSimpleCompressionCodec("NONE", static_cast<char>(CompressionMethodByte::NONE), [&] ()
{
2018-10-11 02:57:48 +00:00
return std::make_shared<CompressionCodecNone>();
});
}
2018-12-18 13:08:22 +00:00
}