2019-01-17 14:10:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Common/config.h>
|
|
|
|
|
|
|
|
#if USE_HDFS
|
|
|
|
#include <IO/WriteBuffer.h>
|
|
|
|
#include <IO/BufferWithOwnMemory.h>
|
|
|
|
#include <string>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2019-01-18 10:57:00 +00:00
|
|
|
/** Accepts HDFS path to file and opens it.
|
2019-01-17 14:10:30 +00:00
|
|
|
* Closes file by himself (thus "owns" a file descriptor).
|
|
|
|
*/
|
|
|
|
class WriteBufferFromHDFS : public BufferWithOwnMemory<WriteBuffer>
|
|
|
|
{
|
|
|
|
struct WriteBufferFromHDFSImpl;
|
|
|
|
std::unique_ptr<WriteBufferFromHDFSImpl> impl;
|
|
|
|
public:
|
|
|
|
WriteBufferFromHDFS(const std::string & hdfs_name_, size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE);
|
|
|
|
WriteBufferFromHDFS(WriteBufferFromHDFS &&) = default;
|
|
|
|
|
|
|
|
void nextImpl() override;
|
|
|
|
|
|
|
|
~WriteBufferFromHDFS() override;
|
|
|
|
|
2019-11-19 17:11:13 +00:00
|
|
|
void sync() override;
|
2019-01-17 14:10:30 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|