summaryrefslogtreecommitdiff
path: root/src/mongo/s/grid.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/grid.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/s/grid.h')
-rw-r--r--src/mongo/s/grid.h157
1 files changed, 82 insertions, 75 deletions
diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h
index d15768ae21e..7262e71a629 100644
--- a/src/mongo/s/grid.h
+++ b/src/mongo/s/grid.h
@@ -35,82 +35,89 @@
namespace mongo {
- class BSONObj;
- class CatalogCache;
- class CatalogManager;
- class DBConfig;
- class SettingsType;
- class ShardRegistry;
- template<typename T> class StatusWith;
+class BSONObj;
+class CatalogCache;
+class CatalogManager;
+class DBConfig;
+class SettingsType;
+class ShardRegistry;
+template <typename T>
+class StatusWith;
+/**
+ * Holds the global sharding context. Single instance exists for a running server. Exists on
+ * both MongoD and MongoS.
+ */
+class Grid {
+public:
+ Grid();
+
/**
- * Holds the global sharding context. Single instance exists for a running server. Exists on
- * both MongoD and MongoS.
+ * Called at startup time so the global sharding services (catalog manager, shard registry)
+ * can be set. This method must be called once and once only for the lifetime of the
+ * service.
+ *
+ * NOTE: Unit-tests are allowed to call it more than once, provided they reset the object's
+ * state using clearForUnitTests.
*/
- class Grid {
- public:
- Grid();
-
- /**
- * Called at startup time so the global sharding services (catalog manager, shard registry)
- * can be set. This method must be called once and once only for the lifetime of the
- * service.
- *
- * NOTE: Unit-tests are allowed to call it more than once, provided they reset the object's
- * state using clearForUnitTests.
- */
- void init(std::unique_ptr<CatalogManager> catalogManager,
- std::unique_ptr<ShardRegistry> shardRegistry);
-
- /**
- * Implicitly creates the specified database as non-sharded.
- */
- StatusWith<std::shared_ptr<DBConfig>> implicitCreateDb(const std::string& dbName);
-
- /**
- * @return true if shards and config servers are allowed to use 'localhost' in address
- */
- bool allowLocalHost() const;
-
- /**
- * @param whether to allow shards and config servers to use 'localhost' in address
- */
- void setAllowLocalHost( bool allow );
-
- /**
- * Returns true if the balancer should be running. Caller is responsible
- * for making sure settings has the balancer key.
- */
- bool shouldBalance(const SettingsType& balancerSettings) const;
-
- /**
- * Returns true if the config server settings indicate that the balancer should be active.
- */
- bool getConfigShouldBalance() const;
-
- CatalogManager* catalogManager() const { return _catalogManager.get(); }
- CatalogCache* catalogCache() const { return _catalogCache.get(); }
- ShardRegistry* shardRegistry() const { return _shardRegistry.get(); }
-
- /**
- * Clears the grid object so that it can be reused between test executions. This will not
- * be necessary if grid is hanging off the global ServiceContext and each test gets its
- * own service context.
- *
- * NOTE: Do not use this outside of unit-tests.
- */
- void clearForUnitTests();
-
- private:
- std::unique_ptr<CatalogManager> _catalogManager;
- std::unique_ptr<CatalogCache> _catalogCache;
- std::unique_ptr<ShardRegistry> _shardRegistry;
-
- // can 'localhost' be used in shard addresses?
- bool _allowLocalShard;
- };
-
- extern Grid grid;
-
-} // namespace mongo
+ void init(std::unique_ptr<CatalogManager> catalogManager,
+ std::unique_ptr<ShardRegistry> shardRegistry);
+
+ /**
+ * Implicitly creates the specified database as non-sharded.
+ */
+ StatusWith<std::shared_ptr<DBConfig>> implicitCreateDb(const std::string& dbName);
+
+ /**
+ * @return true if shards and config servers are allowed to use 'localhost' in address
+ */
+ bool allowLocalHost() const;
+
+ /**
+ * @param whether to allow shards and config servers to use 'localhost' in address
+ */
+ void setAllowLocalHost(bool allow);
+
+ /**
+ * Returns true if the balancer should be running. Caller is responsible
+ * for making sure settings has the balancer key.
+ */
+ bool shouldBalance(const SettingsType& balancerSettings) const;
+
+ /**
+ * Returns true if the config server settings indicate that the balancer should be active.
+ */
+ bool getConfigShouldBalance() const;
+
+ CatalogManager* catalogManager() const {
+ return _catalogManager.get();
+ }
+ CatalogCache* catalogCache() const {
+ return _catalogCache.get();
+ }
+ ShardRegistry* shardRegistry() const {
+ return _shardRegistry.get();
+ }
+
+ /**
+ * Clears the grid object so that it can be reused between test executions. This will not
+ * be necessary if grid is hanging off the global ServiceContext and each test gets its
+ * own service context.
+ *
+ * NOTE: Do not use this outside of unit-tests.
+ */
+ void clearForUnitTests();
+
+private:
+ std::unique_ptr<CatalogManager> _catalogManager;
+ std::unique_ptr<CatalogCache> _catalogCache;
+ std::unique_ptr<ShardRegistry> _shardRegistry;
+
+ // can 'localhost' be used in shard addresses?
+ bool _allowLocalShard;
+};
+
+extern Grid grid;
+
+} // namespace mongo