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

There is one of these objects for each resource that has a lock request. More...

Detailed Description

There is one of these objects for each resource that has a lock request.

Empty objects (i.e. LockHead with no requests) are allowed to exist on the lock manager's hash table.

The memory and lifetime is controlled entirely by the LockManager class.

Not thread-safe and should only be accessed under the LockManager's bucket lock. Must be locked before locking a partition, not after.

Public Member Functions

void initNew (ResourceId resId)
 Used for initialization of a LockHead, which might have been retrieved from cache and also in order to keep the LockHead structure a POD. More...
 
bool partitioned () const
 True iff there may be partitions with granted requests for this resource. More...
 
LockRequestfindRequest (LockerId lockerId) const
 Locates the request corresponding to the particular locker or returns nullptr. More...
 
LockResult newRequest (LockRequest *request)
 Finish creation of request and put it on the LockHead's conflict or granted queues. More...
 
void migratePartitionedLockHeads ()
 Lock each partitioned LockHead in turn, and move any (granted) intent mode requests for lock->resourceId to lock, which must itself already be locked. More...
 
void incGrantedModeCount (LockMode mode)
 
void decGrantedModeCount (LockMode mode)
 
void incConflictModeCount (LockMode mode)
 
void decConflictModeCount (LockMode mode)
 

Public Attributes

ResourceId resourceId
 
LockRequestList grantedList
 
uint32_t grantedCounts [LockModesCount]
 
uint32_t grantedModes
 
LockRequestList conflictList
 
uint32_t conflictCounts [LockModesCount]
 
uint32_t conflictModes
 
std::vector< LockManager::Partition * > partitions
 
uint32_t conversionsCount
 
uint32_t compatibleFirstCount
 

Member Function Documentation

◆ decConflictModeCount()

void mongo::LockHead::decConflictModeCount ( LockMode  mode)
inline

◆ decGrantedModeCount()

void mongo::LockHead::decGrantedModeCount ( LockMode  mode)
inline

◆ findRequest()

LockRequest* mongo::LockHead::findRequest ( LockerId  lockerId) const
inline

Locates the request corresponding to the particular locker or returns nullptr.

Must be called with the bucket holding this lock head locked.

◆ incConflictModeCount()

void mongo::LockHead::incConflictModeCount ( LockMode  mode)
inline

◆ incGrantedModeCount()

void mongo::LockHead::incGrantedModeCount ( LockMode  mode)
inline

◆ initNew()

void mongo::LockHead::initNew ( ResourceId  resId)
inline

Used for initialization of a LockHead, which might have been retrieved from cache and also in order to keep the LockHead structure a POD.

◆ migratePartitionedLockHeads()

void mongo::LockHead::migratePartitionedLockHeads ( )

Lock each partitioned LockHead in turn, and move any (granted) intent mode requests for lock->resourceId to lock, which must itself already be locked.

◆ newRequest()

LockResult mongo::LockHead::newRequest ( LockRequest request)
inline

Finish creation of request and put it on the LockHead's conflict or granted queues.

Returns LOCK_WAITING for conflict case and LOCK_OK otherwise.

◆ partitioned()

bool mongo::LockHead::partitioned ( ) const
inline

True iff there may be partitions with granted requests for this resource.

Member Data Documentation

◆ compatibleFirstCount

uint32_t mongo::LockHead::compatibleFirstCount

◆ conflictCounts

uint32_t mongo::LockHead::conflictCounts[LockModesCount]

◆ conflictList

LockRequestList mongo::LockHead::conflictList

◆ conflictModes

uint32_t mongo::LockHead::conflictModes

◆ conversionsCount

uint32_t mongo::LockHead::conversionsCount

◆ grantedCounts

uint32_t mongo::LockHead::grantedCounts[LockModesCount]

◆ grantedList

LockRequestList mongo::LockHead::grantedList

◆ grantedModes

uint32_t mongo::LockHead::grantedModes

◆ partitions

std::vector<LockManager::Partition*> mongo::LockHead::partitions

◆ resourceId

ResourceId mongo::LockHead::resourceId

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