ClickHouse/src/Server/ServerType.h

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

62 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <base/types.h>
#include <unordered_set>
2023-08-10 22:55:57 +00:00
namespace DB
{
class ServerType
{
public:
enum Type
{
TCP_WITH_PROXY,
TCP_SECURE,
2023-12-04 19:13:53 +00:00
TCP,
HTTP,
HTTPS,
MYSQL,
GRPC,
POSTGRESQL,
PROMETHEUS,
CUSTOM,
INTERSERVER_HTTP,
INTERSERVER_HTTPS,
QUERIES_ALL,
QUERIES_DEFAULT,
QUERIES_CUSTOM,
CLOUD,
END
};
using Types = std::unordered_set<Type>;
using CustomNames = std::unordered_set<String>;
ServerType() = default;
explicit ServerType(
Type type_,
const std::string & custom_name_ = "",
const Types & exclude_types_ = {},
const CustomNames exclude_custom_names_ = {})
: type(type_),
custom_name(custom_name_),
exclude_types(exclude_types_),
exclude_custom_names(exclude_custom_names_) {}
static const char * serverTypeToString(Type type);
2023-07-27 19:12:06 +00:00
/// Checks whether provided in the arguments type should be started or stopped based on current server type.
bool shouldStart(Type server_type, const std::string & server_custom_name = "") const;
bool shouldStop(const std::string & port_name) const;
Type type;
std::string custom_name;
Types exclude_types;
CustomNames exclude_custom_names;
};
}