![]() |
Storage Engine API
|
this is NOT safe through a yield right now. More...
#include <collection.h>
this is NOT safe through a yield right now.
not sure if it will be, or what yet.
Classes | |
class | Impl |
struct | TUHook |
Public Types | |
enum | ValidationAction { WARN, ERROR_V } |
enum | ValidationLevel { OFF, MODERATE, STRICT_V } |
enum | StoreDeletedDoc { StoreDeletedDoc::Off, StoreDeletedDoc::On } |
Public Member Functions | |
Collection (OperationContext *const opCtx, const StringData fullNS, OptionalCollectionUUID uuid, CollectionCatalogEntry *const details, RecordStore *const recordStore, DatabaseCatalogEntry *const dbce) | |
Collection (std::unique_ptr< Impl > mock) | |
~Collection ()=default | |
bool | ok () const |
CollectionCatalogEntry * | getCatalogEntry () |
const CollectionCatalogEntry * | getCatalogEntry () const |
CollectionInfoCache * | infoCache () |
const CollectionInfoCache * | infoCache () const |
const NamespaceString & | ns () const |
OptionalCollectionUUID | uuid () const |
void | refreshUUID (OperationContext *opCtx) |
const IndexCatalog * | getIndexCatalog () const |
IndexCatalog * | getIndexCatalog () |
const RecordStore * | getRecordStore () const |
RecordStore * | getRecordStore () |
CursorManager * | getCursorManager () const |
bool | requiresIdIndex () const |
Snapshotted< BSONObj > | docFor (OperationContext *const opCtx, const RecordId &loc) const |
bool | findDoc (OperationContext *const opCtx, const RecordId &loc, Snapshotted< BSONObj > *const out) const |
std::unique_ptr< SeekableRecordCursor > | getCursor (OperationContext *const opCtx, const bool forward=true) const |
std::vector< std::unique_ptr< RecordCursor > > | getManyCursors (OperationContext *const opCtx) const |
Returns many cursors that partition the Collection into many disjoint sets. More... | |
void | deleteDocument (OperationContext *const opCtx, StmtId stmtId, const RecordId &loc, OpDebug *const opDebug, const bool fromMigrate=false, const bool noWarn=false, StoreDeletedDoc storeDeletedDoc=StoreDeletedDoc::Off) |
Deletes the document with the given RecordId from the collection. More... | |
Status | insertDocuments (OperationContext *const opCtx, const std::vector< InsertStatement >::const_iterator begin, const std::vector< InsertStatement >::const_iterator end, OpDebug *const opDebug, const bool enforceQuota, const bool fromMigrate=false) |
Status | insertDocument (OperationContext *const opCtx, const InsertStatement &doc, OpDebug *const opDebug, const bool enforceQuota, const bool fromMigrate=false) |
this does NOT modify the doc before inserting i.e. More... | |
Status | insertDocumentsForOplog (OperationContext *const opCtx, const DocWriter *const *const docs, Timestamp *timestamps, const size_t nDocs) |
Callers must ensure no document validation is performed for this collection when calling this method. More... | |
Status | insertDocument (OperationContext *const opCtx, const BSONObj &doc, const std::vector< MultiIndexBlock *> &indexBlocks, const bool enforceQuota) |
Inserts a document into the record store and adds it to the MultiIndexBlocks passed in. More... | |
RecordId | updateDocument (OperationContext *const opCtx, const RecordId &oldLocation, const Snapshotted< BSONObj > &oldDoc, const BSONObj &newDoc, const bool enforceQuota, const bool indexesAffected, OpDebug *const opDebug, OplogUpdateEntryArgs *const args) |
Updates the document @ oldLocation with newDoc. More... | |
bool | updateWithDamagesSupported () const |
StatusWith< RecordData > | updateDocumentWithDamages (OperationContext *const opCtx, const RecordId &loc, const Snapshotted< RecordData > &oldRec, const char *const damageSource, const mutablebson::DamageVector &damages, OplogUpdateEntryArgs *const args) |
Not allowed to modify indexes. More... | |
StatusWith< CompactStats > | compact (OperationContext *const opCtx, const CompactOptions *const options) |
Status | truncate (OperationContext *const opCtx) |
removes all documents as fast as possible indexes before and after will be the same as will other characteristics. More... | |
Status | validate (OperationContext *const opCtx, const ValidateCmdLevel level, bool background, std::unique_ptr< Lock::CollectionLock > collLk, ValidateResults *const results, BSONObjBuilder *const output) |
Status | touch (OperationContext *const opCtx, const bool touchData, const bool touchIndexes, BSONObjBuilder *const output) const |
forces data into cache. More... | |
void | cappedTruncateAfter (OperationContext *const opCtx, const RecordId end, const bool inclusive) |
Truncate documents newer than the document at 'end' from the capped collection. More... | |
StatusWithMatchExpression | parseValidator (OperationContext *opCtx, const BSONObj &validator, MatchExpressionParser::AllowedFeatureSet allowedFeatures, boost::optional< ServerGlobalParams::FeatureCompatibility::Version > maxFeatureCompatibilityVersion) const |
Returns a non-ok Status if validator is not legal for this collection. More... | |
Status | setValidator (OperationContext *const opCtx, const BSONObj validator) |
Sets the validator for this collection. More... | |
Status | setValidationLevel (OperationContext *const opCtx, const StringData newLevel) |
Status | setValidationAction (OperationContext *const opCtx, const StringData newAction) |
StringData | getValidationLevel () const |
StringData | getValidationAction () const |
Status | updateValidator (OperationContext *opCtx, BSONObj newValidator, StringData newLevel, StringData newAction) |
bool | isCapped () const |
std::shared_ptr< CappedInsertNotifier > | getCappedInsertNotifier () const |
Get a pointer to a capped insert notifier object. More... | |
uint64_t | numRecords (OperationContext *const opCtx) const |
uint64_t | dataSize (OperationContext *const opCtx) const |
int | averageObjectSize (OperationContext *const opCtx) const |
uint64_t | getIndexSize (OperationContext *const opCtx, BSONObjBuilder *const details=nullptr, const int scale=1) |
boost::optional< Timestamp > | getMinimumVisibleSnapshot () |
If return value is not boost::none, reads with majority read concern using an older snapshot must error. More... | |
void | setMinimumVisibleSnapshot (const Timestamp name) |
bool | haveCappedWaiters () |
Returns true if there may be waiters. More... | |
void | notifyCappedWaitersIfNeeded () |
Notify (capped collection) waiters of data changes, like an insert. More... | |
const CollatorInterface * | getDefaultCollator () const |
Get a pointer to the collection's default collator. More... | |
Static Public Member Functions | |
static | MONGO_DECLARE_SHIM ((Collection *_this, OperationContext *opCtx, StringData fullNS, OptionalCollectionUUID uuid, CollectionCatalogEntry *details, RecordStore *recordStore, DatabaseCatalogEntry *dbce, PrivateTo< Collection >) ->std::unique_ptr< Impl >) makeImpl |
static | MONGO_DECLARE_SHIM ((StringData) ->StatusWith< ValidationLevel >) parseValidationLevel |
static | MONGO_DECLARE_SHIM ((StringData) ->StatusWith< ValidationAction >) parseValidationAction |
Private Member Functions | |
DatabaseCatalogEntry * | dbce () const |
CollectionCatalogEntry * | details () const |
Status | aboutToDeleteCapped (OperationContext *const opCtx, const RecordId &loc, const RecordData data) final |
This will be called right before loc is deleted when wrapping. More... | |
Status | recordStoreGoingToUpdateInPlace (OperationContext *const opCtx, const RecordId &loc) final |
const Impl & | _impl () const |
Impl & | _impl () |
![]() | |
virtual | ~CappedCallback () |
![]() | |
virtual | ~UpdateNotifier () |
Private Attributes | |
std::unique_ptr< Impl > | _pimpl |
Friends | |
class | DatabaseImpl |
class | IndexCatalogImpl |
|
strong |
|
inlineexplicit |
|
inlineexplicit |
|
inlinedefault |
|
inlineprivate |
|
inlineprivate |
|
inlinefinalprivatevirtual |
This will be called right before loc is deleted when wrapping.
If data is unowned, it is only valid inside of this call. If implementations wish to stash a pointer, they must copy it.
Implements mongo::CappedCallback.
|
inline |
|
inline |
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.
inclusive | - Truncate 'end' as well iff true |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
Deletes the document with the given RecordId from the collection.
'fromMigrate' indicates whether the delete was induced by a chunk migration, and so should be ignored by the user as an internal maintenance operation and not a real delete. 'loc' key to uniquely identify a record in a collection. 'opDebug' Optional argument. When not null, will be used to record operation statistics. 'cappedOK' if true, allows deletes on capped collections (Cloner::copyDB uses this). 'noWarn' if unindexing the record causes an error, if noWarn is true the error will not be logged.
|
inlineprivate |
|
inline |
|
inline |
out | - contents set to the right docs if exists, or nothing. |
|
inline |
Get a pointer to a capped insert notifier object.
The caller can wait on this object until it is notified of a new insert into the capped collection.
It is invalid to call this method unless the collection is capped.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get a pointer to the collection's default collator.
The pointer must not be used after this Collection is destroyed.
|
inline |
|
inline |
|
inline |
|
inline |
Returns many cursors that partition the Collection into many disjoint sets.
Iterating all returned cursors is equivalent to iterating the full collection.
|
inline |
If return value is not boost::none, reads with majority read concern using an older snapshot must error.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Returns true if there may be waiters.
Implements mongo::CappedCallback.
|
inline |
|
inline |
|
inline |
this does NOT modify the doc before inserting i.e.
will not add an _id field for documents that are missing it
'opDebug' Optional argument. When not null, will be used to record operation statistics. 'enforceQuota' If false, quotas will be ignored.
|
inline |
Inserts a document into the record store and adds it to the MultiIndexBlocks passed in.
NOTE: It is up to caller to commit the indexes.
|
inline |
|
inline |
Callers must ensure no document validation is performed for this collection when calling this method.
|
inline |
|
static |
|
static |
|
static |
|
inlinevirtual |
Notify (capped collection) waiters of data changes, like an insert.
Implements mongo::CappedCallback.
|
inline |
|
inline |
|
inline |
|
inline |
Returns a non-ok Status if validator is not legal for this collection.
|
inlinefinalprivatevirtual |
Implements mongo::UpdateNotifier.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the validator for this collection.
An empty validator removes all validation. Requires an exclusive lock on the collection.
|
inline |
forces data into cache.
|
inline |
removes all documents as fast as possible indexes before and after will be the same as will other characteristics.
|
inline |
Updates the document @ oldLocation with newDoc.
If the document fits in the old space, it is put there; if not, it is moved. Sets 'args.updatedDoc' to the updated version of the document with damages applied, on success. 'opDebug' Optional argument. When not null, will be used to record operation statistics.
|
inline |
Not allowed to modify indexes.
Illegal to call if updateWithDamagesSupported() returns false. Sets 'args.updatedDoc' to the updated version of the document with damages applied, on success.
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
friend |
|
private |