ClickHouse/programs/keeper/Keeper.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.5 KiB
C++
Raw Normal View History

2021-05-12 10:39:07 +00:00
#pragma once
#include <Server/IServer.h>
2022-04-27 15:05:45 +00:00
#include <Daemon/BaseDaemon.h>
2022-03-03 20:27:46 +00:00
#include "TinyContext.h"
2021-05-12 10:39:07 +00:00
namespace Poco
{
namespace Net
{
class ServerSocket;
}
}
namespace DB
{
2021-05-17 09:00:31 +00:00
/// standalone clickhouse-keeper server (replacement for ZooKeeper). Uses the same
2021-05-17 08:58:42 +00:00
/// config as clickhouse-server. Serves requests on TCP ports with or without
/// SSL using ZooKeeper protocol.
2022-03-03 20:27:46 +00:00
class Keeper : public BaseDaemon
2021-05-12 10:39:07 +00:00
{
public:
using ServerApplication::run;
2022-03-03 20:27:46 +00:00
Poco::Util::LayeredConfiguration & config() const
2021-05-12 10:39:07 +00:00
{
return BaseDaemon::config();
}
2022-03-03 20:27:46 +00:00
Poco::Logger & logger() const
2021-05-12 10:39:07 +00:00
{
return BaseDaemon::logger();
}
2022-03-03 20:27:46 +00:00
bool isCancelled() const
2021-05-12 10:39:07 +00:00
{
return BaseDaemon::isCancelled();
}
void defineOptions(Poco::Util::OptionSet & _options) override;
protected:
2021-05-12 13:04:34 +00:00
void logRevision() const override;
2022-04-08 07:18:18 +00:00
void handleCustomArguments(const std::string & arg, const std::string & value);
2021-05-12 10:39:07 +00:00
int run() override;
void initialize(Application & self) override;
void uninitialize() override;
int main(const std::vector<std::string> & args) override;
2021-05-12 13:04:34 +00:00
std::string getDefaultConfigFileName() const override;
2021-05-12 10:39:07 +00:00
private:
2022-03-03 20:27:46 +00:00
TinyContext tiny_context;
2021-05-12 10:39:07 +00:00
Poco::Net::SocketAddress socketBindListen(Poco::Net::ServerSocket & socket, const std::string & host, UInt16 port, [[maybe_unused]] bool secure = false) const;
using CreateServerFunc = std::function<void(UInt16)>;
void createServer(const std::string & listen_host, const char * port_name, bool listen_try, CreateServerFunc && func) const;
};
}