2022-08-08 14:04:41 +00:00
|
|
|
#include "LibraryBridgeHelper.h"
|
|
|
|
|
2023-02-03 10:54:49 +00:00
|
|
|
#include <IO/ConnectionTimeouts.h>
|
2023-01-31 15:11:32 +00:00
|
|
|
|
2022-08-08 14:04:41 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
LibraryBridgeHelper::LibraryBridgeHelper(ContextPtr context_)
|
|
|
|
: IBridgeHelper(context_)
|
|
|
|
, config(context_->getConfigRef())
|
|
|
|
, log(&Poco::Logger::get("LibraryBridgeHelper"))
|
|
|
|
, http_timeout(context_->getGlobalContext()->getSettingsRef().http_receive_timeout.value)
|
|
|
|
, bridge_host(config.getString("library_bridge.host", DEFAULT_HOST))
|
|
|
|
, bridge_port(config.getUInt("library_bridge.port", DEFAULT_PORT))
|
2023-02-07 12:10:26 +00:00
|
|
|
, http_timeouts(ConnectionTimeouts::getHTTPTimeouts(context_->getSettingsRef(), {context_->getConfigRef().getUInt("keep_alive_timeout", DEFAULT_HTTP_KEEP_ALIVE_TIMEOUT), 0}))
|
2022-08-08 14:04:41 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LibraryBridgeHelper::startBridge(std::unique_ptr<ShellCommand> cmd) const
|
|
|
|
{
|
|
|
|
getContext()->addBridgeCommand(std::move(cmd));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Poco::URI LibraryBridgeHelper::createBaseURI() const
|
|
|
|
{
|
|
|
|
Poco::URI uri;
|
|
|
|
uri.setHost(bridge_host);
|
|
|
|
uri.setPort(bridge_port);
|
|
|
|
uri.setScheme("http");
|
|
|
|
return uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|