aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/ZstdInflatingReadBuffer.h
blob: faa6231d4e2cd3d8e9d6bfd79ae942626bb2b221 (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
#pragma once

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

#include <zstd.h>


namespace DB
{
namespace ErrorCodes
{
}

class ZstdInflatingReadBuffer : public CompressedReadBufferWrapper
{
public:
    explicit ZstdInflatingReadBuffer(
        std::unique_ptr<ReadBuffer> in_,
        size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
        char * existing_memory = nullptr,
        size_t alignment = 0,
        int zstd_window_log_max = 0);

    ~ZstdInflatingReadBuffer() override;

private:
    bool nextImpl() override;

    ZSTD_DCtx * dctx;
    ZSTD_inBuffer input;
    ZSTD_outBuffer output;
    bool eof_flag = false;
};

}