![]() |
Storage Engine API
|
#include <mobile_index.h>
Classes | |
class | BulkBuilderBase |
class | BulkBuilderStandard |
Bulk builds a non-unique index. More... | |
class | BulkBuilderUnique |
Bulk builds a unique index. More... | |
Public Member Functions | |
MobileIndex (OperationContext *opCtx, const IndexDescriptor *desc, const std::string &ident) | |
MobileIndex (bool isUnique, const Ordering &ordering, const std::string &ident) | |
virtual | ~MobileIndex () |
Status | insert (OperationContext *opCtx, const BSONObj &key, const RecordId &recId, bool dupsAllowed) override |
Insert an entry into the index with the specified key and RecordId. More... | |
void | unindex (OperationContext *opCtx, const BSONObj &key, const RecordId &recId, bool dupsAllowed) override |
Remove the entry from the index with the specified key and RecordId. More... | |
void | fullValidate (OperationContext *opCtx, long long *numKeysOut, ValidateResults *fullResults) const override |
Note: this validates the entire database file, not just the table used by this index. More... | |
bool | appendCustomStats (OperationContext *opCtx, BSONObjBuilder *output, double scale) const override |
long long | getSpaceUsedBytes (OperationContext *opCtx) const override |
Return the number of bytes consumed by 'this' index. More... | |
long long | numEntries (OperationContext *opCtx) const override |
Return the number of entries in 'this' index. More... | |
bool | isEmpty (OperationContext *opCtx) override |
Return true if 'this' index is empty, and false otherwise. More... | |
Status | initAsEmpty (OperationContext *opCtx) override |
Status | dupKeyCheck (OperationContext *opCtx, const BSONObj &key, const RecordId &recId) override |
Return ErrorCodes::DuplicateKey if 'key' already exists in 'this' index at a RecordId other than 'loc', and Status::OK() otherwise. More... | |
template<typename ValueType > | |
Status | doInsert (OperationContext *opCtx, const KeyString &key, const ValueType &value, bool isTransactional=true) |
Performs the insert into the table with the given key and value. More... | |
Ordering | getOrdering () const |
KeyString::Version | getKeyStringVersion () const |
bool | isUnique () |
std::string | getIdent () const |
![]() | |
virtual | ~SortedDataInterface () |
virtual SortedDataBuilderInterface * | getBulkBuilder (OperationContext *opCtx, bool dupsAllowed)=0 |
Return a bulk builder for 'this' index. More... | |
virtual Status | compact (OperationContext *opCtx) |
Attempt to reduce the storage space used by this index via compaction. More... | |
virtual Status | touch (OperationContext *opCtx) const |
Attempt to bring the entirety of 'this' index into memory. More... | |
virtual std::unique_ptr< Cursor > | newCursor (OperationContext *opCtx, bool isForward=true) const =0 |
Returns an unpositioned cursor over 'this' index. More... | |
virtual std::unique_ptr< Cursor > | newRandomCursor (OperationContext *opCtx) const |
Constructs a cursor over an index that returns entries in a randomized order, and allows storage engines to provide a more efficient way to randomly sample a collection than MongoDB's default sampling methods, which are used when this method returns {}. More... | |
Static Public Member Functions | |
static Status | create (OperationContext *opCtx, const std::string &ident) |
Creates a SQLite table suitable for a new Mobile index. More... | |
Protected Member Functions | |
bool | _isDup (OperationContext *opCtx, const BSONObj &key, RecordId recId) |
Status | _dupKeyError (const BSONObj &key) |
void | _doDelete (OperationContext *opCtx, const KeyString &key, KeyString *value=nullptr) |
Performs the deletion from the table matching the given key. More... | |
virtual Status | _insert (OperationContext *opCtx, const BSONObj &key, const RecordId &recId, bool dupsAllowed)=0 |
virtual void | _unindex (OperationContext *opCtx, const BSONObj &key, const RecordId &recId, bool dupsAllowed)=0 |
Static Protected Member Functions | |
static Status | _checkKeySize (const BSONObj &key) |
Checks if key size is too long. More... | |
Protected Attributes | |
const bool | _isUnique |
const Ordering | _ordering |
const KeyString::Version | _keyStringVersion = KeyString::kLatestVersion |
const std::string | _ident |
mongo::MobileIndex::MobileIndex | ( | OperationContext * | opCtx, |
const IndexDescriptor * | desc, | ||
const std::string & | ident | ||
) |
mongo::MobileIndex::MobileIndex | ( | bool | isUnique, |
const Ordering & | ordering, | ||
const std::string & | ident | ||
) |
|
inlinevirtual |
|
staticprotected |
Checks if key size is too long.
|
protected |
Performs the deletion from the table matching the given key.
|
protected |
|
protectedpure virtual |
Implemented in mongo::MobileIndexUnique, and mongo::MobileIndexStandard.
|
protected |
|
protectedpure virtual |
Implemented in mongo::MobileIndexUnique, and mongo::MobileIndexStandard.
|
overridevirtual |
Implements mongo::SortedDataInterface.
|
static |
Creates a SQLite table suitable for a new Mobile index.
Status mongo::MobileIndex::doInsert | ( | OperationContext * | opCtx, |
const KeyString & | key, | ||
const ValueType & | value, | ||
bool | isTransactional = true |
||
) |
Performs the insert into the table with the given key and value.
|
overridevirtual |
Return ErrorCodes::DuplicateKey if 'key' already exists in 'this' index at a RecordId other than 'loc', and Status::OK() otherwise.
opCtx | the transaction under which this operation takes place |
TODO: Hide this by exposing an update method?
Implements mongo::SortedDataInterface.
|
overridevirtual |
Note: this validates the entire database file, not just the table used by this index.
Implements mongo::SortedDataInterface.
|
inline |
|
inline |
|
inline |
|
overridevirtual |
Return the number of bytes consumed by 'this' index.
opCtx | the transaction under which this operation takes place |
Implements mongo::SortedDataInterface.
|
overridevirtual |
Implements mongo::SortedDataInterface.
|
overridevirtual |
Insert an entry into the index with the specified key and RecordId.
opCtx | the transaction under which the insert takes place |
dupsAllowed | true if duplicate keys are allowed, and false otherwise |
ErrorCodes::DuplicateKey if 'key' already exists in 'this' index at a RecordId other than 'loc' and duplicates were not allowed
Implements mongo::SortedDataInterface.
|
overridevirtual |
Return true if 'this' index is empty, and false otherwise.
Implements mongo::SortedDataInterface.
|
inline |
|
overridevirtual |
Return the number of entries in 'this' index.
The default implementation should be overridden with a more efficient one if at all possible.
Reimplemented from mongo::SortedDataInterface.
|
overridevirtual |
Remove the entry from the index with the specified key and RecordId.
opCtx | the transaction under which the remove takes place |
dupsAllowed | true if duplicate keys are allowed, and false otherwise |
Implements mongo::SortedDataInterface.
|
protected |
|
protected |
|
protected |
|
protected |