aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/Lz4InflatingReadBuffer.h
blob: 46bdc406709ce63ebc916ba40bfdd0306309c70f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <IO/CompressedReadBufferWrapper.h>
#include <IO/CompressionMethod.h>
#include <IO/ReadBuffer.h>

#include <lz4.h>
#include <lz4frame.h>


namespace DB
{

class Lz4InflatingReadBuffer : public CompressedReadBufferWrapper
{
public:
    explicit 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;

    LZ4F_dctx* dctx;

    void * in_data;
    void * out_data;

    size_t in_available;
    size_t out_available;

    bool eof_flag = false;
};

}