diff options
Diffstat (limited to 'src/mongo/s/catalog_cache_loader.h')
-rw-r--r-- | src/mongo/s/catalog_cache_loader.h | 17 |
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; }; |