Storage Engine API
mongo::LockGrantNotification Class Referenceabstract

Interface on which granted lock requests will be notified. More...

#include <lock_manager_defs.h>

Inheritance diagram for mongo::LockGrantNotification:
mongo::CondVarLockGrantNotification mongo::TrackingLockGrantNotification mongo::LockRequestCombo

Detailed Description

Interface on which granted lock requests will be notified.

See the contract for the notify method for more information and also the LockManager::lock call.

The default implementation of this method would simply block on an event until notify has been invoked (see CondVarLockGrantNotification).

Test implementations could just count the number of notifications and their outcome so that they can validate locks are granted as desired and drive the test execution.

Public Member Functions

virtual ~LockGrantNotification ()
 
virtual void notify (ResourceId resId, LockResult result)=0
 This method is invoked at most once for each lock request and indicates the outcome of the lock acquisition for the specified resource id. More...
 

Constructor & Destructor Documentation

◆ ~LockGrantNotification()

virtual mongo::LockGrantNotification::~LockGrantNotification ( )
inlinevirtual

Member Function Documentation

◆ notify()

virtual void mongo::LockGrantNotification::notify ( ResourceId  resId,
LockResult  result 
)
pure virtual

This method is invoked at most once for each lock request and indicates the outcome of the lock acquisition for the specified resource id.

Cases where it won't be called are if a lock acquisition (be it in waiting or converting state) is cancelled through a call to unlock.

IMPORTANT: This callback runs under a spinlock for the lock manager, so the work done inside must be kept to a minimum and no locks or operations which may block should be run. Also, no methods which call back into the lock manager should be invoked from within this methods (LockManager is not reentrant).

ResourceId for which a lock operation was previously called.

Returns
Outcome of the lock operation.

Implemented in mongo::CondVarLockGrantNotification, and mongo::TrackingLockGrantNotification.


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