![]() |
Storage Engine API
|
#include <wiredtiger_index.h>
Classes | |
class | BulkBuilder |
Base class for WiredTigerIndex bulk builders. More... | |
class | StandardBulkBuilder |
Bulk builds a non-unique index. More... | |
class | UniqueBulkBuilder |
Bulk builds a unique index. More... | |
Public Member Functions | |
WiredTigerIndex (OperationContext *ctx, const std::string &uri, const IndexDescriptor *desc, KVPrefix prefix, bool readOnly) | |
virtual Status | insert (OperationContext *opCtx, const BSONObj &key, const RecordId &id, bool dupsAllowed) |
Insert an entry into the index with the specified key and RecordId. More... | |
virtual void | unindex (OperationContext *opCtx, const BSONObj &key, const RecordId &id, bool dupsAllowed) |
Remove the entry from the index with the specified key and RecordId. More... | |
virtual void | fullValidate (OperationContext *opCtx, long long *numKeysOut, ValidateResults *fullResults) const |
TODO: expose full set of args for testing? More... | |
virtual bool | appendCustomStats (OperationContext *opCtx, BSONObjBuilder *output, double scale) const |
virtual Status | dupKeyCheck (OperationContext *opCtx, const BSONObj &key, const RecordId &id) |
Return ErrorCodes::DuplicateKey if 'key' already exists in 'this' index at a RecordId other than 'loc', and Status::OK() otherwise. More... | |
virtual bool | isEmpty (OperationContext *opCtx) |
Return true if 'this' index is empty, and false otherwise. More... | |
virtual Status | touch (OperationContext *opCtx) const |
Attempt to bring the entirety of 'this' index into memory. More... | |
virtual long long | getSpaceUsedBytes (OperationContext *opCtx) const |
Return the number of bytes consumed by 'this' index. More... | |
virtual Status | initAsEmpty (OperationContext *opCtx) |
virtual Status | compact (OperationContext *opCtx) |
Attempt to reduce the storage space used by this index via compaction. More... | |
const std::string & | uri () const |
virtual bool | isDup (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id) |
uint64_t | tableId () const |
Ordering | ordering () const |
KeyString::Version | keyStringVersion () const |
std::string | collectionNamespace () const |
std::string | indexName () const |
bool | isIdIndex () const |
virtual bool | unique () const =0 |
virtual bool | isTimestampSafeUniqueIdx () const =0 |
Status | dupKeyError (const BSONObj &key) |
![]() | |
virtual | ~SortedDataInterface () |
virtual SortedDataBuilderInterface * | getBulkBuilder (OperationContext *opCtx, bool dupsAllowed)=0 |
Return a bulk builder for 'this' index. More... | |
virtual long long | numEntries (OperationContext *opCtx) const |
Return the number of entries in 'this' index. 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 StatusWith< std::string > | parseIndexOptions (const BSONObj &options) |
Parses index options for wired tiger configuration string suitable for table creation. More... | |
static std::string | generateAppMetadataString (const IndexDescriptor &desc) |
Creates the "app_metadata" string for the index from the index descriptor, to be stored in WiredTiger's metadata. More... | |
static StatusWith< std::string > | generateCreateString (const std::string &engineName, const std::string &sysIndexConfig, const std::string &collIndexConfig, const IndexDescriptor &desc, bool isPrefixed) |
Creates a configuration string suitable for 'config' parameter in WT_SESSION::create(). More... | |
static int | Create (OperationContext *opCtx, const std::string &uri, const std::string &config) |
Creates a WiredTiger table suitable for implementing a MongoDB index. More... | |
Protected Member Functions | |
virtual Status | _insert (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)=0 |
virtual void | _unindex (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)=0 |
void | setKey (WT_CURSOR *cursor, const WT_ITEM *item) |
Protected Attributes | |
const Ordering | _ordering |
KeyString::Version | _keyStringVersion |
int | _dataFormatVersion |
std::string | _uri |
uint64_t | _tableId |
std::string | _collectionNamespace |
std::string | _indexName |
KVPrefix | _prefix |
bool | _isIdIndex |
mongo::WiredTigerIndex::WiredTigerIndex | ( | OperationContext * | ctx, |
const std::string & | uri, | ||
const IndexDescriptor * | desc, | ||
KVPrefix | prefix, | ||
bool | readOnly | ||
) |
|
protectedpure virtual |
Implemented in mongo::WiredTigerIndexStandard, and mongo::WiredTigerIndexUnique.
|
protectedpure virtual |
Implemented in mongo::WiredTigerIndexStandard, and mongo::WiredTigerIndexUnique.
|
virtual |
Implements mongo::SortedDataInterface.
|
inline |
|
virtual |
Attempt to reduce the storage space used by this index via compaction.
Only called if the indexed record store supports compaction-in-place.
Reimplemented from mongo::SortedDataInterface.
|
static |
Creates a WiredTiger table suitable for implementing a MongoDB index.
'config' should be created with generateCreateString().
|
virtual |
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.
Status mongo::WiredTigerIndex::dupKeyError | ( | const BSONObj & | key | ) |
|
virtual |
TODO: expose full set of args for testing?
Implements mongo::SortedDataInterface.
|
static |
Creates the "app_metadata" string for the index from the index descriptor, to be stored in WiredTiger's metadata.
The output string is of the form: ",app_metadata=(...)," and can be appended to the config strings for WiredTiger's API calls.
|
static |
Creates a configuration string suitable for 'config' parameter in WT_SESSION::create().
Configuration string is constructed from: built-in defaults 'sysIndexConfig' 'collIndexConfig' storageEngine.wiredTiger.configString in index descriptor's info object. Performs simple validation on the supplied parameters. Returns error status if validation fails. Note that even if this function returns an OK status, WT_SESSION:create() may still fail with the constructed configuration string.
|
virtual |
Return the number of bytes consumed by 'this' index.
opCtx | the transaction under which this operation takes place |
Implements mongo::SortedDataInterface.
|
inline |
|
virtual |
Implements mongo::SortedDataInterface.
|
virtual |
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.
|
virtual |
Reimplemented in mongo::WiredTigerIndexUnique.
|
virtual |
Return true if 'this' index is empty, and false otherwise.
Implements mongo::SortedDataInterface.
|
inline |
|
pure virtual |
Implemented in mongo::WiredTigerIndexStandard, and mongo::WiredTigerIndexUnique.
|
inline |
|
inline |
|
static |
Parses index options for wired tiger configuration string suitable for table creation.
The document 'options' is typically obtained from the 'storageEngine.wiredTiger' field of an IndexDescriptor's info object.
|
protected |
|
inline |
|
virtual |
Attempt to bring the entirety of 'this' index into memory.
If the underlying storage engine does not support the operation, returns ErrorCodes::CommandNotSupported
Reimplemented from mongo::SortedDataInterface.
|
virtual |
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.
|
pure virtual |
Implemented in mongo::WiredTigerIndexStandard, and mongo::WiredTigerIndexUnique.
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |