Storage Engine API
mongo::DatabaseHolderMock Class Reference

Registry of opened databases. More...

#include <database_holder_mock.h>

Inheritance diagram for mongo::DatabaseHolderMock:
mongo::DatabaseHolder::Impl

Detailed Description

Registry of opened databases.

Public Member Functions

 DatabaseHolderMock ()=default
 
Databaseget (OperationContext *opCtx, StringData ns) const override
 Retrieves an already opened database or returns nullptr. More...
 
DatabaseopenDb (OperationContext *opCtx, StringData ns, bool *justCreated=nullptr) override
 Retrieves a database reference if it is already opened, or opens it if it hasn't been opened/created yet. More...
 
void close (OperationContext *opCtx, StringData ns, const std::string &reason) override
 Closes the specified database. More...
 
void closeAll (OperationContext *opCtx, const std::string &reason) override
 Closes all opened databases. More...
 
std::set< std::string > getNamesWithConflictingCasing (StringData name) override
 Returns the set of existing database names that differ only in casing. More...
 
- Public Member Functions inherited from mongo::DatabaseHolder::Impl
virtual ~Impl ()=0
 

Constructor & Destructor Documentation

◆ DatabaseHolderMock()

mongo::DatabaseHolderMock::DatabaseHolderMock ( )
default

Member Function Documentation

◆ close()

void mongo::DatabaseHolderMock::close ( OperationContext *  opCtx,
StringData  ns,
const std::string &  reason 
)
inlineoverridevirtual

Closes the specified database.

Must be called with the database locked in X-mode.

Implements mongo::DatabaseHolder::Impl.

◆ closeAll()

void mongo::DatabaseHolderMock::closeAll ( OperationContext *  opCtx,
const std::string &  reason 
)
inlineoverridevirtual

Closes all opened databases.

Must be called with the global lock acquired in X-mode.

reason The reason for close.

Implements mongo::DatabaseHolder::Impl.

◆ get()

Database* mongo::DatabaseHolderMock::get ( OperationContext *  opCtx,
StringData  ns 
) const
inlineoverridevirtual

Retrieves an already opened database or returns nullptr.

Must be called with the database locked in at least IS-mode.

Implements mongo::DatabaseHolder::Impl.

◆ getNamesWithConflictingCasing()

std::set<std::string> mongo::DatabaseHolderMock::getNamesWithConflictingCasing ( StringData  name)
inlineoverridevirtual

Returns the set of existing database names that differ only in casing.

Implements mongo::DatabaseHolder::Impl.

◆ openDb()

Database* mongo::DatabaseHolderMock::openDb ( OperationContext *  opCtx,
StringData  ns,
bool *  justCreated = nullptr 
)
inlineoverridevirtual

Retrieves a database reference if it is already opened, or opens it if it hasn't been opened/created yet.

Must be called with the database locked in X-mode.

justCreated Returns whether the database was newly created (true) or it already existed (false). Can be nullptr if this information is not necessary.

Implements mongo::DatabaseHolder::Impl.


The documentation for this class was generated from the following file: