1 | #pragma once |
---|---|
2 | |
3 | #include <Common/config.h> |
4 | |
5 | #if USE_HDFS |
6 | #include <IO/WriteBuffer.h> |
7 | #include <IO/BufferWithOwnMemory.h> |
8 | #include <string> |
9 | #include <memory> |
10 | |
11 | namespace DB |
12 | { |
13 | /** Accepts HDFS path to file and opens it. |
14 | * Closes file by himself (thus "owns" a file descriptor). |
15 | */ |
16 | class WriteBufferFromHDFS : public BufferWithOwnMemory<WriteBuffer> |
17 | { |
18 | struct WriteBufferFromHDFSImpl; |
19 | std::unique_ptr<WriteBufferFromHDFSImpl> impl; |
20 | public: |
21 | WriteBufferFromHDFS(const std::string & hdfs_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE); |
22 | WriteBufferFromHDFS(WriteBufferFromHDFS &&) = default; |
23 | |
24 | void nextImpl() override; |
25 | |
26 | ~WriteBufferFromHDFS() override; |
27 | |
28 | void sync() override; |
29 | }; |
30 | } |
31 | #endif |
32 |