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

#include "clickhouse_config.h"

#if USE_SNAPPY

#include <IO/ReadBuffer.h>
#include <IO/SeekableReadBuffer.h>
#include <IO/BufferWithOwnMemory.h>

namespace DB
{
class SnappyReadBuffer : public BufferWithOwnMemory<SeekableReadBuffer>
{
public:
    explicit SnappyReadBuffer(
        std::unique_ptr<ReadBuffer> in_,
        size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
        char * existing_memory = nullptr,
        size_t alignment = 0);

    ~SnappyReadBuffer() override;

    bool nextImpl() override;
    off_t seek(off_t off, int whence) override;
    off_t getPosition() override;

private:
    std::unique_ptr<ReadBuffer> in;
    String compress_buffer;
    String uncompress_buffer;
};

}
#endif