summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKshitij Gupta <kshitij.gupta@mongodb.com>2022-11-28 16:02:16 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-28 17:21:57 +0000
commit58ca1f5602bf79eb2807ebcc5a8b70f3e89a346c (patch)
treea352819943a0d306d10888615a47ad1a2229a809
parent2a8e136b7a5b81149c05847a5561c75f34ba50fc (diff)
downloadmongo-58ca1f5602bf79eb2807ebcc5a8b70f3e89a346c.tar.gz
SERVER-71593: ClusterRole can take on both shard server and config server values concurrently.
-rw-r--r--src/mongo/db/server_options.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index c9b9441e65e..d0984325bf4 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -43,7 +43,36 @@ namespace mongo {
const int DEFAULT_UNIX_PERMS = 0700;
constexpr size_t DEFAULT_MAX_CONN = 1000000;
-enum class ClusterRole { None, ShardServer, ConfigServer };
+class ClusterRole {
+public:
+ enum Value : uint8_t {
+ None = 0,
+ ShardServer = 1 << 0,
+ ConfigServer = 1 << 1,
+ };
+
+ ClusterRole(Value v = ClusterRole::None) : _value(v) {}
+
+ ClusterRole& operator=(const ClusterRole& rhs) {
+ _value = rhs._value;
+ return *this;
+ }
+
+ constexpr bool operator==(const ClusterRole& other) const {
+ return _value == other._value;
+ }
+
+ constexpr bool operator!=(const ClusterRole& other) const {
+ return _value != other._value;
+ }
+
+ constexpr bool is(const ClusterRole& other) const {
+ return (_value & other._value) != 0;
+ }
+
+private:
+ Value _value;
+};
struct ServerGlobalParams {
std::string binaryName; // mongod or mongos