Storage Engine API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mongo::NamespaceUUIDCache Class Reference

#include <namespace_uuid_cache.h>

Public Member Functions

 NamespaceUUIDCache ()=default
 
void ensureNamespaceInCache (const NamespaceString &nss, CollectionUUID uuid)
 This function adds the pair nss.ns(), uuid to the namespace UUID cache if it does not yet exist. More...
 
void evictNamespace (const NamespaceString &nss)
 This function removes the entry for nss.ns() from the namespace UUID cache. More...
 
void evictNamespacesInDatabase (StringData dbname)
 Same as above, but for all registered namespaces in the given dbname. More...
 
void verifyNotCached (const NamespaceString &nss, CollectionUUID uuid)
 For testing only: verify that 'nss' is not cached. More...
 

Static Public Attributes

static const OperationContext::Decoration< NamespaceUUIDCacheget
 

Private Types

using CollectionUUIDMap = StringMap< CollectionUUID >
 

Private Member Functions

 MONGO_DISALLOW_COPYING (NamespaceUUIDCache)
 

Private Attributes

CollectionUUIDMap _cache
 

Member Typedef Documentation

◆ CollectionUUIDMap

Constructor & Destructor Documentation

◆ NamespaceUUIDCache()

mongo::NamespaceUUIDCache::NamespaceUUIDCache ( )
default

Member Function Documentation

◆ ensureNamespaceInCache()

void mongo::NamespaceUUIDCache::ensureNamespaceInCache ( const NamespaceString &  nss,
CollectionUUID  uuid 
)

This function adds the pair nss.ns(), uuid to the namespace UUID cache if it does not yet exist.

If nss.ns() already exists in the cache with a different UUID, a AssertionException is thrown, so we can guarantee that an operation will always resolve the same name to the same collection, even in presence of drops and renames.

◆ evictNamespace()

void mongo::NamespaceUUIDCache::evictNamespace ( const NamespaceString &  nss)

This function removes the entry for nss.ns() from the namespace UUID cache.

Does nothing if the entry doesn't exist. It is called via the op observer when a collection is dropped or renamed.

◆ evictNamespacesInDatabase()

void mongo::NamespaceUUIDCache::evictNamespacesInDatabase ( StringData  dbname)

Same as above, but for all registered namespaces in the given dbname.

◆ MONGO_DISALLOW_COPYING()

mongo::NamespaceUUIDCache::MONGO_DISALLOW_COPYING ( NamespaceUUIDCache  )
private

◆ verifyNotCached()

void mongo::NamespaceUUIDCache::verifyNotCached ( const NamespaceString &  nss,
CollectionUUID  uuid 
)
inline

For testing only: verify that 'nss' is not cached.

Member Data Documentation

◆ _cache

CollectionUUIDMap mongo::NamespaceUUIDCache::_cache
private

◆ get

const OperationContext::Decoration< NamespaceUUIDCache > mongo::NamespaceUUIDCache::get
static
Initial value:
=
OperationContext::declareDecoration<NamespaceUUIDCache>()

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