2018-08-07 17:57:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/Context.h>
|
2018-08-10 14:46:12 +00:00
|
|
|
#include <Poco/Logger.h>
|
|
|
|
#include <daemon/BaseDaemon.h>
|
2018-08-07 17:57:44 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2018-08-10 14:46:12 +00:00
|
|
|
/** Class represents clickhouse-odbc-bridge server, which listen
|
|
|
|
* incoming HTTP POST and GET requests on specified port and host.
|
|
|
|
* Has two handlers '/' for all incoming POST requests to ODBC driver
|
|
|
|
* and /ping for GET request about service status
|
|
|
|
*/
|
2018-08-07 17:57:44 +00:00
|
|
|
class ODBCBridge : public BaseDaemon
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void defineOptions(Poco::Util::OptionSet & options) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void initialize(Application & self) override;
|
|
|
|
|
|
|
|
void uninitialize() override;
|
|
|
|
|
|
|
|
int main(const std::vector<std::string> & args) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void handleHelp(const std::string &, const std::string &);
|
|
|
|
|
|
|
|
bool is_help;
|
|
|
|
std::string hostname;
|
2018-08-14 10:33:41 +00:00
|
|
|
size_t port;
|
2018-08-07 17:57:44 +00:00
|
|
|
size_t http_timeout;
|
|
|
|
std::string log_level;
|
|
|
|
size_t max_server_connections;
|
|
|
|
size_t keep_alive_timeout;
|
|
|
|
|
|
|
|
Poco::Logger * log;
|
|
|
|
|
|
|
|
std::shared_ptr<Context> context; /// need for settings only
|
|
|
|
};
|
|
|
|
}
|