ClickHouse/dbms/src/IO/ReadBufferFromHDFS.h

30 lines
701 B
C++
Raw Normal View History

2018-11-19 08:17:09 +00:00
#pragma once
#include <Common/config.h>
#if USE_HDFS
2018-11-19 08:17:09 +00:00
#include <IO/ReadBuffer.h>
#include <IO/BufferWithOwnMemory.h>
2018-12-27 15:23:37 +00:00
#include <string>
2019-01-17 11:26:29 +00:00
#include <memory>
2018-11-19 08:17:09 +00:00
namespace DB
{
2019-01-17 11:26:29 +00:00
/** Accepts path to file and opens it, or pre-opened file descriptor.
* Closes file by himself (thus "owns" a file descriptor).
*/
class ReadBufferFromHDFS : public BufferWithOwnMemory<ReadBuffer>
{
struct ReadBufferFromHDFSImpl;
std::unique_ptr<ReadBufferFromHDFSImpl> impl;
public:
ReadBufferFromHDFS(const std::string & hdfs_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE);
ReadBufferFromHDFS(ReadBufferFromHDFS &&) = default;
2018-11-19 08:17:09 +00:00
2019-01-17 11:26:29 +00:00
bool nextImpl() override;
2018-11-19 08:17:09 +00:00
2019-01-17 11:26:29 +00:00
~ReadBufferFromHDFS() override;
};
2018-11-19 08:17:09 +00:00
}
#endif