Storage Engine API
mongo::WiredTigerIndexUnique Class Reference

#include <wiredtiger_index.h>

Inheritance diagram for mongo::WiredTigerIndexUnique:
mongo::WiredTigerIndex mongo::SortedDataInterface

Public Member Functions

 WiredTigerIndexUnique (OperationContext *ctx, const std::string &uri, const IndexDescriptor *desc, KVPrefix prefix, bool readOnly=false)
 
std::unique_ptr< SortedDataInterface::CursornewCursor (OperationContext *opCtx, bool forward) const override
 Returns an unpositioned cursor over 'this' index. More...
 
SortedDataBuilderInterfacegetBulkBuilder (OperationContext *opCtx, bool dupsAllowed) override
 Return a bulk builder for 'this' index. More...
 
bool unique () const override
 
bool isTimestampSafeUniqueIdx () const override
 
bool isDup (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id) override
 
Status _insert (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed) override
 
Status _insertTimestampUnsafe (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)
 
Status _insertTimestampSafe (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)
 
void _unindex (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed) override
 
void _unindexTimestampUnsafe (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)
 
void _unindexTimestampSafe (OperationContext *opCtx, WT_CURSOR *c, const BSONObj &key, const RecordId &id, bool dupsAllowed)
 
- Public Member Functions inherited from mongo::WiredTigerIndex
 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
 
uint64_t tableId () const
 
Ordering ordering () const
 
KeyString::Version keyStringVersion () const
 
std::string collectionNamespace () const
 
std::string indexName () const
 
bool isIdIndex () const
 
Status dupKeyError (const BSONObj &key)
 
- Public Member Functions inherited from mongo::SortedDataInterface
virtual ~SortedDataInterface ()
 
virtual long long numEntries (OperationContext *opCtx) const
 Return the number of entries in 'this' index. More...
 
virtual std::unique_ptr< CursornewRandomCursor (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...
 

Private Attributes

bool _partial
 

Additional Inherited Members

- Static Public Member Functions inherited from mongo::WiredTigerIndex
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 inherited from mongo::WiredTigerIndex
void setKey (WT_CURSOR *cursor, const WT_ITEM *item)
 
- Protected Attributes inherited from mongo::WiredTigerIndex
const Ordering _ordering
 
KeyString::Version _keyStringVersion
 
int _dataFormatVersion
 
std::string _uri
 
uint64_t _tableId
 
std::string _collectionNamespace
 
std::string _indexName
 
KVPrefix _prefix
 
bool _isIdIndex
 

Constructor & Destructor Documentation

◆ WiredTigerIndexUnique()

mongo::WiredTigerIndexUnique::WiredTigerIndexUnique ( OperationContext *  ctx,
const std::string &  uri,
const IndexDescriptor *  desc,
KVPrefix  prefix,
bool  readOnly = false 
)

Member Function Documentation

◆ _insert()

Status mongo::WiredTigerIndexUnique::_insert ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)
overridevirtual

◆ _insertTimestampSafe()

Status mongo::WiredTigerIndexUnique::_insertTimestampSafe ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)

◆ _insertTimestampUnsafe()

Status mongo::WiredTigerIndexUnique::_insertTimestampUnsafe ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)

◆ _unindex()

void mongo::WiredTigerIndexUnique::_unindex ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)
overridevirtual

◆ _unindexTimestampSafe()

void mongo::WiredTigerIndexUnique::_unindexTimestampSafe ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)

◆ _unindexTimestampUnsafe()

void mongo::WiredTigerIndexUnique::_unindexTimestampUnsafe ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id,
bool  dupsAllowed 
)

◆ getBulkBuilder()

SortedDataBuilderInterface * mongo::WiredTigerIndexUnique::getBulkBuilder ( OperationContext *  opCtx,
bool  dupsAllowed 
)
overridevirtual

Return a bulk builder for 'this' index.

Implementations can assume that 'this' index outlives its bulk builder.

Parameters
opCtxthe transaction under which keys are added to 'this' index
dupsAllowedtrue if duplicate keys are allowed, and false otherwise
Returns
caller takes ownership

Implements mongo::SortedDataInterface.

◆ isDup()

bool mongo::WiredTigerIndexUnique::isDup ( OperationContext *  opCtx,
WT_CURSOR *  c,
const BSONObj &  key,
const RecordId &  id 
)
overridevirtual

Reimplemented from mongo::WiredTigerIndex.

◆ isTimestampSafeUniqueIdx()

bool mongo::WiredTigerIndexUnique::isTimestampSafeUniqueIdx ( ) const
overridevirtual

◆ newCursor()

std::unique_ptr< SortedDataInterface::Cursor > mongo::WiredTigerIndexUnique::newCursor ( OperationContext *  opCtx,
bool  isForward 
) const
overridevirtual

Returns an unpositioned cursor over 'this' index.

Implementations can assume that 'this' index outlives all cursors it produces.

Implements mongo::SortedDataInterface.

◆ unique()

bool mongo::WiredTigerIndexUnique::unique ( ) const
inlineoverridevirtual

Member Data Documentation

◆ _partial

bool mongo::WiredTigerIndexUnique::_partial
private

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