Storage Engine API
mongo::CollectionInfoCacheImpl 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_impl.h>

Inheritance diagram for mongo::CollectionInfoCacheImpl:
mongo::CollectionInfoCache::Impl

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

Public Member Functions

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

Private Member Functions

void computeIndexKeys (OperationContext *opCtx)
 
void updatePlanCacheIndexEntries (OperationContext *opCtx)
 
void rebuildIndexData (OperationContext *opCtx)
 Rebuilds cached information that is dependent on index composition. More...
 

Private Attributes

Collection_collection
 
const NamespaceString _ns
 
bool _keysComputed
 
UpdateIndexData _indexedPaths
 
std::unique_ptr< PlanCache > _planCache
 
std::unique_ptr< QuerySettings > _querySettings
 
CollectionIndexUsageTracker _indexUsageTracker
 
bool _hasTTLIndex = false
 

Constructor & Destructor Documentation

◆ CollectionInfoCacheImpl()

mongo::CollectionInfoCacheImpl::CollectionInfoCacheImpl ( Collection collection,
const NamespaceString &  ns 
)
explicit

◆ ~CollectionInfoCacheImpl()

mongo::CollectionInfoCacheImpl::~CollectionInfoCacheImpl ( )

Member Function Documentation

◆ addedIndex()

void mongo::CollectionInfoCacheImpl::addedIndex ( OperationContext *  opCtx,
const IndexDescriptor *  desc 
)
virtual

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.

Implements mongo::CollectionInfoCache::Impl.

◆ clearQueryCache()

void mongo::CollectionInfoCacheImpl::clearQueryCache ( )
virtual

Removes all cached query plans.

Implements mongo::CollectionInfoCache::Impl.

◆ computeIndexKeys()

void mongo::CollectionInfoCacheImpl::computeIndexKeys ( OperationContext *  opCtx)
private

◆ droppedIndex()

void mongo::CollectionInfoCacheImpl::droppedIndex ( OperationContext *  opCtx,
StringData  indexName 
)
virtual

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.

Implements mongo::CollectionInfoCache::Impl.

◆ getIndexKeys()

const UpdateIndexData & mongo::CollectionInfoCacheImpl::getIndexKeys ( OperationContext *  opCtx) const
virtual

◆ getIndexUsageStats()

CollectionIndexUsageMap mongo::CollectionInfoCacheImpl::getIndexUsageStats ( ) const
virtual

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.

Implements mongo::CollectionInfoCache::Impl.

◆ getPlanCache()

PlanCache * mongo::CollectionInfoCacheImpl::getPlanCache ( ) const
virtual

Get the PlanCache for this collection.

Implements mongo::CollectionInfoCache::Impl.

◆ getQuerySettings()

QuerySettings * mongo::CollectionInfoCacheImpl::getQuerySettings ( ) const
virtual

Get the QuerySettings for this collection.

Implements mongo::CollectionInfoCache::Impl.

◆ init()

void mongo::CollectionInfoCacheImpl::init ( OperationContext *  opCtx)
virtual

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

Implements mongo::CollectionInfoCache::Impl.

◆ notifyOfQuery()

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

Signal to the cache that a query operation has completed.

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

Implements mongo::CollectionInfoCache::Impl.

◆ rebuildIndexData()

void mongo::CollectionInfoCacheImpl::rebuildIndexData ( OperationContext *  opCtx)
private

Rebuilds cached information that is dependent on index composition.

Must be called when index composition changes.

◆ updatePlanCacheIndexEntries()

void mongo::CollectionInfoCacheImpl::updatePlanCacheIndexEntries ( OperationContext *  opCtx)
private

Member Data Documentation

◆ _collection

Collection* mongo::CollectionInfoCacheImpl::_collection
private

◆ _hasTTLIndex

bool mongo::CollectionInfoCacheImpl::_hasTTLIndex = false
private

◆ _indexedPaths

UpdateIndexData mongo::CollectionInfoCacheImpl::_indexedPaths
private

◆ _indexUsageTracker

CollectionIndexUsageTracker mongo::CollectionInfoCacheImpl::_indexUsageTracker
private

◆ _keysComputed

bool mongo::CollectionInfoCacheImpl::_keysComputed
private

◆ _ns

const NamespaceString mongo::CollectionInfoCacheImpl::_ns
private

◆ _planCache

std::unique_ptr<PlanCache> mongo::CollectionInfoCacheImpl::_planCache
private

◆ _querySettings

std::unique_ptr<QuerySettings> mongo::CollectionInfoCacheImpl::_querySettings
private

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