mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <Core/Block.h>
|
|
#include <DataStreams/IBlockOutputStream.h>
|
|
#include <Common/Throttler.h>
|
|
#include <IO/ConnectionTimeouts.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class Connection;
|
|
class ReadBuffer;
|
|
struct Settings;
|
|
|
|
|
|
/** Allow to execute INSERT query on remote server and send data for it.
|
|
*/
|
|
class RemoteBlockOutputStream : public IBlockOutputStream
|
|
{
|
|
public:
|
|
RemoteBlockOutputStream(Connection & connection_,
|
|
const ConnectionTimeouts & timeouts,
|
|
const String & query_,
|
|
const Settings * settings_ = nullptr,
|
|
const ClientInfo * client_info_ = nullptr);
|
|
|
|
Block getHeader() const override { return header; }
|
|
|
|
void write(const Block & block) override;
|
|
void writeSuffix() override;
|
|
|
|
/// Send pre-serialized and possibly pre-compressed block of data, that will be read from 'input'.
|
|
void writePrepared(ReadBuffer & input, size_t size = 0);
|
|
|
|
~RemoteBlockOutputStream() override;
|
|
|
|
private:
|
|
Connection & connection;
|
|
String query;
|
|
const Settings * settings;
|
|
const ClientInfo * client_info;
|
|
Block header;
|
|
bool finished = false;
|
|
};
|
|
|
|
}
|