2012-03-09 03:06:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2013-08-10 09:21:09 +00:00
|
|
|
#include <Poco/URI.h>
|
|
|
|
|
2012-03-09 03:06:09 +00:00
|
|
|
#include <Poco/Util/LayeredConfiguration.h>
|
|
|
|
|
|
|
|
#include <Poco/Net/HTTPServer.h>
|
|
|
|
#include <Poco/Net/HTTPRequestHandlerFactory.h>
|
|
|
|
#include <Poco/Net/HTTPRequestHandler.h>
|
|
|
|
#include <Poco/Net/HTTPRequest.h>
|
|
|
|
#include <Poco/Net/HTTPServerParams.h>
|
|
|
|
#include <Poco/Net/HTTPServerRequest.h>
|
|
|
|
#include <Poco/Net/HTTPServerResponse.h>
|
2013-08-10 09:21:09 +00:00
|
|
|
#include <Poco/Net/HTMLForm.h>
|
2012-03-09 03:06:09 +00:00
|
|
|
|
2012-03-09 15:46:52 +00:00
|
|
|
#include <Poco/Net/TCPServer.h>
|
|
|
|
#include <Poco/Net/TCPServerConnectionFactory.h>
|
|
|
|
#include <Poco/Net/TCPServerConnection.h>
|
|
|
|
|
2015-09-29 19:19:54 +00:00
|
|
|
#include <common/logger_useful.h>
|
2016-02-09 17:06:50 +00:00
|
|
|
#include <daemon/BaseDaemon.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/HTMLForm.h>
|
2012-03-09 03:06:09 +00:00
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2012-03-09 03:06:09 +00:00
|
|
|
|
2016-07-30 01:08:00 +00:00
|
|
|
/** Server provides three interfaces:
|
|
|
|
* 1. HTTP - simple interface for any applications.
|
|
|
|
* 2. TCP - interface for native clickhouse-client and for server to server internal communications.
|
|
|
|
* More rich and efficient, but less compatible
|
|
|
|
* - data is transferred by columns;
|
|
|
|
* - data is transferred compressed;
|
|
|
|
* Allows to get more information in response.
|
|
|
|
* 3. Interserver HTTP - for replication.
|
2012-03-09 03:06:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-02-09 17:06:50 +00:00
|
|
|
class Server : public BaseDaemon
|
2012-03-09 03:06:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
/// Global settings of server.
|
|
|
|
std::unique_ptr<Context> global_context;
|
2015-10-05 01:26:43 +00:00
|
|
|
|
2014-07-21 11:21:09 +00:00
|
|
|
protected:
|
2017-04-01 07:20:54 +00:00
|
|
|
void initialize(Application & self) override
|
|
|
|
{
|
|
|
|
BaseDaemon::initialize(self);
|
|
|
|
logger().information("starting up");
|
|
|
|
}
|
2015-10-05 01:26:43 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void uninitialize() override
|
|
|
|
{
|
|
|
|
logger().information("shutting down");
|
|
|
|
BaseDaemon::uninitialize();
|
|
|
|
}
|
2012-03-09 03:06:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
int main(const std::vector<std::string> & args) override;
|
2016-10-24 14:01:24 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string getDefaultCorePath() const override;
|
2012-03-09 03:06:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|