diff options
author | Kshitij Gupta <kshitij.gupta@mongodb.com> | 2022-11-28 16:02:16 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-28 17:21:57 +0000 |
commit | 58ca1f5602bf79eb2807ebcc5a8b70f3e89a346c (patch) | |
tree | a352819943a0d306d10888615a47ad1a2229a809 | |
parent | 2a8e136b7a5b81149c05847a5561c75f34ba50fc (diff) | |
download | mongo-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.h | 31 |
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 |