mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 10:52:30 +00:00
50 lines
1.0 KiB
C++
50 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "config.h"
|
|
|
|
#if USE_HDFS
|
|
#include <IO/WriteBuffer.h>
|
|
#include <IO/WriteSettings.h>
|
|
#include <IO/WriteBufferFromFileBase.h>
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
|
#include <fcntl.h>
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
/** Accepts HDFS path to file and opens it.
|
|
* Closes file by himself (thus "owns" a file descriptor).
|
|
*/
|
|
class WriteBufferFromHDFS final : public WriteBufferFromFileBase
|
|
{
|
|
|
|
public:
|
|
WriteBufferFromHDFS(
|
|
const String & hdfs_name_,
|
|
const Poco::Util::AbstractConfiguration & config_,
|
|
int replication_,
|
|
const WriteSettings & write_settings_ = {},
|
|
size_t buf_size_ = DBMS_DEFAULT_BUFFER_SIZE,
|
|
int flags = O_WRONLY);
|
|
|
|
~WriteBufferFromHDFS() override;
|
|
|
|
void nextImpl() override;
|
|
|
|
void sync() override;
|
|
|
|
std::string getFileName() const override { return filename; }
|
|
|
|
private:
|
|
void finalizeImpl() override;
|
|
|
|
struct WriteBufferFromHDFSImpl;
|
|
std::unique_ptr<WriteBufferFromHDFSImpl> impl;
|
|
const std::string filename;
|
|
};
|
|
|
|
}
|
|
#endif
|