mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
495c6e03aa
* Replace all Context references with std::weak_ptr * Fix shared context captured by value * Fix build * Fix Context with named sessions * Fix copy context * Fix gcc build * Merge with master and fix build * Fix gcc-9 build
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <Interpreters/Context.h>
|
|
#include <Server/HTTP/HTTPRequestHandlerFactory.h>
|
|
#include <daemon/BaseDaemon.h>
|
|
|
|
#include <Poco/Logger.h>
|
|
#include <Poco/Util/ServerApplication.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Class represents base for clickhouse-odbc-bridge and clickhouse-library-bridge servers.
|
|
/// Listens to incoming HTTP POST and GET requests on specified port and host.
|
|
/// Has two handlers '/' for all incoming POST requests and /ping for GET request about service status.
|
|
class IBridge : public BaseDaemon
|
|
{
|
|
|
|
public:
|
|
/// Define command line arguments
|
|
void defineOptions(Poco::Util::OptionSet & options) override;
|
|
|
|
protected:
|
|
using HandlerFactoryPtr = std::shared_ptr<HTTPRequestHandlerFactory>;
|
|
|
|
void initialize(Application & self) override;
|
|
|
|
void uninitialize() override;
|
|
|
|
int main(const std::vector<std::string> & args) override;
|
|
|
|
virtual std::string bridgeName() const = 0;
|
|
|
|
virtual HandlerFactoryPtr getHandlerFactoryPtr(ContextPtr context) const = 0;
|
|
|
|
size_t keep_alive_timeout;
|
|
|
|
private:
|
|
void handleHelp(const std::string &, const std::string &);
|
|
|
|
bool is_help;
|
|
std::string hostname;
|
|
size_t port;
|
|
std::string log_level;
|
|
size_t max_server_connections;
|
|
size_t http_timeout;
|
|
|
|
Poco::Logger * log;
|
|
};
|
|
}
|