1 | #pragma once |
---|---|
2 | |
3 | #include <Common/config.h> |
4 | |
5 | #if USE_HDFS |
6 | #include <IO/ReadBuffer.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 ReadBufferFromHDFS : public BufferWithOwnMemory<ReadBuffer> |
17 | { |
18 | struct ReadBufferFromHDFSImpl; |
19 | std::unique_ptr<ReadBufferFromHDFSImpl> impl; |
20 | public: |
21 | ReadBufferFromHDFS(const std::string & hdfs_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE); |
22 | ReadBufferFromHDFS(ReadBufferFromHDFS &&) = default; |
23 | |
24 | bool nextImpl() override; |
25 | |
26 | ~ReadBufferFromHDFS() override; |
27 | }; |
28 | } |
29 | #endif |
30 |