diff options
Diffstat (limited to 'src/mongo/db/catalog_raii.h')
-rw-r--r-- | src/mongo/db/catalog_raii.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/db/catalog_raii.h b/src/mongo/db/catalog_raii.h index 1d0b1e9238f..f8998e405cc 100644 --- a/src/mongo/db/catalog_raii.h +++ b/src/mongo/db/catalog_raii.h @@ -187,4 +187,30 @@ private: bool _justCreated{false}; }; +/** + * RAII-style class. Hides changes to the UUIDCatalog For the life of the object so that calls to + * UUIDCatalog::lookupNSSByUUID will return results as before the RAII object was instantiated. + * + * The caller must hold the global exclusive lock for the life of the instance. + */ +class ConcealUUIDCatalogChangesBlock { + MONGO_DISALLOW_COPYING(ConcealUUIDCatalogChangesBlock); + +public: + /** + * Conceals future UUIDCatalog changes and stashes a pointer to the opCtx for the destructor to + * use. + */ + ConcealUUIDCatalogChangesBlock(OperationContext* opCtx); + + /** + * Reveals UUIDCatalog changes. + */ + ~ConcealUUIDCatalogChangesBlock(); + +private: + // Needed for the destructor to access the UUIDCatalog in order to call onOpenCatalog. + OperationContext* _opCtx; +}; + } // namespace mongo |