Storage Engine API
lock_manager_test_help.h
Go to the documentation of this file.
1 
29 #pragma once
30 
33 
34 namespace mongo {
35 
36 class LockerForTests : public LockerImpl<false> {
37 public:
38  explicit LockerForTests(LockMode globalLockMode) {
39  lockGlobal(globalLockMode);
40  }
41 
43  unlockGlobal();
44  }
45 };
46 
47 
49 public:
50  TrackingLockGrantNotification() : numNotifies(0), lastResult(LOCK_INVALID) {}
51 
52  virtual void notify(ResourceId resId, LockResult result) {
53  numNotifies++;
54  lastResId = resId;
55  lastResult = result;
56  }
57 
58 public:
60 
63 };
64 
65 
67 public:
69  initNew(locker, this);
70  }
71 };
72 
77 extern bool _supportsDocLocking;
79 public:
80  explicit ForceSupportsDocLocking(bool supported) : _oldSupportsDocLocking(_supportsDocLocking) {
81  _supportsDocLocking = supported;
82  }
83 
85  _supportsDocLocking = _oldSupportsDocLocking;
86  }
87 
88 private:
90 };
91 
92 } // namespace mongo
Interface for acquiring locks.
Definition: locker.h:47
Interface on which granted lock requests will be notified.
Definition: lock_manager_defs.h:276
~ForceSupportsDocLocking()
Definition: lock_manager_test_help.h:84
Definition: lock_manager_test_help.h:66
Definition: lock_manager_test_help.h:36
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
const bool _oldSupportsDocLocking
Definition: lock_manager_test_help.h:89
virtual bool unlockGlobal()
Definition: lock_state.cpp:416
This is used as an initializer value.
Definition: lock_manager_defs.h:133
Uniquely identifies a lockable resource.
Definition: lock_manager_defs.h:176
LockRequestCombo(Locker *locker)
Definition: lock_manager_test_help.h:68
LockResult lastResult
Definition: lock_manager_test_help.h:62
LockResult
Return values for the locking functions of the lock manager.
Definition: lock_manager_defs.h:99
Interface for acquiring locks.
Definition: lock_state.h:96
LockMode
Lock modes.
Definition: lock_manager_defs.h:59
virtual void notify(ResourceId resId, LockResult result)
This method is invoked at most once for each lock request and indicates the outcome of the lock acqui...
Definition: lock_manager_test_help.h:52
std::array< DefaultLockerImpl, kMaxPerfThreads > locker
Definition: d_concurrency_bm.cpp:66
TrackingLockGrantNotification()
Definition: lock_manager_test_help.h:50
ForceSupportsDocLocking(bool supported)
Definition: lock_manager_test_help.h:80
~LockerForTests()
Definition: lock_manager_test_help.h:42
virtual LockResult lockGlobal(OperationContext *opCtx, LockMode mode)
Definition: lock_state.cpp:305
There is one of those entries per each request for a lock.
Definition: lock_manager_defs.h:307
ResourceId lastResId
Definition: lock_manager_test_help.h:61
Definition: lock_manager_test_help.h:48
Definition: lock_manager_test_help.h:78
int numNotifies
Definition: lock_manager_test_help.h:59
LockerForTests(LockMode globalLockMode)
Definition: lock_manager_test_help.h:38
bool _supportsDocLocking
A RAII object that temporarily forces setting of the _supportsDocLocking global variable (defined in ...
Definition: lock_manager_test_help.h:77