1 | #pragma once |
2 | |
3 | #include <Interpreters/Context.h> |
4 | #include <Poco/Logger.h> |
5 | #include <daemon/BaseDaemon.h> |
6 | |
7 | namespace DB |
8 | { |
9 | /** Class represents clickhouse-odbc-bridge server, which listen |
10 | * incoming HTTP POST and GET requests on specified port and host. |
11 | * Has two handlers '/' for all incoming POST requests to ODBC driver |
12 | * and /ping for GET request about service status |
13 | */ |
14 | class ODBCBridge : public BaseDaemon |
15 | { |
16 | public: |
17 | void defineOptions(Poco::Util::OptionSet & options) override; |
18 | |
19 | protected: |
20 | void initialize(Application & self) override; |
21 | |
22 | void uninitialize() override; |
23 | |
24 | int main(const std::vector<std::string> & args) override; |
25 | |
26 | private: |
27 | void handleHelp(const std::string &, const std::string &); |
28 | |
29 | bool is_help; |
30 | std::string hostname; |
31 | size_t port; |
32 | size_t http_timeout; |
33 | std::string log_level; |
34 | size_t max_server_connections; |
35 | size_t keep_alive_timeout; |
36 | |
37 | Poco::Logger * log; |
38 | |
39 | std::shared_ptr<Context> context; /// need for settings only |
40 | }; |
41 | } |
42 | |