summaryrefslogtreecommitdiff
path: root/src/mongo/s/grid.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-08-15 18:31:16 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-08-16 08:03:40 -0400
commit80801195df6055d4ba7f6f9c2bee2530cc87010d (patch)
tree99acb4ab77af39d8d58dd1ad13b4d6d2f98c30ae /src/mongo/s/grid.h
parente668a59876a0a61fdeb272966b4954fe4ed40d42 (diff)
downloadmongo-80801195df6055d4ba7f6f9c2bee2530cc87010d.tar.gz
SERVER-18084 Add Grid::get(ServiceContext*) getter
Also removes some references to the static 'grid' instance.
Diffstat (limited to 'src/mongo/s/grid.h')
-rw-r--r--src/mongo/s/grid.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h
index 54ff81f1a5b..1562afebba7 100644
--- a/src/mongo/s/grid.h
+++ b/src/mongo/s/grid.h
@@ -41,6 +41,7 @@ class ShardingCatalogClient;
class ShardingCatalogManager;
class ClusterCursorManager;
class OperationContext;
+class ServiceContext;
class ShardRegistry;
namespace executor {
@@ -58,8 +59,9 @@ public:
~Grid();
/**
- * Retrieves the instance of Grid associated with the current service context.
+ * Retrieves the instance of Grid associated with the current service/operation context.
*/
+ static Grid* get(ServiceContext* serviceContext);
static Grid* get(OperationContext* operationContext);
/**
@@ -171,7 +173,7 @@ private:
// Network interface being used by the fixed executor in _executorPool. Used for asking
// questions about the network configuration, such as getting the current server's hostname.
- executor::NetworkInterface* _network;
+ executor::NetworkInterface* _network{nullptr};
// Protects _configOpTime.
mutable stdx::mutex _mutex;
@@ -183,9 +185,11 @@ private:
// Deprecated. This is only used on mongos, and once addShard is solely handled by the configs,
// it can be deleted.
// Can 'localhost' be used in shard addresses?
- bool _allowLocalShard;
+ bool _allowLocalShard{true};
};
+// Reference to the global Grid instance. Do not use in new code. Use one of the Grid::get methods
+// instead.
extern Grid grid;
} // namespace mongo