Storage Engine API
mongo::SimpleRecordStoreV1 Class Reference

#include <record_store_v1_simple.h>

Inheritance diagram for mongo::SimpleRecordStoreV1:
mongo::RecordStoreV1Base mongo::RecordStore

Public Member Functions

 SimpleRecordStoreV1 (OperationContext *opCtx, StringData ns, RecordStoreV1MetaData *details, ExtentManager *em, bool isSystemIndexes)
 
virtual ~SimpleRecordStoreV1 ()
 
const char * name () const
 
std::unique_ptr< SeekableRecordCursorgetCursor (OperationContext *opCtx, bool forward) const final
 Returns a new cursor over this record store. More...
 
std::vector< std::unique_ptr< RecordCursor > > getManyCursors (OperationContext *opCtx) const final
 Returns many RecordCursors that partition the RecordStore into many disjoint sets. More...
 
virtual Status truncate (OperationContext *opCtx)
 removes all Records More...
 
virtual void cappedTruncateAfter (OperationContext *opCtx, RecordId end, bool inclusive)
 Truncate documents newer than the document at 'end' from the capped collection. More...
 
virtual bool compactSupported () const
 does this RecordStore support the compact operation? More...
 
virtual bool compactsInPlace () const
 Does compact() leave RecordIds alone or can they change. More...
 
virtual Status compact (OperationContext *opCtx, RecordStoreCompactAdaptor *adaptor, const CompactOptions *options, CompactStats *stats)
 Attempt to reduce the storage space used by this RecordStore. More...
 
- Public Member Functions inherited from mongo::RecordStoreV1Base
 RecordStoreV1Base (StringData ns, RecordStoreV1MetaData *details, ExtentManager *em, bool isSystemIndexes)
 
virtual ~RecordStoreV1Base ()
 
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 the recordStore. More...
 
virtual long long numRecords (OperationContext *opCtx) const
 Total number of record in the RecordStore. More...
 
virtual int64_t storageSize (OperationContext *opCtx, BSONObjBuilder *extraInfo=NULL, int level=0) const
 
virtual RecordData dataFor (OperationContext *opCtx, const RecordId &loc) const
 Get the RecordData at loc, which must exist. More...
 
virtual bool findRecord (OperationContext *opCtx, const RecordId &loc, RecordData *rd) const
 
void deleteRecord (OperationContext *opCtx, const RecordId &dl)
 
StatusWith< RecordId > insertRecord (OperationContext *opCtx, const char *data, int len, Timestamp, bool enforceQuota)
 
Status insertRecordsWithDocWriter (OperationContext *opCtx, const DocWriter *const *docs, const Timestamp *, size_t nDocs, RecordId *idsOut) final
 Inserts nDocs documents into this RecordStore using the DocWriter interface. More...
 
virtual Status updateRecord (OperationContext *opCtx, const RecordId &oldLocation, const char *data, int len, bool enforceQuota, UpdateNotifier *notifier)
 
virtual bool updateWithDamagesSupported () const
 
virtual StatusWith< RecordDataupdateWithDamages (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'. More...
 
virtual std::unique_ptr< RecordCursorgetCursorForRepair (OperationContext *opCtx) const
 Constructs a cursor over a potentially corrupted store, which can be used to salvage damaged records. More...
 
void increaseStorageSize (OperationContext *opCtx, int size, bool enforceQuota)
 
virtual Status validate (OperationContext *opCtx, ValidateCmdLevel level, ValidateAdaptor *adaptor, ValidateResults *results, BSONObjBuilder *output)
 
virtual void appendCustomStats (OperationContext *opCtx, BSONObjBuilder *result, double scale) const
 
virtual Status touch (OperationContext *opCtx, BSONObjBuilder *output) const
 Load all data into cache. More...
 
const RecordStoreV1MetaDatadetails () const
 
DiskLoc getExtentLocForRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc getNextRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc getPrevRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc getNextRecordInExtent (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc getPrevRecordInExtent (OperationContext *opCtx, const DiskLoc &loc) const
 
void waitForAllEarlierOplogWritesToBeVisible (OperationContext *opCtx) const override
 Waits for all writes that completed before this call to be visible to forward scans. More...
 
virtual void updateStatsAfterRepair (OperationContext *opCtx, long long numRecords, long long dataSize)
 Called after a repair operation is run with the recomputed numRecords and dataSize. More...
 
- Public Member Functions inherited from mongo::RecordStore
 RecordStore (StringData ns)
 
virtual ~RecordStore ()
 
virtual const std::string & ns () const
 
virtual void setCappedCallback (CappedCallback *)
 
virtual Status insertRecords (OperationContext *opCtx, std::vector< Record > *records, std::vector< Timestamp > *timestamps, bool enforceQuota)
 
StatusWith< RecordId > insertRecordWithDocWriter (OperationContext *opCtx, const DocWriter *doc, Timestamp timestamp)
 A thin wrapper around insertRecordsWithDocWriter() to simplify handling of single DocWriters. More...
 
virtual std::unique_ptr< RecordCursorgetRandomCursor (OperationContext *opCtx) const
 Constructs a cursor over a record store that returns documents in a randomized order, and allows storage engines to provide a more efficient way of random sampling of a record store than MongoDB's default sampling methods, which is used when this method returns {}. More...
 
virtual bool isInRecordIdOrder () const
 Does the RecordStore cursor retrieve its document in RecordId Order? More...
 
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. More...
 
virtual Status oplogDiskLocRegister (OperationContext *opCtx, const Timestamp &opTime, bool orderedCommit)
 When we write to an oplog, we call this so that if the storage engine supports doc locking, it can manage the visibility of oplog entries to ensure they are ordered. More...
 
virtual Status updateCappedSize (OperationContext *opCtx, long long cappedSize)
 used to support online change oplog size. More...
 

Protected Member Functions

virtual bool isCapped () const
 
virtual bool shouldPadInserts () const
 
virtual StatusWith< DiskLocallocRecord (OperationContext *opCtx, int lengthWithHeaders, bool enforceQuota)
 
virtual void addDeletedRec (OperationContext *opCtx, const DiskLoc &dloc)
 
- Protected Member Functions inherited from mongo::RecordStoreV1Base
virtual MmapV1RecordHeaderrecordFor (const DiskLoc &loc) const
 
const DeletedRecorddeletedRecordFor (const DiskLoc &loc) const
 
virtual DeletedRecorddrec (const DiskLoc &loc) const
 
Extent_getExtent (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _getExtentLocForRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _getNextRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _getPrevRecord (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _getNextRecordInExtent (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _getPrevRecordInExtent (OperationContext *opCtx, const DiskLoc &loc) const
 
DiskLoc _findFirstSpot (OperationContext *opCtx, const DiskLoc &extDiskLoc, Extent *e)
 finds the first suitable DiskLoc for data will return the DiskLoc of a newly created DeletedRecord More...
 
void _addRecordToRecListInExtent (OperationContext *opCtx, MmapV1RecordHeader *r, DiskLoc loc)
 add a record to the end of the linked list chain within this extent. More...
 
StatusWith< RecordId > _insertRecord (OperationContext *opCtx, const char *data, int len, bool enforceQuota)
 internal doesn't check inputs or change padding More...
 

Private Member Functions

DiskLoc _allocFromExistingExtents (OperationContext *opCtx, int lengthWithHeaders)
 
void _compactExtent (OperationContext *opCtx, const DiskLoc diskloc, int extentNumber, RecordStoreCompactAdaptor *adaptor, const CompactOptions *compactOptions, CompactStats *stats)
 

Private Attributes

bool _normalCollection
 

Friends

class SimpleRecordStoreV1Iterator
 

Additional Inherited Members

- Static Public Member Functions inherited from mongo::RecordStoreV1Base
static int quantizeAllocationSpace (int minSize)
 Quantize 'minSize' to the nearest allocation size. More...
 
static bool isQuantized (int recordSize)
 
static int bucket (int size)
 
- Public Attributes inherited from mongo::RecordStoreV1Base
SavedCursorRegistry savedCursors
 
- Static Public Attributes inherited from mongo::RecordStoreV1Base
static const int Buckets = 26
 
static const int MaxAllowedAllocation = 16 * 1024 * 1024 + 512 * 1024
 
static const int bucketSizes []
 
- Protected Attributes inherited from mongo::RecordStoreV1Base
std::unique_ptr< RecordStoreV1MetaData_details
 
ExtentManager_extentManager
 
bool _isSystemIndexes
 
- Protected Attributes inherited from mongo::RecordStore
std::string _ns
 

Constructor & Destructor Documentation

◆ SimpleRecordStoreV1()

mongo::SimpleRecordStoreV1::SimpleRecordStoreV1 ( OperationContext *  opCtx,
StringData  ns,
RecordStoreV1MetaData details,
ExtentManager em,
bool  isSystemIndexes 
)

◆ ~SimpleRecordStoreV1()

mongo::SimpleRecordStoreV1::~SimpleRecordStoreV1 ( )
virtual

Member Function Documentation

◆ _allocFromExistingExtents()

DiskLoc mongo::SimpleRecordStoreV1::_allocFromExistingExtents ( OperationContext *  opCtx,
int  lengthWithHeaders 
)
private

◆ _compactExtent()

void mongo::SimpleRecordStoreV1::_compactExtent ( OperationContext *  opCtx,
const DiskLoc  diskloc,
int  extentNumber,
RecordStoreCompactAdaptor adaptor,
const CompactOptions compactOptions,
CompactStats stats 
)
private

◆ addDeletedRec()

void mongo::SimpleRecordStoreV1::addDeletedRec ( OperationContext *  opCtx,
const DiskLoc dloc 
)
protectedvirtual

◆ allocRecord()

StatusWith< DiskLoc > mongo::SimpleRecordStoreV1::allocRecord ( OperationContext *  opCtx,
int  lengthWithHeaders,
bool  enforceQuota 
)
protectedvirtual

◆ cappedTruncateAfter()

virtual void mongo::SimpleRecordStoreV1::cappedTruncateAfter ( OperationContext *  opCtx,
RecordId  end,
bool  inclusive 
)
inlinevirtual

Truncate documents newer than the document at 'end' from the capped collection.

The collection cannot be completely emptied using this function. An assertion will be thrown if that is attempted.

Parameters
inclusive- Truncate 'end' as well iff true

Implements mongo::RecordStore.

◆ compact()

Status mongo::SimpleRecordStoreV1::compact ( OperationContext *  opCtx,
RecordStoreCompactAdaptor adaptor,
const CompactOptions options,
CompactStats stats 
)
virtual

Attempt to reduce the storage space used by this RecordStore.

Only called if compactSupported() returns true. No RecordStoreCompactAdaptor will be passed if compactsInPlace() returns true.

Reimplemented from mongo::RecordStore.

◆ compactsInPlace()

virtual bool mongo::SimpleRecordStoreV1::compactsInPlace ( ) const
inlinevirtual

Does compact() leave RecordIds alone or can they change.

Only called if compactSupported() returns true.

Reimplemented from mongo::RecordStore.

◆ compactSupported()

virtual bool mongo::SimpleRecordStoreV1::compactSupported ( ) const
inlinevirtual

does this RecordStore support the compact operation?

If you return true, you must provide implementations of all compact methods.

Reimplemented from mongo::RecordStore.

◆ getCursor()

std::unique_ptr< SeekableRecordCursor > mongo::SimpleRecordStoreV1::getCursor ( OperationContext *  opCtx,
bool  forward 
) const
finalvirtual

Returns a new cursor over this record store.

The cursor is logically positioned before the first (or last if !forward) Record in the collection so that Record will be returned on the first call to next(). Implementations are allowed to lazily seek to the first Record when next() is called rather than doing it on construction.

Implements mongo::RecordStore.

◆ getManyCursors()

vector< std::unique_ptr< RecordCursor > > mongo::SimpleRecordStoreV1::getManyCursors ( OperationContext *  opCtx) const
finalvirtual

Returns many RecordCursors that partition the RecordStore into many disjoint sets.

Iterating all returned RecordCursors is equivalent to iterating the full store.

Reimplemented from mongo::RecordStore.

◆ isCapped()

virtual bool mongo::SimpleRecordStoreV1::isCapped ( ) const
inlineprotectedvirtual

◆ name()

const char* mongo::SimpleRecordStoreV1::name ( ) const
inlinevirtual

Implements mongo::RecordStore.

◆ shouldPadInserts()

virtual bool mongo::SimpleRecordStoreV1::shouldPadInserts ( ) const
inlineprotectedvirtual

◆ truncate()

Status mongo::SimpleRecordStoreV1::truncate ( OperationContext *  opCtx)
virtual

removes all Records

Implements mongo::RecordStore.

Friends And Related Function Documentation

◆ SimpleRecordStoreV1Iterator

friend class SimpleRecordStoreV1Iterator
friend

Member Data Documentation

◆ _normalCollection

bool mongo::SimpleRecordStoreV1::_normalCollection
private

The documentation for this class was generated from the following files: