1 | #pragma once |
---|---|
2 | |
3 | #include <IO/WriteBuffer.h> |
4 | #include <IO/BufferWithOwnMemory.h> |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | class BrotliWriteBuffer : public BufferWithOwnMemory<WriteBuffer> |
10 | { |
11 | public: |
12 | BrotliWriteBuffer( |
13 | WriteBuffer & out_, |
14 | int compression_level, |
15 | size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE, |
16 | char * existing_memory = nullptr, |
17 | size_t alignment = 0); |
18 | |
19 | ~BrotliWriteBuffer() override; |
20 | |
21 | void finish(); |
22 | |
23 | private: |
24 | void nextImpl() override; |
25 | |
26 | class BrotliStateWrapper; |
27 | std::unique_ptr<BrotliStateWrapper> brotli; |
28 | |
29 | size_t in_available; |
30 | const uint8_t * in_data; |
31 | |
32 | size_t out_capacity; |
33 | uint8_t * out_data; |
34 | |
35 | WriteBuffer & out; |
36 | |
37 | bool finished = false; |
38 | }; |
39 | |
40 | } |
41 |