diff options
Diffstat (limited to 'src/mongo/db/catalog/database.cpp')
-rw-r--r-- | src/mongo/db/catalog/database.cpp | 61 |
1 files changed, 4 insertions, 57 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp index 527c9e847ab..a9963a2dc7d 100644 --- a/src/mongo/db/catalog/database.cpp +++ b/src/mongo/db/catalog/database.cpp @@ -36,66 +36,13 @@ namespace mongo { Database::Impl::~Impl() = default; -namespace { -stdx::function<Database::factory_function_type> factory; -} // namespace - -void Database::registerFactory(decltype(factory) newFactory) { - factory = std::move(newFactory); -} - -auto Database::makeImpl(Database* const this_, - OperationContext* const opCtx, - const StringData name, - DatabaseCatalogEntry* const dbEntry) -> std::unique_ptr<Impl> { - return factory(this_, opCtx, name, dbEntry); -} +MONGO_DEFINE_SHIM(Database::makeImpl); void Database::TUHook::hook() noexcept {} -namespace { -stdx::function<decltype(Database::dropDatabase)> dropDatabaseImpl; -} - -void Database::dropDatabase(OperationContext* const opCtx, Database* const db) { - return dropDatabaseImpl(opCtx, db); -} +MONGO_DEFINE_SHIM(Database::dropDatabase); -void Database::registerDropDatabaseImpl(stdx::function<decltype(dropDatabase)> impl) { - dropDatabaseImpl = std::move(impl); -} +MONGO_DEFINE_SHIM(Database::userCreateNS); -namespace { -stdx::function<decltype(userCreateNS)> userCreateNSImpl; -stdx::function<decltype(dropAllDatabasesExceptLocal)> dropAllDatabasesExceptLocalImpl; -} // namespace +MONGO_DEFINE_SHIM(Database::dropAllDatabasesExceptLocal); } // namespace mongo - -auto mongo::userCreateNS(OperationContext* const opCtx, - Database* const db, - const StringData ns, - const BSONObj options, - const CollectionOptions::ParseKind parseKind, - const bool createDefaultIndexes, - const BSONObj& idIndex) -> Status { - return userCreateNSImpl(opCtx, db, ns, options, parseKind, createDefaultIndexes, idIndex); -} - -void mongo::registerUserCreateNSImpl(stdx::function<decltype(userCreateNS)> impl) { - userCreateNSImpl = std::move(impl); -} - -void mongo::dropAllDatabasesExceptLocal(OperationContext* const opCtx) { - return dropAllDatabasesExceptLocalImpl(opCtx); -} - -/** - * Registers an implementation of `dropAllDatabaseExceptLocal` for use by library clients. - * This is necessary to allow `catalog/database` to be a vtable edge. - * @param impl Implementation of `dropAllDatabaseExceptLocal` to install. - * @note This call is not thread safe. - */ -void mongo::registerDropAllDatabasesExceptLocalImpl( - stdx::function<decltype(dropAllDatabasesExceptLocal)> impl) { - dropAllDatabasesExceptLocalImpl = std::move(impl); -} |