本文整理汇总了C++中IndexDescriptor::indexNamespace方法的典型用法代码示例。如果您正苦于以下问题:C++ IndexDescriptor::indexNamespace方法的具体用法?C++ IndexDescriptor::indexNamespace怎么用?C++ IndexDescriptor::indexNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IndexDescriptor
的用法示例。
在下文中一共展示了IndexDescriptor::indexNamespace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renameCollection
Status Database::renameCollection( OperationContext* txn,
StringData fromNS,
StringData toNS,
bool stayTemp ) {
audit::logRenameCollection( currentClient.get(), fromNS, toNS );
invariant(txn->lockState()->isDbLockedForMode(name(), MODE_X));
{ // remove anything cached
Collection* coll = getCollection( fromNS );
if ( !coll )
return Status( ErrorCodes::NamespaceNotFound, "collection not found to rename" );
IndexCatalog::IndexIterator ii = coll->getIndexCatalog()->getIndexIterator( txn, true );
while ( ii.more() ) {
IndexDescriptor* desc = ii.next();
_clearCollectionCache( txn, desc->indexNamespace() );
}
_clearCollectionCache( txn, fromNS );
_clearCollectionCache( txn, toNS );
Top::global.collectionDropped( fromNS.toString() );
}
txn->recoveryUnit()->registerChange( new AddCollectionChange(this, toNS) );
Status s = _dbEntry->renameCollection( txn, fromNS, toNS, stayTemp );
_collections[toNS] = _getOrCreateCollectionInstance(txn, toNS);
return s;
}
示例2: renameCollection
Status Database::renameCollection( OperationContext* txn,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp ) {
audit::logRenameCollection( currentClient.get(), fromNS, toNS );
{ // remove anything cached
Collection* coll = getCollection( txn, fromNS );
if ( !coll )
return Status( ErrorCodes::NamespaceNotFound, "collection not found to rename" );
IndexCatalog::IndexIterator ii = coll->getIndexCatalog()->getIndexIterator( true );
while ( ii.more() ) {
IndexDescriptor* desc = ii.next();
_clearCollectionCache( desc->indexNamespace() );
}
{
scoped_lock lk( _collectionLock );
_clearCollectionCache_inlock( fromNS );
_clearCollectionCache_inlock( toNS );
}
Top::global.collectionDropped( fromNS.toString() );
}
return _dbEntry->renameCollection( txn, fromNS, toNS, stayTemp );
}
示例3: renameCollection
Status Database::renameCollection(OperationContext* txn,
StringData fromNS,
StringData toNS,
bool stayTemp) {
audit::logRenameCollection(&cc(), fromNS, toNS);
invariant(txn->lockState()->isDbLockedForMode(name(), MODE_X));
BackgroundOperation::assertNoBgOpInProgForNs(fromNS);
BackgroundOperation::assertNoBgOpInProgForNs(toNS);
{ // remove anything cached
Collection* coll = getCollection(fromNS);
if (!coll)
return Status(ErrorCodes::NamespaceNotFound, "collection not found to rename");
string clearCacheReason = str::stream() << "renamed collection '" << fromNS << "' to '"
<< toNS << "'";
IndexCatalog::IndexIterator ii = coll->getIndexCatalog()->getIndexIterator(txn, true);
while (ii.more()) {
IndexDescriptor* desc = ii.next();
_clearCollectionCache(txn, desc->indexNamespace(), clearCacheReason);
}
_clearCollectionCache(txn, fromNS, clearCacheReason);
_clearCollectionCache(txn, toNS, clearCacheReason);
Top::get(txn->getClient()->getServiceContext()).collectionDropped(fromNS.toString());
}
txn->recoveryUnit()->registerChange(new AddCollectionChange(txn, this, toNS));
Status s = _dbEntry->renameCollection(txn, fromNS, toNS, stayTemp);
_collections[toNS] = _getOrCreateCollectionInstance(txn, toNS);
return s;
}
示例4: getIndexSizeForCollection
long long Database::getIndexSizeForCollection(OperationContext* opCtx,
Collection* coll,
BSONObjBuilder* details,
int scale ) {
if ( !coll )
return 0;
IndexCatalog::IndexIterator ii =
coll->getIndexCatalog()->getIndexIterator( true /*includeUnfinishedIndexes*/ );
long long totalSize = 0;
while ( ii.more() ) {
IndexDescriptor* d = ii.next();
string indNS = d->indexNamespace();
// XXX creating a Collection for an index which isn't a Collection
Collection* indColl = getCollection( opCtx, indNS );
if ( ! indColl ) {
log() << "error: have index descriptor [" << indNS
<< "] but no entry in the index collection." << endl;
continue;
}
totalSize += indColl->dataSize();
if ( details ) {
long long const indexSize = indColl->dataSize() / scale;
details->appendNumber( d->indexName() , indexSize );
}
}
return totalSize;
}