Storage Engine API
mongo::CollectionInfoCache Class Reference

this is for storing things that you want to cache about a single collection life cycle is managed for you from inside Collection. More...

#include <collection_info_cache.h>

Detailed Description

this is for storing things that you want to cache about a single collection life cycle is managed for you from inside Collection.

Classes

class  Impl
 
struct  TUHook
 

Public Member Functions

 CollectionInfoCache (Collection *const collection, const NamespaceString &ns)
 
 ~CollectionInfoCache ()=default
 
void init (OperationContext *const opCtx)
 Builds internal cache state based on the current state of the Collection's IndexCatalog. More...
 
PlanCache * getPlanCache () const
 Get the PlanCache for this collection. More...
 
QuerySettings * getQuerySettings () const
 Get the QuerySettings for this collection. More...
 
const UpdateIndexData & getIndexKeys (OperationContext *const opCtx) const
 
CollectionIndexUsageMap getIndexUsageStats () const
 Returns cached index usage statistics for this collection. More...
 
void addedIndex (OperationContext *const opCtx, const IndexDescriptor *const desc)
 Register a newly-created index with the cache. More...
 
void droppedIndex (OperationContext *const opCtx, const StringData indexName)
 Deregister a newly-dropped index with the cache. More...
 
void clearQueryCache ()
 Removes all cached query plans. More...
 
void notifyOfQuery (OperationContext *const opCtx, const std::set< std::string > &indexesUsed)
 Signal to the cache that a query operation has completed. More...
 
const Impl_impl () const
 
Impl_impl ()
 

Static Public Member Functions

static MONGO_DECLARE_SHIM ((Collection *collection, const NamespaceString &ns, PrivateTo< CollectionInfoCache >) ->std::unique_ptr< Impl >) makeImpl
 

Public Attributes

std::unique_ptr< Impl_pimpl
 

Constructor & Destructor Documentation

◆ CollectionInfoCache()

mongo::CollectionInfoCache::CollectionInfoCache ( Collection *const  collection,
const NamespaceString &  ns 
)
inlineexplicit

◆ ~CollectionInfoCache()

mongo::CollectionInfoCache::~CollectionInfoCache ( )
inlinedefault

Member Function Documentation

◆ _impl() [1/2]

const Impl& mongo::CollectionInfoCache::_impl ( ) const
inline

◆ _impl() [2/2]

Impl& mongo::CollectionInfoCache::_impl ( )
inline

◆ addedIndex()

void mongo::CollectionInfoCache::addedIndex ( OperationContext *const  opCtx,
const IndexDescriptor *const  desc 
)
inline

Register a newly-created index with the cache.

Must be called whenever an index is built on the associated collection.

Must be called under exclusive collection lock.

◆ clearQueryCache()

void mongo::CollectionInfoCache::clearQueryCache ( )
inline

Removes all cached query plans.

◆ droppedIndex()

void mongo::CollectionInfoCache::droppedIndex ( OperationContext *const  opCtx,
const StringData  indexName 
)
inline

Deregister a newly-dropped index with the cache.

Must be called whenever an index is dropped on the associated collection.

Must be called under exclusive collection lock.

◆ getIndexKeys()

const UpdateIndexData& mongo::CollectionInfoCache::getIndexKeys ( OperationContext *const  opCtx) const
inline

◆ getIndexUsageStats()

CollectionIndexUsageMap mongo::CollectionInfoCache::getIndexUsageStats ( ) const
inline

Returns cached index usage statistics for this collection.

The map returned will contain entry for each index in the collection along with both a usage counter and a timestamp representing the date/time the counter is valid from.

Note for performance that this method returns a copy of a StringMap.

◆ getPlanCache()

PlanCache* mongo::CollectionInfoCache::getPlanCache ( ) const
inline

Get the PlanCache for this collection.

◆ getQuerySettings()

QuerySettings* mongo::CollectionInfoCache::getQuerySettings ( ) const
inline

Get the QuerySettings for this collection.

◆ init()

void mongo::CollectionInfoCache::init ( OperationContext *const  opCtx)
inline

Builds internal cache state based on the current state of the Collection's IndexCatalog.

◆ MONGO_DECLARE_SHIM()

static mongo::CollectionInfoCache::MONGO_DECLARE_SHIM ( (Collection *collection, const NamespaceString &ns, PrivateTo< CollectionInfoCache >) ->std::unique_ptr< Impl )
static

◆ notifyOfQuery()

void mongo::CollectionInfoCache::notifyOfQuery ( OperationContext *const  opCtx,
const std::set< std::string > &  indexesUsed 
)
inline

Signal to the cache that a query operation has completed.

'indexesUsed' should list the set of indexes used by the winning plan, if any.

Member Data Documentation

◆ _pimpl

std::unique_ptr<Impl> mongo::CollectionInfoCache::_pimpl

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