summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/cluster_get_shard_map_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_get_shard_map_cmd.cpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
index cd5ee8608fe..0fcdc77d6fc 100644
--- a/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
+++ b/src/mongo/s/commands/cluster_get_shard_map_cmd.cpp
@@ -38,50 +38,51 @@
namespace mongo {
namespace {
- class CmdGetShardMap : public Command {
- public:
- CmdGetShardMap() : Command("getShardMap") { }
+class CmdGetShardMap : public Command {
+public:
+ CmdGetShardMap() : Command("getShardMap") {}
- virtual bool isWriteCommandForConfigServer() const {
- return false;
- }
+ virtual bool isWriteCommandForConfigServer() const {
+ return false;
+ }
- virtual bool slaveOk() const {
- return true;
- }
+ virtual bool slaveOk() const {
+ return true;
+ }
- virtual void help(std::stringstream& help) const {
- help << "lists the set of shards known to this instance";
- }
+ virtual void help(std::stringstream& help) const {
+ help << "lists the set of shards known to this instance";
+ }
- virtual bool adminOnly() const { return true; }
+ virtual bool adminOnly() const {
+ return true;
+ }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) {
- ActionSet actions;
- actions.addAction(ActionType::getShardMap);
- out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
- }
+ virtual void addRequiredPrivileges(const std::string& dbname,
+ const BSONObj& cmdObj,
+ std::vector<Privilege>* out) {
+ ActionSet actions;
+ actions.addAction(ActionType::getShardMap);
+ out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
+ }
- virtual bool run(OperationContext* txn,
- const std::string& dbname,
- BSONObj& cmdObj,
- int options,
- std::string& errmsg,
- BSONObjBuilder& result) {
-
- // MongoD instances do not know that they are part of a sharded cluster until they
- // receive a setShardVersion command and that's when the catalog manager and the shard
- // registry get initialized.
- if (grid.shardRegistry()) {
- grid.shardRegistry()->toBSON(&result);
- }
-
- return true;
+ virtual bool run(OperationContext* txn,
+ const std::string& dbname,
+ BSONObj& cmdObj,
+ int options,
+ std::string& errmsg,
+ BSONObjBuilder& result) {
+ // MongoD instances do not know that they are part of a sharded cluster until they
+ // receive a setShardVersion command and that's when the catalog manager and the shard
+ // registry get initialized.
+ if (grid.shardRegistry()) {
+ grid.shardRegistry()->toBSON(&result);
}
- } getShardMapCmd;
+ return true;
+ }
+
+} getShardMapCmd;
-} // namespace
-} // namespace mongo
+} // namespace
+} // namespace mongo