ClickHouse/programs/server/Server.h

63 lines
1.3 KiB
C++
Raw Normal View History

2012-03-09 03:06:09 +00:00
#pragma once
2017-08-09 11:57:09 +00:00
#include "IServer.h"
#include <daemon/BaseDaemon.h>
2012-03-09 03:06:09 +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
{
2017-08-09 11:57:09 +00:00
class Server : public BaseDaemon, public IServer
2012-03-09 03:06:09 +00:00
{
public:
2019-02-02 13:17:55 +00:00
using ServerApplication::run;
2017-08-09 11:57:09 +00:00
Poco::Util::LayeredConfiguration & config() const override
{
return BaseDaemon::config();
}
Poco::Logger & logger() const override
{
return BaseDaemon::logger();
}
Context & context() const override
{
2020-04-17 12:58:52 +00:00
return *global_context_ptr;
2017-08-09 11:57:09 +00:00
}
2015-10-05 01:26:43 +00:00
2017-08-09 14:33:07 +00:00
bool isCancelled() const override
{
return BaseDaemon::isCancelled();
}
2019-02-02 13:17:55 +00:00
void defineOptions(Poco::Util::OptionSet & _options) override;
protected:
2019-02-02 13:17:55 +00:00
int run() override;
void initialize(Application & self) override;
2015-10-05 01:26:43 +00:00
void uninitialize() override;
2012-03-09 03:06:09 +00:00
int main(const std::vector<std::string> & args) override;
std::string getDefaultCorePath() const override;
2017-08-09 11:57:09 +00:00
private:
2020-04-17 12:58:52 +00:00
Context * global_context_ptr = nullptr;
2012-03-09 03:06:09 +00:00
};
}