![]() |
Storage Engine API
|
Class that stores active cursors that have been saved (as part of yielding) to allow them to be invalidated if the thing they pointed at goes away. More...
#include <record_store_v1_base.h>
Class that stores active cursors that have been saved (as part of yielding) to allow them to be invalidated if the thing they pointed at goes away.
The registry is thread-safe, as readers may concurrently register and remove their cursors. Contention is expected to be very low, as yielding is infrequent. This logically belongs to the RecordStore, but is not contained in it to facilitate unit testing.
Classes | |
struct | SavedCursor |
The destructor ensures the cursor is unregistered when an exception is thrown. More... | |
Public Member Functions | |
~SavedCursorRegistry () | |
void | registerCursor (SavedCursor *cursor) |
Adds given saved cursor to SavedCursorRegistry. More... | |
bool | unregisterCursor (SavedCursor *cursor) |
Removes given saved cursor. More... | |
void | invalidateCursorsForBucket (DiskLoc bucket) |
When a btree-bucket disappears due to merge/split or similar, this invalidates all cursors that point at the same bucket by removing them from the registry. More... | |
Private Types | |
typedef stdx::unordered_set< SavedCursor * > | SavedCursorSet |
Private Attributes | |
SpinLock | _mutex |
SavedCursorSet | _cursors |
|
private |
mongo::SavedCursorRegistry::~SavedCursorRegistry | ( | ) |
When a btree-bucket disappears due to merge/split or similar, this invalidates all cursors that point at the same bucket by removing them from the registry.
void mongo::SavedCursorRegistry::registerCursor | ( | SavedCursor * | cursor | ) |
Adds given saved cursor to SavedCursorRegistry.
Doesn't take ownership.
bool mongo::SavedCursorRegistry::unregisterCursor | ( | SavedCursor * | cursor | ) |
Removes given saved cursor.
Returns true if the cursor was still present, and false if it had already been removed due to invalidation. Doesn't take ownership.
|
private |
|
private |