summaryrefslogtreecommitdiff
path: root/src/mongo/s/client/shard.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/s/client/shard.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/s/client/shard.h')
-rw-r--r--src/mongo/s/client/shard.h179
1 files changed, 95 insertions, 84 deletions
diff --git a/src/mongo/s/client/shard.h b/src/mongo/s/client/shard.h
index e5140dcee7e..f0d5d7833c2 100644
--- a/src/mongo/s/client/shard.h
+++ b/src/mongo/s/client/shard.h
@@ -35,98 +35,109 @@
namespace mongo {
- class BSONObj;
- class RemoteCommandTargeter;
+class BSONObj;
+class RemoteCommandTargeter;
- using ShardId = std::string;
+using ShardId = std::string;
+/**
+ * Contains runtime information obtained from the shard.
+ */
+class ShardStatus {
+public:
+ ShardStatus(long long dataSizeBytes, const std::string& version);
+
+ long long dataSizeBytes() const {
+ return _dataSizeBytes;
+ }
+ const std::string& mongoVersion() const {
+ return _mongoVersion;
+ }
+
+ std::string toString() const;
+
+ bool operator<(const ShardStatus& other) const;
+
+private:
+ long long _dataSizeBytes;
+ std::string _mongoVersion;
+};
+
+class Shard;
+using ShardPtr = std::shared_ptr<Shard>;
+
+/*
+ * Maintains the targeting and command execution logic for a single shard. Performs polling of
+ * the shard (if replica set).
+ */
+class Shard {
+ MONGO_DISALLOW_COPYING(Shard);
+
+public:
/**
- * Contains runtime information obtained from the shard.
+ * Instantiates a new shard connection management object for the specified shard.
*/
- class ShardStatus {
- public:
- ShardStatus(long long dataSizeBytes, const std::string& version);
+ Shard(const ShardId& id,
+ const ConnectionString& connStr,
+ std::unique_ptr<RemoteCommandTargeter> targeter);
+
+ ~Shard();
+
+ const ShardId& getId() const {
+ return _id;
+ }
- long long dataSizeBytes() const { return _dataSizeBytes; }
- const std::string& mongoVersion() const { return _mongoVersion; }
+ const ConnectionString& getConnString() const {
+ return _cs;
+ }
- std::string toString() const;
+ RemoteCommandTargeter* getTargeter() const {
+ return _targeter.get();
+ }
- bool operator< (const ShardStatus& other) const;
+ BSONObj runCommand(const std::string& db, const std::string& simple) const;
+ BSONObj runCommand(const std::string& db, const BSONObj& cmd) const;
- private:
- long long _dataSizeBytes;
- std::string _mongoVersion;
- };
+ bool runCommand(const std::string& db, const std::string& simple, BSONObj& res) const;
+ bool runCommand(const std::string& db, const BSONObj& cmd, BSONObj& res) const;
- class Shard;
- using ShardPtr = std::shared_ptr<Shard>;
+ /**
+ * Returns metadata and stats for this shard.
+ */
+ ShardStatus getStatus() const;
- /*
- * Maintains the targeting and command execution logic for a single shard. Performs polling of
- * the shard (if replica set).
+ /**
+ * Returns a string description of this shard entry.
*/
- class Shard {
- MONGO_DISALLOW_COPYING(Shard);
- public:
- /**
- * Instantiates a new shard connection management object for the specified shard.
- */
- Shard(const ShardId& id,
- const ConnectionString& connStr,
- std::unique_ptr<RemoteCommandTargeter> targeter);
-
- ~Shard();
-
- const ShardId& getId() const { return _id; }
-
- const ConnectionString& getConnString() const { return _cs; }
-
- RemoteCommandTargeter* getTargeter() const { return _targeter.get(); }
-
- BSONObj runCommand(const std::string& db, const std::string& simple) const;
- BSONObj runCommand(const std::string& db, const BSONObj& cmd) const;
-
- bool runCommand(const std::string& db, const std::string& simple, BSONObj& res) const;
- bool runCommand(const std::string& db, const BSONObj& cmd, BSONObj& res) const;
-
- /**
- * Returns metadata and stats for this shard.
- */
- ShardStatus getStatus() const;
-
- /**
- * Returns a string description of this shard entry.
- */
- std::string toString() const;
-
- static ShardPtr lookupRSName(const std::string& name);
-
- /**
- * @parm current - shard where the chunk/database currently lives in
- * @return the currently emptiest shard, if best then current, or nullptr
- */
- static ShardPtr pick();
-
- static void reloadShardInfo();
-
- static void removeShard(const ShardId& id);
-
- private:
- /**
- * Identifier of the shard as obtained from the configuration data (i.e. shard0000).
- */
- const ShardId _id;
-
- /**
- * Connection string for the shard.
- */
- const ConnectionString _cs;
-
- /**
- * Targeter for obtaining hosts from which to read or to which to write.
- */
- const std::unique_ptr<RemoteCommandTargeter> _targeter;
- };
-
-} // namespace mongo
+ std::string toString() const;
+
+ static ShardPtr lookupRSName(const std::string& name);
+
+ /**
+ * @parm current - shard where the chunk/database currently lives in
+ * @return the currently emptiest shard, if best then current, or nullptr
+ */
+ static ShardPtr pick();
+
+ static void reloadShardInfo();
+
+ static void removeShard(const ShardId& id);
+
+private:
+ /**
+ * Identifier of the shard as obtained from the configuration data (i.e. shard0000).
+ */
+ const ShardId _id;
+
+ /**
+ * Connection string for the shard.
+ */
+ const ConnectionString _cs;
+
+ /**
+ * Targeter for obtaining hosts from which to read or to which to write.
+ */
+ const std::unique_ptr<RemoteCommandTargeter> _targeter;
+};
+
+} // namespace mongo