2021-06-16 05:43:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
#include <IO/CompressionMethod.h>
|
|
|
|
#include <IO/ReadBuffer.h>
|
|
|
|
|
2021-06-17 08:31:37 +00:00
|
|
|
#include <lz4.h>
|
2021-07-06 23:56:33 +00:00
|
|
|
#include <lz4frame.h>
|
2021-06-17 08:31:37 +00:00
|
|
|
|
2021-06-16 05:43:07 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Lz4InflatingReadBuffer : public BufferWithOwnMemory<ReadBuffer>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Lz4InflatingReadBuffer(
|
|
|
|
std::unique_ptr<ReadBuffer> in_,
|
|
|
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
|
|
|
char * existing_memory = nullptr,
|
|
|
|
size_t alignment = 0);
|
|
|
|
|
|
|
|
~Lz4InflatingReadBuffer() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool nextImpl() override;
|
|
|
|
|
|
|
|
std::unique_ptr<ReadBuffer> in;
|
2021-07-06 23:56:33 +00:00
|
|
|
|
2021-08-19 08:42:56 +00:00
|
|
|
LZ4F_dctx* dctx;
|
2021-07-06 23:56:33 +00:00
|
|
|
|
2021-08-19 08:42:56 +00:00
|
|
|
void * in_data;
|
|
|
|
void * out_data;
|
2021-07-06 23:56:33 +00:00
|
|
|
|
|
|
|
size_t in_available;
|
2021-08-19 08:42:56 +00:00
|
|
|
size_t out_available;
|
2021-07-06 23:56:33 +00:00
|
|
|
|
|
|
|
bool eof = false;
|
2021-06-16 05:43:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|