summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog_cache_loader.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-07-24 17:48:20 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-07-28 16:32:57 -0400
commit356a36dea183db5afedb932ed4c086f17c4173d0 (patch)
tree59128eb8d15f8ed2e0b7c0bc0d2596c756859d23 /src/mongo/s/catalog_cache_loader.h
parent2a910e6c65327a71f6656ecacf6fbca66baeb517 (diff)
downloadmongo-356a36dea183db5afedb932ed4c086f17c4173d0.tar.gz
SERVER-29672 Make Config/ShardCatalogCacheLoader decorations on ServiceContext
Diffstat (limited to 'src/mongo/s/catalog_cache_loader.h')
-rw-r--r--src/mongo/s/catalog_cache_loader.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mongo/s/catalog_cache_loader.h b/src/mongo/s/catalog_cache_loader.h
index 3257cb8fbc5..8f2b2d3067d 100644
--- a/src/mongo/s/catalog_cache_loader.h
+++ b/src/mongo/s/catalog_cache_loader.h
@@ -36,6 +36,7 @@
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/s/catalog/type_collection.h"
#include "mongo/s/chunk_version.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/concurrency/notification.h"
namespace mongo {
@@ -52,6 +53,16 @@ public:
virtual ~CatalogCacheLoader() = default;
/**
+ * Stores a loader on the specified service context. May only be called once for the lifetime of
+ * the service context.
+ */
+ static void set(ServiceContext* serviceContext, std::unique_ptr<CatalogCacheLoader> loader);
+
+ static CatalogCacheLoader& get(ServiceContext* serviceContext);
+ static CatalogCacheLoader& get(OperationContext* opCtx);
+
+
+ /**
* Used as a return value for getChunksSince.
*/
struct CollectionAndChangedChunks {
@@ -120,6 +131,12 @@ public:
stdx::function<void(OperationContext*, StatusWith<CollectionAndChangedChunks>)>
callbackFn) = 0;
+ /**
+ * Only used for unit-tests, clears a previously-created catalog cache loader from the specified
+ * service context, so that 'create' can be called again.
+ */
+ static void clearForTests(ServiceContext* serviceContext);
+
protected:
CatalogCacheLoader() = default;
};