ClickHouse/dbms/include/DB/Storages/MergeTree/RemoteQueryExecutor.h

47 lines
1.0 KiB
C++
Raw Normal View History

2016-01-28 01:00:27 +00:00
#pragma once
#include <DB/Interpreters/InterserverIOHandler.h>
#include <DB/IO/WriteBuffer.h>
namespace DB
{
class Context;
namespace RemoteQueryExecutor
{
/** Сервис для выполнения SQL запросов.
*/
class Service final : public InterserverIOEndpoint
{
public:
Service(Context & context_);
Service(const Service &) = delete;
Service & operator=(const Service &) = delete;
std::string getId(const std::string & node_id) const override;
2016-03-01 17:47:53 +00:00
void processQuery(const Poco::Net::HTMLForm & params, ReadBuffer & body, WriteBuffer & out) override;
2016-01-28 01:00:27 +00:00
private:
Context & context;
};
/** Клиент для удалённого выполнения SQL запросов.
*/
class Client final
{
public:
Client() = default;
Client(const Client &) = delete;
Client & operator=(const Client &) = delete;
bool executeQuery(const InterserverIOEndpointLocation & location, const std::string & query);
void cancel() { is_cancelled = true; }
private:
std::atomic<bool> is_cancelled{false};
};
}
}