33 #include <boost/shared_array.hpp> 39 #include "mongo/stdx/mutex.h" 51 std::shared_ptr<void>* dataInOut,
53 int64_t cappedMaxSize = -1,
54 int64_t cappedMaxDocs = -1,
57 virtual const char*
name()
const;
70 OperationContext*
opCtx,
const char*
data,
int len, Timestamp,
bool enforceQuota);
79 const RecordId& oldLocation,
90 const char* damageSource,
91 const mutablebson::DamageVector& damages);
93 std::unique_ptr<SeekableRecordCursor>
getCursor(OperationContext*
opCtx,
94 bool forward)
const final;
104 BSONObjBuilder* output);
107 BSONObjBuilder* result,
110 virtual Status touch(OperationContext*
opCtx, BSONObjBuilder* output)
const;
115 BSONObjBuilder* extraInfo = NULL,
116 int infoLevel = 0)
const;
127 const RecordId& startingPosition)
const;
148 boost::shared_array<char>
data;
159 typedef std::map<RecordId, EphemeralForTestRecord>
Records;
171 class TruncateChange;
virtual bool findRecord(OperationContext *opCtx, const RecordId &loc, RecordData *rd) const
Definition: ephemeral_for_test_record_store.cpp:327
ValidateCmdLevel
Definition: record_store.h:93
virtual Status validate(OperationContext *opCtx, ValidateCmdLevel level, ValidateAdaptor *adaptor, ValidateResults *results, BSONObjBuilder *output)
Definition: ephemeral_for_test_record_store.cpp:577
void cappedDeleteAsNeeded_inlock(OperationContext *opCtx)
Definition: ephemeral_for_test_record_store.cpp:367
virtual Status insertRecordsWithDocWriter(OperationContext *opCtx, const DocWriter *const *docs, const Timestamp *, size_t nDocs, RecordId *idsOut)
Inserts nDocs documents into this RecordStore using the DocWriter interface.
Definition: ephemeral_for_test_record_store.cpp:431
Definition: record_store.h:673
A RecordStore that stores all data in-memory.
Definition: ephemeral_for_test_record_store.h:48
virtual void appendCustomStats(OperationContext *opCtx, BSONObjBuilder *result, double scale) const
Definition: ephemeral_for_test_record_store.cpp:605
const int64_t _cappedMaxDocs
Definition: ephemeral_for_test_record_store.h:186
virtual long long dataSize(OperationContext *opCtx) const
The dataSize is an approximation of the sum of the sizes (in bytes) of the documents or entries in th...
Definition: ephemeral_for_test_record_store.h:118
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
bool cappedAndNeedDelete_inlock(OperationContext *opCtx) const
Definition: ephemeral_for_test_record_store.cpp:354
A replacement for the Record class.
Definition: record_data.h:43
CappedCallback * _cappedCallback
Definition: ephemeral_for_test_record_store.h:187
virtual const EphemeralForTestRecord * recordFor(const RecordId &loc) const
Definition: ephemeral_for_test_record_store.cpp:305
const bool isOplog
Definition: ephemeral_for_test_record_store.h:198
virtual Status truncate(OperationContext *opCtx)
removes all Records
Definition: ephemeral_for_test_record_store.cpp:550
EphemeralForTestRecord(int size)
Definition: ephemeral_for_test_record_store.h:141
This is so when a RecordStore is validating all records it can call back to someone to check if a rec...
Definition: record_store.h:687
Definition: record_store.h:78
RecordId allocateLoc()
Definition: ephemeral_for_test_record_store.cpp:638
const bool _isCapped
Definition: ephemeral_for_test_record_store.h:184
void deleteRecord_inlock(OperationContext *opCtx, const RecordId &dl)
Definition: ephemeral_for_test_record_store.cpp:346
bool inclusive
Definition: btree_interface.cpp:335
virtual StatusWith< RecordId > insertRecord(OperationContext *opCtx, const char *data, int len, Timestamp, bool enforceQuota)
Definition: ephemeral_for_test_record_store.cpp:400
virtual void deleteRecord(OperationContext *opCtx, const RecordId &dl)
Definition: ephemeral_for_test_record_store.cpp:340
Allows inserting a Record "in-place" without creating a copy ahead of time.
Definition: record_store.h:62
std::shared_ptr< void > data
Definition: ephemeral_for_test_record_store_test.cpp:74
Data(StringData ns, bool isOplog)
Definition: ephemeral_for_test_record_store.h:191
virtual int64_t storageSize(OperationContext *opCtx, BSONObjBuilder *extraInfo=NULL, int infoLevel=0) const
Definition: ephemeral_for_test_record_store.cpp:630
stdx::recursive_mutex recordsMutex
Definition: ephemeral_for_test_record_store.h:195
virtual bool updateWithDamagesSupported() const
Definition: ephemeral_for_test_record_store.cpp:505
Records records
Definition: ephemeral_for_test_record_store.h:196
Definition: ephemeral_for_test_record_store.h:190
OperationContext Database StringData CollectionOptions bool const BSONObj &idIndex Status
Definition: database_impl.cpp:955
virtual boost::optional< RecordId > oplogStartHack(OperationContext *opCtx, const RecordId &startingPosition) const
Return the RecordId of an oplog entry as close to startingPosition as possible without being higher.
Definition: ephemeral_for_test_record_store.cpp:644
EphemeralForTestRecord()
Definition: ephemeral_for_test_record_store.h:140
virtual RecordData dataFor(OperationContext *opCtx, const RecordId &loc) const
Get the RecordData at loc, which must exist.
Definition: ephemeral_for_test_record_store.cpp:299
virtual void increaseStorageSize(OperationContext *opCtx, int size, bool enforceQuota)
Definition: ephemeral_for_test_record_store.cpp:623
Definition: index_key_validate.h:40
virtual StatusWith< RecordData > updateWithDamages(OperationContext *opCtx, const RecordId &loc, const RecordData &oldRec, const char *damageSource, const mutablebson::DamageVector &damages)
Updates the record positioned at 'loc' in-place using the deltas described by 'damages'.
Definition: ephemeral_for_test_record_store.cpp:509
EphemeralForTestRecordStore(StringData ns, std::shared_ptr< void > *dataInOut, bool isCapped=false, int64_t cappedMaxSize=-1, int64_t cappedMaxDocs=-1, CappedCallback *cappedCallback=nullptr)
Definition: ephemeral_for_test_record_store.cpp:269
Definition: ephemeral_for_test_record_store.h:139
virtual void updateStatsAfterRepair(OperationContext *opCtx, long long numRecords, long long dataSize)
Called after a repair operation is run with the recomputed numRecords and dataSize.
Definition: ephemeral_for_test_record_store.h:131
An abstraction used for storing documents in a collection or entries in an index.
Definition: record_store.h:282
When a capped collection is modified (delete/insert/etc) then certain notifications need to be made,...
Definition: capped_callback.h:44
virtual const std::string & ns() const
Definition: record_store.h:295
void setCappedCallback(CappedCallback *cb)
Definition: ephemeral_for_test_record_store.h:164
int64_t nextId
Definition: ephemeral_for_test_record_store.h:197
const int64_t _cappedMaxSize
Definition: ephemeral_for_test_record_store.h:185
virtual Status touch(OperationContext *opCtx, BSONObjBuilder *output) const
Load all data into cache.
Definition: ephemeral_for_test_record_store.cpp:615
RecordData toRecordData() const
Definition: ephemeral_for_test_record_store.h:143
boost::shared_array< char > data
Definition: ephemeral_for_test_record_store.h:148
virtual long long numRecords(OperationContext *opCtx) const
Total number of record in the RecordStore.
Definition: ephemeral_for_test_record_store.h:122
virtual void cappedTruncateAfter(OperationContext *opCtx, RecordId end, bool inclusive)
Truncate documents newer than the document at 'end' from the capped collection.
Definition: ephemeral_for_test_record_store.cpp:557
Data *const _data
Definition: ephemeral_for_test_record_store.h:201
void waitForAllEarlierOplogWritesToBeVisible(OperationContext *opCtx) const override
Waits for all writes that completed before this call to be visible to forward scans.
Definition: ephemeral_for_test_record_store.h:129
bool isCapped() const
Definition: ephemeral_for_test_record_store.h:161
StatusWith< RecordId > extractAndCheckLocForOplog(const char *data, int len) const
Definition: ephemeral_for_test_record_store.cpp:382
int size
Definition: ephemeral_for_test_record_store.h:147
std::unique_ptr< SeekableRecordCursor > getCursor(OperationContext *opCtx, bool forward) const final
Returns a new cursor over this record store.
Definition: ephemeral_for_test_record_store.cpp:543
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
virtual Status updateRecord(OperationContext *opCtx, const RecordId &oldLocation, const char *data, int len, bool enforceQuota, UpdateNotifier *notifier)
Definition: ephemeral_for_test_record_store.cpp:472
const std::string & getIdent() const override
Definition: ephemeral_for_test_record_store.h:59
virtual const char * name() const
Definition: ephemeral_for_test_record_store.cpp:295
int64_t dataSize
Definition: ephemeral_for_test_record_store.h:194
std::map< RecordId, EphemeralForTestRecord > Records
Definition: ephemeral_for_test_record_store.h:159