| 41 | } |
| 42 | |
| 43 | bool ServerType::shouldStart(Type server_type, const std::string & server_custom_name) const |
| 44 | { |
| 45 | auto is_type_default = [](Type current_type) |
| 46 | { |
| 47 | switch (current_type) |
| 48 | { |
| 49 | case Type::TCP: |
| 50 | case Type::TCP_SSH: |
| 51 | case Type::TCP_WITH_PROXY: |
| 52 | case Type::TCP_SECURE: |
| 53 | case Type::HTTP: |
| 54 | case Type::HTTPS: |
| 55 | case Type::MYSQL: |
| 56 | case Type::GRPC: |
| 57 | case Type::POSTGRESQL: |
| 58 | case Type::PROMETHEUS: |
| 59 | case Type::INTERSERVER_HTTP: |
| 60 | case Type::INTERSERVER_HTTPS: |
| 61 | case Type::ARROW_FLIGHT: |
| 62 | return true; |
| 63 | default: |
| 64 | return false; |
| 65 | } |
| 66 | }; |
| 67 | |
| 68 | if (exclude_types.contains(Type::QUERIES_ALL)) |
| 69 | return false; |
| 70 | |
| 71 | if (exclude_types.contains(Type::QUERIES_DEFAULT) && is_type_default(server_type)) |
| 72 | return false; |
| 73 | |
| 74 | if (exclude_types.contains(Type::QUERIES_CUSTOM) && server_type == Type::CUSTOM) |
| 75 | return false; |
| 76 | |
| 77 | if (exclude_types.contains(server_type)) |
| 78 | { |
| 79 | if (server_type != Type::CUSTOM) |
| 80 | return false; |
| 81 | |
| 82 | if (exclude_custom_names.contains(server_custom_name)) |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | if (type == Type::QUERIES_ALL) |
| 87 | return true; |
| 88 | |
| 89 | if (type == Type::QUERIES_DEFAULT) |
| 90 | return is_type_default(server_type); |
| 91 | |
| 92 | if (type == Type::QUERIES_CUSTOM) |
| 93 | return server_type == Type::CUSTOM; |
| 94 | |
| 95 | if (type == Type::CUSTOM) |
| 96 | return server_type == type && server_custom_name == custom_name; |
| 97 | |
| 98 | return server_type == type; |
| 99 | } |
| 100 |
no test coverage detected