summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/record_store.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/record_store.h')
-rw-r--r--src/mongo/db/storage/record_store.h70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h
index f17e07bfa59..c321938af06 100644
--- a/src/mongo/db/storage/record_store.h
+++ b/src/mongo/db/storage/record_store.h
@@ -78,7 +78,8 @@ protected:
class UpdateNotifier {
public:
virtual ~UpdateNotifier() {}
- virtual Status recordStoreGoingToUpdateInPlace(OperationContext* txn, const RecordId& loc) = 0;
+ virtual Status recordStoreGoingToUpdateInPlace(OperationContext* opCtx,
+ const RecordId& loc) = 0;
};
/**
@@ -199,12 +200,12 @@ public:
/**
* Inform the cursor that this id is being invalidated. Must be called between save and restore.
- * The txn is that of the operation causing the invalidation, not the txn using the cursor.
+ * The opCtx is that of the operation causing the invalidation, not the opCtx using the cursor.
*
* WARNING: Storage engines other than MMAPv1 should use the default implementation,
* and not depend on this being called.
*/
- virtual void invalidate(OperationContext* txn, const RecordId& id) {}
+ virtual void invalidate(OperationContext* opCtx, const RecordId& id) {}
//
// RecordFetchers
@@ -299,13 +300,13 @@ public:
* The dataSize is an approximation of the sum of the sizes (in bytes) of the
* documents or entries in the recordStore.
*/
- virtual long long dataSize(OperationContext* txn) const = 0;
+ virtual long long dataSize(OperationContext* opCtx) const = 0;
/**
* Total number of record in the RecordStore. You may need to cache it, so this call
* takes constant time, as it is called often.
*/
- virtual long long numRecords(OperationContext* txn) const = 0;
+ virtual long long numRecords(OperationContext* opCtx) const = 0;
virtual bool isCapped() const = 0;
@@ -318,7 +319,7 @@ public:
* @param level - optional, level of debug info to put in (higher is more)
* @return total estimate size (in bytes) on stable storage
*/
- virtual int64_t storageSize(OperationContext* txn,
+ virtual int64_t storageSize(OperationContext* opCtx,
BSONObjBuilder* extraInfo = NULL,
int infoLevel = 0) const = 0;
@@ -333,9 +334,9 @@ public:
* In general, prefer findRecord or RecordCursor::seekExact since they can tell you if a
* record has been removed.
*/
- virtual RecordData dataFor(OperationContext* txn, const RecordId& loc) const {
+ virtual RecordData dataFor(OperationContext* opCtx, const RecordId& loc) const {
RecordData data;
- invariant(findRecord(txn, loc, &data));
+ invariant(findRecord(opCtx, loc, &data));
return data;
}
@@ -353,8 +354,8 @@ public:
* potentially deleted RecordIds to seek methods if they know that MMAPv1 is not the current
* storage engine. All new storage engines must support detecting the existence of Records.
*/
- virtual bool findRecord(OperationContext* txn, const RecordId& loc, RecordData* out) const {
- auto cursor = getCursor(txn);
+ virtual bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* out) const {
+ auto cursor = getCursor(opCtx);
auto record = cursor->seekExact(loc);
if (!record)
return false;
@@ -364,19 +365,19 @@ public:
return true;
}
- virtual void deleteRecord(OperationContext* txn, const RecordId& dl) = 0;
+ virtual void deleteRecord(OperationContext* opCtx, const RecordId& dl) = 0;
- virtual StatusWith<RecordId> insertRecord(OperationContext* txn,
+ virtual StatusWith<RecordId> insertRecord(OperationContext* opCtx,
const char* data,
int len,
bool enforceQuota) = 0;
- virtual Status insertRecords(OperationContext* txn,
+ virtual Status insertRecords(OperationContext* opCtx,
std::vector<Record>* records,
bool enforceQuota) {
for (auto& record : *records) {
StatusWith<RecordId> res =
- insertRecord(txn, record.data.data(), record.data.size(), enforceQuota);
+ insertRecord(opCtx, record.data.data(), record.data.size(), enforceQuota);
if (!res.isOK())
return res.getStatus();
@@ -394,7 +395,7 @@ public:
* On success, if idsOut is non-null the RecordIds of the inserted records will be written into
* it. It must have space for nDocs RecordIds.
*/
- virtual Status insertRecordsWithDocWriter(OperationContext* txn,
+ virtual Status insertRecordsWithDocWriter(OperationContext* opCtx,
const DocWriter* const* docs,
size_t nDocs,
RecordId* idsOut = nullptr) = 0;
@@ -402,9 +403,9 @@ public:
/**
* A thin wrapper around insertRecordsWithDocWriter() to simplify handling of single DocWriters.
*/
- StatusWith<RecordId> insertRecordWithDocWriter(OperationContext* txn, const DocWriter* doc) {
+ StatusWith<RecordId> insertRecordWithDocWriter(OperationContext* opCtx, const DocWriter* doc) {
RecordId out;
- Status status = insertRecordsWithDocWriter(txn, &doc, 1, &out);
+ Status status = insertRecordsWithDocWriter(opCtx, &doc, 1, &out);
if (!status.isOK())
return status;
return out;
@@ -422,7 +423,7 @@ public:
*
* For capped record stores, the record size will never change.
*/
- virtual Status updateRecord(OperationContext* txn,
+ virtual Status updateRecord(OperationContext* opCtx,
const RecordId& oldLocation,
const char* data,
int len,
@@ -446,7 +447,7 @@ public:
* @return the updated version of the record. If unowned data is returned, then it is valid
* until the next modification of this Record or the lock on the collection has been released.
*/
- virtual StatusWith<RecordData> updateWithDamages(OperationContext* txn,
+ virtual StatusWith<RecordData> updateWithDamages(OperationContext* opCtx,
const RecordId& loc,
const RecordData& oldRec,
const char* damageSource,
@@ -460,7 +461,7 @@ public:
* are allowed to lazily seek to the first Record when next() is called rather than doing
* it on construction.
*/
- virtual std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* txn,
+ virtual std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* opCtx,
bool forward = true) const = 0;
/**
@@ -468,7 +469,7 @@ public:
* damaged records. The iterator might return every record in the store if all of them
* are reachable and not corrupted. Returns NULL if not supported.
*/
- virtual std::unique_ptr<RecordCursor> getCursorForRepair(OperationContext* txn) const {
+ virtual std::unique_ptr<RecordCursor> getCursorForRepair(OperationContext* opCtx) const {
return {};
}
@@ -483,7 +484,7 @@ public:
* the record store. Implementations should avoid obvious biases toward older, newer, larger
* smaller or other specific classes of documents.
*/
- virtual std::unique_ptr<RecordCursor> getRandomCursor(OperationContext* txn) const {
+ virtual std::unique_ptr<RecordCursor> getRandomCursor(OperationContext* opCtx) const {
return {};
}
@@ -491,9 +492,10 @@ public:
* Returns many RecordCursors that partition the RecordStore into many disjoint sets.
* Iterating all returned RecordCursors is equivalent to iterating the full store.
*/
- virtual std::vector<std::unique_ptr<RecordCursor>> getManyCursors(OperationContext* txn) const {
+ virtual std::vector<std::unique_ptr<RecordCursor>> getManyCursors(
+ OperationContext* opCtx) const {
std::vector<std::unique_ptr<RecordCursor>> out(1);
- out[0] = getCursor(txn);
+ out[0] = getCursor(opCtx);
return out;
}
@@ -503,7 +505,7 @@ public:
/**
* removes all Records
*/
- virtual Status truncate(OperationContext* txn) = 0;
+ virtual Status truncate(OperationContext* opCtx) = 0;
/**
* Truncate documents newer than the document at 'end' from the capped
@@ -511,7 +513,7 @@ public:
* function. An assertion will be thrown if that is attempted.
* @param inclusive - Truncate 'end' as well iff true
*/
- virtual void cappedTruncateAfter(OperationContext* txn, RecordId end, bool inclusive) = 0;
+ virtual void cappedTruncateAfter(OperationContext* opCtx, RecordId end, bool inclusive) = 0;
/**
* does this RecordStore support the compact operation?
@@ -537,7 +539,7 @@ public:
* Only called if compactSupported() returns true.
* No RecordStoreCompactAdaptor will be passed if compactsInPlace() returns true.
*/
- virtual Status compact(OperationContext* txn,
+ virtual Status compact(OperationContext* opCtx,
RecordStoreCompactAdaptor* adaptor,
const CompactOptions* options,
CompactStats* stats) {
@@ -549,7 +551,7 @@ public:
* OK will be returned even if corruption is found
* deatils will be in result
*/
- virtual Status validate(OperationContext* txn,
+ virtual Status validate(OperationContext* opCtx,
ValidateCmdLevel level,
ValidateAdaptor* adaptor,
ValidateResults* results,
@@ -559,7 +561,7 @@ public:
* @param scaleSize - amount by which to scale size metrics
* appends any custom stats from the RecordStore or other unique stats
*/
- virtual void appendCustomStats(OperationContext* txn,
+ virtual void appendCustomStats(OperationContext* opCtx,
BSONObjBuilder* result,
double scale) const = 0;
@@ -572,7 +574,7 @@ public:
*
* @param output (optional) - where to put detailed stats
*/
- virtual Status touch(OperationContext* txn, BSONObjBuilder* output) const {
+ virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output) const {
return Status(ErrorCodes::CommandNotSupported,
"this storage engine does not support touch");
}
@@ -584,7 +586,7 @@ public:
* If you don't implement the oplogStartHack, just use the default implementation which
* returns boost::none.
*/
- virtual boost::optional<RecordId> oplogStartHack(OperationContext* txn,
+ virtual boost::optional<RecordId> oplogStartHack(OperationContext* opCtx,
const RecordId& startingPosition) const {
return boost::none;
}
@@ -597,7 +599,7 @@ public:
* Since this is called inside of a WriteUnitOfWork while holding a std::mutex, it is
* illegal to acquire any LockManager locks inside of this function.
*/
- virtual Status oplogDiskLocRegister(OperationContext* txn, const Timestamp& opTime) {
+ virtual Status oplogDiskLocRegister(OperationContext* opCtx, const Timestamp& opTime) {
return Status::OK();
}
@@ -608,12 +610,12 @@ public:
* It is only legal to call this on an oplog. It is illegal to call this inside a
* WriteUnitOfWork.
*/
- virtual void waitForAllEarlierOplogWritesToBeVisible(OperationContext* txn) const = 0;
+ virtual void waitForAllEarlierOplogWritesToBeVisible(OperationContext* opCtx) const = 0;
/**
* Called after a repair operation is run with the recomputed numRecords and dataSize.
*/
- virtual void updateStatsAfterRepair(OperationContext* txn,
+ virtual void updateStatsAfterRepair(OperationContext* opCtx,
long long numRecords,
long long dataSize) = 0;