summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog/replset/catalog_manager_replica_set.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/catalog/replset/catalog_manager_replica_set.h')
-rw-r--r--src/mongo/s/catalog/replset/catalog_manager_replica_set.h150
1 files changed, 73 insertions, 77 deletions
diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set.h b/src/mongo/s/catalog/replset/catalog_manager_replica_set.h
index 9b85640d1fb..c4b93093c26 100644
--- a/src/mongo/s/catalog/replset/catalog_manager_replica_set.h
+++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set.h
@@ -39,115 +39,111 @@
namespace mongo {
+/**
+ * Implements the catalog manager for talking to replica set config servers.
+ */
+class CatalogManagerReplicaSet final : public CatalogManager {
+public:
+ CatalogManagerReplicaSet();
+ virtual ~CatalogManagerReplicaSet();
+
/**
- * Implements the catalog manager for talking to replica set config servers.
+ * Initializes the catalog manager.
+ * Can only be called once for the lifetime of the catalog manager.
+ * TODO(spencer): Take pointer to ShardRegistry rather than getting it from the global
+ * "grid" object.
*/
- class CatalogManagerReplicaSet final : public CatalogManager {
- public:
- CatalogManagerReplicaSet();
- virtual ~CatalogManagerReplicaSet();
-
- /**
- * Initializes the catalog manager.
- * Can only be called once for the lifetime of the catalog manager.
- * TODO(spencer): Take pointer to ShardRegistry rather than getting it from the global
- * "grid" object.
- */
- Status init(const ConnectionString& configCS,
- std::unique_ptr<DistLockManager> distLockManager);
-
- Status startup(bool upgrade) override;
+ Status init(const ConnectionString& configCS, std::unique_ptr<DistLockManager> distLockManager);
- ConnectionString connectionString() const override;
+ Status startup(bool upgrade) override;
- void shutDown() override;
+ ConnectionString connectionString() const override;
- Status enableSharding(const std::string& dbName) override;
+ void shutDown() override;
- Status shardCollection(const std::string& ns,
- const ShardKeyPattern& fieldsAndOrder,
- bool unique,
- std::vector<BSONObj>* initPoints,
- std::set<ShardId>* initShardsIds = nullptr) override;
+ Status enableSharding(const std::string& dbName) override;
- StatusWith<std::string> addShard(const std::string& name,
- const ConnectionString& shardConnectionString,
- const long long maxSize) override;
+ Status shardCollection(const std::string& ns,
+ const ShardKeyPattern& fieldsAndOrder,
+ bool unique,
+ std::vector<BSONObj>* initPoints,
+ std::set<ShardId>* initShardsIds = nullptr) override;
- StatusWith<ShardDrainingStatus> removeShard(OperationContext* txn,
- const std::string& name) override;
+ StatusWith<std::string> addShard(const std::string& name,
+ const ConnectionString& shardConnectionString,
+ const long long maxSize) override;
- Status createDatabase(const std::string& dbName) override;
+ StatusWith<ShardDrainingStatus> removeShard(OperationContext* txn,
+ const std::string& name) override;
- Status updateDatabase(const std::string& dbName, const DatabaseType& db) override;
+ Status createDatabase(const std::string& dbName) override;
- StatusWith<DatabaseType> getDatabase(const std::string& dbName) override;
+ Status updateDatabase(const std::string& dbName, const DatabaseType& db) override;
- Status updateCollection(const std::string& collNs, const CollectionType& coll) override;
+ StatusWith<DatabaseType> getDatabase(const std::string& dbName) override;
- StatusWith<CollectionType> getCollection(const std::string& collNs) override;
+ Status updateCollection(const std::string& collNs, const CollectionType& coll) override;
- Status getCollections(const std::string* dbName,
- std::vector<CollectionType>* collections) override;
+ StatusWith<CollectionType> getCollection(const std::string& collNs) override;
- Status dropCollection(const std::string& collectionNs) override;
+ Status getCollections(const std::string* dbName,
+ std::vector<CollectionType>* collections) override;
- Status getDatabasesForShard(const std::string& shardName,
- std::vector<std::string>* dbs) override;
+ Status dropCollection(const std::string& collectionNs) override;
- Status getChunks(const Query& query,
- int nToReturn,
- std::vector<ChunkType>* chunks) override;
+ Status getDatabasesForShard(const std::string& shardName,
+ std::vector<std::string>* dbs) override;
- Status getTagsForCollection(const std::string& collectionNs,
- std::vector<TagsType>* tags) override;
+ Status getChunks(const Query& query, int nToReturn, std::vector<ChunkType>* chunks) override;
- StatusWith<std::string> getTagForChunk(const std::string& collectionNs,
- const ChunkType& chunk) override;
+ Status getTagsForCollection(const std::string& collectionNs,
+ std::vector<TagsType>* tags) override;
- Status getAllShards(std::vector<ShardType>* shards) override;
+ StatusWith<std::string> getTagForChunk(const std::string& collectionNs,
+ const ChunkType& chunk) override;
- bool isShardHost(const ConnectionString& shardConnectionString) override;
+ Status getAllShards(std::vector<ShardType>* shards) override;
- bool runUserManagementWriteCommand(const std::string& commandName,
- const std::string& dbname,
- const BSONObj& cmdObj,
- BSONObjBuilder* result) override;
+ bool isShardHost(const ConnectionString& shardConnectionString) override;
- bool runUserManagementReadCommand(const std::string& dbname,
- const BSONObj& cmdObj,
- BSONObjBuilder* result) override;
+ bool runUserManagementWriteCommand(const std::string& commandName,
+ const std::string& dbname,
+ const BSONObj& cmdObj,
+ BSONObjBuilder* result) override;
- Status applyChunkOpsDeprecated(const BSONArray& updateOps,
- const BSONArray& preCondition) override;
+ bool runUserManagementReadCommand(const std::string& dbname,
+ const BSONObj& cmdObj,
+ BSONObjBuilder* result) override;
- void logAction(const ActionLogType& actionLog) override;
+ Status applyChunkOpsDeprecated(const BSONArray& updateOps,
+ const BSONArray& preCondition) override;
- void logChange(OperationContext* txn,
- const std::string& what,
- const std::string& ns,
- const BSONObj& detail) override;
+ void logAction(const ActionLogType& actionLog) override;
- StatusWith<SettingsType> getGlobalSettings(const std::string& key) override;
+ void logChange(OperationContext* txn,
+ const std::string& what,
+ const std::string& ns,
+ const BSONObj& detail) override;
- void writeConfigServerDirect(const BatchedCommandRequest& request,
- BatchedCommandResponse* response) override;
+ StatusWith<SettingsType> getGlobalSettings(const std::string& key) override;
- DistLockManager* getDistLockManager() override;
+ void writeConfigServerDirect(const BatchedCommandRequest& request,
+ BatchedCommandResponse* response) override;
- private:
+ DistLockManager* getDistLockManager() override;
- // Config server connection string
- ConnectionString _configServerConnectionString;
+private:
+ // Config server connection string
+ ConnectionString _configServerConnectionString;
- // Distribted lock manager singleton.
- std::unique_ptr<DistLockManager> _distLockManager;
+ // Distribted lock manager singleton.
+ std::unique_ptr<DistLockManager> _distLockManager;
- // protects _inShutdown
- std::mutex _mutex;
+ // protects _inShutdown
+ std::mutex _mutex;
- // True if shutDown() has been called. False, otherwise.
- bool _inShutdown = false;
- };
+ // True if shutDown() has been called. False, otherwise.
+ bool _inShutdown = false;
+};
-} // namespace mongo
+} // namespace mongo