Storage Engine API
mongo::Lock::CollectionLock Class Reference

Collection lock with support for document-level locking. More...

#include <d_concurrency.h>

Detailed Description

Collection lock with support for document-level locking.

This lock supports four modes (see Lock_Mode): MODE_IS: concurrent collection access, requiring document level locking read locks MODE_IX: concurrent collection access, requiring document level read or write locks MODE_S: shared read access to the collection, blocking any writers MODE_X: exclusive access to the collection, blocking all other readers and writers

An appropriate DBLock must already be held before locking a collection: it is an error, checked with a dassert(), to not have a suitable database lock before locking the collection. For storage engines that do not support document-level locking, MODE_IS will be upgraded to MODE_S and MODE_IX will be upgraded to MODE_X.

Public Member Functions

 CollectionLock (Locker *lockState, StringData ns, LockMode mode, Date_t deadline=Date_t::max())
 
 CollectionLock (CollectionLock &&)
 
 ~CollectionLock ()
 
bool isLocked () const
 

Private Member Functions

 MONGO_DISALLOW_COPYING (CollectionLock)
 

Private Attributes

const ResourceId _id
 
LockResult _result
 
Locker_lockState
 

Constructor & Destructor Documentation

◆ CollectionLock() [1/2]

mongo::Lock::CollectionLock::CollectionLock ( Locker lockState,
StringData  ns,
LockMode  mode,
Date_t  deadline = Date_t::max() 
)

◆ CollectionLock() [2/2]

mongo::Lock::CollectionLock::CollectionLock ( CollectionLock &&  otherLock)

◆ ~CollectionLock()

mongo::Lock::CollectionLock::~CollectionLock ( )

Member Function Documentation

◆ isLocked()

bool mongo::Lock::CollectionLock::isLocked ( ) const
inline

◆ MONGO_DISALLOW_COPYING()

mongo::Lock::CollectionLock::MONGO_DISALLOW_COPYING ( CollectionLock  )
private

Member Data Documentation

◆ _id

const ResourceId mongo::Lock::CollectionLock::_id
private

◆ _lockState

Locker* mongo::Lock::CollectionLock::_lockState
private

◆ _result

LockResult mongo::Lock::CollectionLock::_result
private

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