ClickHouse/src/BridgeHelper/LibraryBridgeHelper.cpp
Robert Schulze e584d1276b
Factorize generic code from ExternalDictLibBridgeHelper into base class
- When catboost will be added into library-bridge later on, a lot of
  code will need to be duplicated.

- Avoid that by factorizing stuff which is not specific to external
  dictionaries for reuse into a common base class.

- This is a refactoring without semantic change.
2022-08-08 17:16:46 +00:00

35 lines
865 B
C++

#include "LibraryBridgeHelper.h"
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))
, http_timeouts(ConnectionTimeouts::getHTTPTimeouts(context_))
{
}
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;
}
}