本文整理汇总了C++中bsoncollectioncatalogentry::MetaData::parse方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::parse方法的具体用法?C++ MetaData::parse怎么用?C++ MetaData::parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bsoncollectioncatalogentry::MetaData
的用法示例。
在下文中一共展示了MetaData::parse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG
const BSONCollectionCatalogEntry::MetaData KVCatalog::getMetaData( OperationContext* opCtx,
const StringData& ns ) {
DiskLoc loc;
BSONObj obj = _findEntry( opCtx, ns, &loc );
LOG(1) << " got: " << obj;
BSONCollectionCatalogEntry::MetaData md;
if ( obj["md"].isABSONObj() )
md.parse( obj["md"].Obj() );
return md;
}
示例2: getMetaData
BSONCollectionCatalogEntry::MetaData KVCatalog::getMetaData(OperationContext* opCtx,
StringData ns) const {
BSONObj obj = _findEntry(opCtx, ns);
LOG(3) << " fetched CCE metadata: " << obj;
BSONCollectionCatalogEntry::MetaData md;
const BSONElement mdElement = obj["md"];
if (mdElement.isABSONObj()) {
LOG(3) << "returning metadata: " << mdElement;
md.parse(mdElement.Obj());
}
return md;
}
示例3: renameCollection
Status KVCatalog::renameCollection(OperationContext* opCtx,
StringData fromNS,
StringData toNS,
bool stayTemp) {
std::unique_ptr<Lock::ResourceLock> rLk;
if (!_isRsThreadSafe && opCtx->lockState()) {
rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, MODE_X));
}
RecordId loc;
BSONObj old = _findEntry(opCtx, fromNS, &loc).getOwned();
{
BSONObjBuilder b;
b.append("ns", toNS);
BSONCollectionCatalogEntry::MetaData md;
md.parse(old["md"].Obj());
md.rename(toNS);
if (!stayTemp)
md.options.temp = false;
b.append("md", md.toBSON());
b.appendElementsUnique(old);
BSONObj obj = b.obj();
StatusWith<RecordId> status =
_rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize(), false, NULL);
fassert(28522, status.getStatus());
invariant(status.getValue() == loc);
}
stdx::lock_guard<stdx::mutex> lk(_identsLock);
const NSToIdentMap::iterator fromIt = _idents.find(fromNS.toString());
invariant(fromIt != _idents.end());
opCtx->recoveryUnit()->registerChange(new RemoveIdentChange(this, fromNS, fromIt->second));
opCtx->recoveryUnit()->registerChange(new AddIdentChange(this, toNS));
_idents.erase(fromIt);
_idents[toNS.toString()] = Entry(old["ident"].String(), loc);
return Status::OK();
}
示例4: renameCollection
Status KVCatalog::renameCollection( OperationContext* opCtx,
const StringData& fromNS,
const StringData& toNS,
bool stayTemp ) {
DiskLoc loc;
BSONObj old = _findEntry( opCtx, fromNS, &loc ).getOwned();
{
BSONObjBuilder b;
b.append( "ns", toNS );
BSONCollectionCatalogEntry::MetaData md;
md.parse( old["md"].Obj() );
md.rename( toNS );
if ( !stayTemp )
md.options.temp = false;
b.append( "md", md.toBSON() );
b.appendElementsUnique( old );
BSONObj obj = b.obj();
StatusWith<DiskLoc> status = _rs->updateRecord( opCtx,
loc,
obj.objdata(),
obj.objsize(),
false,
NULL );
fassert( 28522, status.getStatus() );
invariant( status.getValue() == loc );
}
boost::mutex::scoped_lock lk( _identsLock );
_idents.erase( fromNS.toString() );
_idents[toNS.toString()] = Entry( old["ident"].String(), loc );
return Status::OK();
}
示例5: renameCollection
Status KVCatalog::renameCollection(OperationContext* opCtx,
StringData fromNS,
StringData toNS,
bool stayTemp) {
RecordId loc;
BSONObj old = _findEntry(opCtx, fromNS, &loc).getOwned();
{
BSONObjBuilder b;
b.append("ns", toNS);
BSONCollectionCatalogEntry::MetaData md;
md.parse(old["md"].Obj());
md.rename(toNS);
if (!stayTemp)
md.options.temp = false;
b.append("md", md.toBSON());
b.appendElementsUnique(old);
BSONObj obj = b.obj();
Status status = _rs->updateRecord(opCtx, loc, obj.objdata(), obj.objsize());
fassert(28522, status.isOK());
}
stdx::lock_guard<stdx::mutex> lk(_identsLock);
const NSToIdentMap::iterator fromIt = _idents.find(fromNS.toString());
invariant(fromIt != _idents.end());
opCtx->recoveryUnit()->registerChange(new RemoveIdentChange(this, fromNS, fromIt->second));
opCtx->recoveryUnit()->registerChange(new AddIdentChange(this, toNS));
_idents.erase(fromIt);
_idents[toNS.toString()] = Entry(old["ident"].String(), loc);
return Status::OK();
}