2022-08-08 14:04:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <IO/ReadWriteBufferFromHTTP.h>
|
|
|
|
#include <Poco/Logger.h>
|
|
|
|
#include <Poco/Net/HTTPRequest.h>
|
|
|
|
#include <Poco/URI.h>
|
|
|
|
#include <BridgeHelper/IBridgeHelper.h>
|
2022-08-08 14:40:19 +00:00
|
|
|
#include <Common/BridgeProtocolVersion.h>
|
2022-08-08 14:04:41 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
// Common base class to access the clickhouse-library-bridge.
|
|
|
|
class LibraryBridgeHelper : public IBridgeHelper
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
explicit LibraryBridgeHelper(ContextPtr context_);
|
|
|
|
|
|
|
|
void startBridge(std::unique_ptr<ShellCommand> cmd) const override;
|
|
|
|
|
|
|
|
String serviceAlias() const override { return "clickhouse-library-bridge"; }
|
|
|
|
|
|
|
|
String serviceFileName() const override { return serviceAlias(); }
|
|
|
|
|
2022-10-07 10:46:45 +00:00
|
|
|
unsigned getDefaultPort() const override { return DEFAULT_PORT; }
|
2022-08-08 14:04:41 +00:00
|
|
|
|
|
|
|
bool startBridgeManually() const override { return false; }
|
|
|
|
|
|
|
|
String configPrefix() const override { return "library_bridge"; }
|
|
|
|
|
|
|
|
const Poco::Util::AbstractConfiguration & getConfig() const override { return config; }
|
|
|
|
|
2024-01-23 17:04:50 +00:00
|
|
|
LoggerPtr getLog() const override { return log; }
|
2022-08-08 14:04:41 +00:00
|
|
|
|
|
|
|
Poco::Timespan getHTTPTimeout() const override { return http_timeout; }
|
|
|
|
|
|
|
|
Poco::URI createBaseURI() const override;
|
|
|
|
|
2024-05-19 08:34:59 +00:00
|
|
|
static constexpr size_t DEFAULT_PORT = 9012;
|
2022-08-08 14:04:41 +00:00
|
|
|
|
|
|
|
const Poco::Util::AbstractConfiguration & config;
|
2024-01-23 17:04:50 +00:00
|
|
|
LoggerPtr log;
|
2022-08-08 14:04:41 +00:00
|
|
|
const Poco::Timespan http_timeout;
|
|
|
|
std::string bridge_host;
|
|
|
|
size_t bridge_port;
|
|
|
|
ConnectionTimeouts http_timeouts;
|
|
|
|
Poco::Net::HTTPBasicCredentials credentials{};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|