Storage Engine API
mongo::DatabaseHolder Class Reference

Registry of opened databases. More...

#include <database_holder.h>

Detailed Description

Registry of opened databases.

Classes

class  Impl
 
struct  TUHook
 

Public Member Functions

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

Static Public Member Functions

static MONGO_DECLARE_SHIM (() ->DatabaseHolder &) getDatabaseHolder
 
static MONGO_DECLARE_SHIM ((PrivateTo< DatabaseHolder >) ->std::unique_ptr< Impl >) makeImpl
 

Private Member Functions

const Impl_impl () const
 
Impl_impl ()
 

Private Attributes

std::unique_ptr< Impl_pimpl
 

Constructor & Destructor Documentation

◆ ~DatabaseHolder()

mongo::DatabaseHolder::~DatabaseHolder ( )
inlinedefault

◆ DatabaseHolder()

mongo::DatabaseHolder::DatabaseHolder ( )
inlineexplicit

Member Function Documentation

◆ _impl() [1/2]

const Impl& mongo::DatabaseHolder::_impl ( ) const
inlineprivate

◆ _impl() [2/2]

Impl& mongo::DatabaseHolder::_impl ( )
inlineprivate

◆ close()

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

Closes the specified database.

Must be called with the database locked in X-mode. No background jobs must be in progress on the database when this function is called.

◆ closeAll()

void mongo::DatabaseHolder::closeAll ( OperationContext *const  opCtx,
const std::string &  reason 
)
inline

Closes all opened databases.

Must be called with the global lock acquired in X-mode. Will uassert if any background jobs are running when this function is called.

Parameters
reasonThe reason for close.

◆ get()

Database* mongo::DatabaseHolder::get ( OperationContext *const  opCtx,
const StringData  ns 
) const
inline

Retrieves an already opened database or returns NULL.

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

◆ getNamesWithConflictingCasing()

std::set<std::string> mongo::DatabaseHolder::getNamesWithConflictingCasing ( const StringData  name)
inline

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

◆ MONGO_DECLARE_SHIM() [1/2]

static mongo::DatabaseHolder::MONGO_DECLARE_SHIM ( () ->DatabaseHolder )
static

◆ MONGO_DECLARE_SHIM() [2/2]

static mongo::DatabaseHolder::MONGO_DECLARE_SHIM ( (PrivateTo< DatabaseHolder >) ->std::unique_ptr< Impl )
static

◆ openDb()

Database* mongo::DatabaseHolder::openDb ( OperationContext *const  opCtx,
const StringData  ns,
bool *const  justCreated = nullptr 
)
inline

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.

Parameters
justCreatedReturns whether the database was newly created (true) or it already existed (false). Can be NULL if this information is not necessary.

Member Data Documentation

◆ _pimpl

std::unique_ptr<Impl> mongo::DatabaseHolder::_pimpl
private

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