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;
63 virtual void deleteRecord(OperationContext* opCtx,
const RecordId& dl);
66 OperationContext* opCtx,
const char*
data,
int len, Timestamp,
bool enforceQuota);
75 const RecordId& oldLocation,
86 const char* damageSource,
87 const mutablebson::DamageVector& damages);
89 std::unique_ptr<SeekableRecordCursor>
getCursor(OperationContext* opCtx,
90 bool forward)
const final;
100 BSONObjBuilder* output);
103 BSONObjBuilder* result,
106 virtual Status touch(OperationContext* opCtx, BSONObjBuilder* output)
const;
110 virtual int64_t
storageSize(OperationContext* opCtx,
111 BSONObjBuilder* extraInfo = NULL,
112 int infoLevel = 0)
const;
114 virtual long long dataSize(OperationContext* opCtx)
const {
118 virtual long long numRecords(OperationContext* opCtx)
const {
122 virtual boost::optional<RecordId>
oplogStartHack(OperationContext* opCtx,
123 const RecordId& startingPosition)
const;
144 boost::shared_array<char>
data;
155 typedef std::map<RecordId, EphemeralForTestRecord>
Records;
187 Data(StringData ns,
bool isOplog)
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:671
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:182
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:114
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
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:183
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:194
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:137
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:685
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:180
void deleteRecord_inlock(OperationContext *opCtx, const RecordId &dl)
Definition: ephemeral_for_test_record_store.cpp:346
bool inclusive
Definition: btree_interface.cpp:335
Definition: ephemeral_for_test_record_store.cpp:126
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
Definition: ephemeral_for_test_record_store.cpp:72
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:187
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:191
virtual bool updateWithDamagesSupported() const
Definition: ephemeral_for_test_record_store.cpp:505
Records records
Definition: ephemeral_for_test_record_store.h:192
Definition: ephemeral_for_test_record_store.h:186
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:136
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
Definition: ephemeral_for_test_record_store.cpp:189
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:135
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:127
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:160
Definition: ephemeral_for_test_record_store.cpp:50
int64_t nextId
Definition: ephemeral_for_test_record_store.h:193
const int64_t _cappedMaxSize
Definition: ephemeral_for_test_record_store.h:181
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:139
boost::shared_array< char > data
Definition: ephemeral_for_test_record_store.h:144
Definition: ephemeral_for_test_record_store.cpp:100
std::uint64_t nextId
Definition: d_concurrency.cpp:104
virtual long long numRecords(OperationContext *opCtx) const
Total number of record in the RecordStore.
Definition: ephemeral_for_test_record_store.h:118
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:197
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:125
bool isCapped() const
Definition: ephemeral_for_test_record_store.h:157
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:143
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
virtual const char * name() const
Definition: ephemeral_for_test_record_store.cpp:295
int64_t dataSize
Definition: ephemeral_for_test_record_store.h:190
std::map< RecordId, EphemeralForTestRecord > Records
Definition: ephemeral_for_test_record_store.h:155