本文整理汇总了C++中Extent::fl方法的典型用法代码示例。如果您正苦于以下问题:C++ Extent::fl方法的具体用法?C++ Extent::fl怎么用?C++ Extent::fl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extent
的用法示例。
在下文中一共展示了Extent::fl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRecordToRecListInExtent
/** add a record to the end of the linked list chain within this extent.
require: you must have already declared write intent for the record header.
*/
void addRecordToRecListInExtent(Record *r, DiskLoc loc) {
dassert( loc.rec() == r );
Extent *e = r->myExtent(loc);
if ( e->lastRecord.isNull() ) {
Extent::FL *fl = getDur().writing(e->fl());
fl->firstRecord = fl->lastRecord = loc;
r->prevOfs() = r->nextOfs() = DiskLoc::NullOfs;
}
else {
Record *oldlast = e->lastRecord.rec();
r->prevOfs() = e->lastRecord.getOfs();
r->nextOfs() = DiskLoc::NullOfs;
getDur().writingInt(oldlast->nextOfs()) = loc.getOfs();
getDur().writingDiskLoc(e->lastRecord) = loc;
}
}
示例2: fast_oplog_insert
/* special version of insert for transaction logging -- streamlined a bit.
assumes ns is capped and no indexes
*/
Record* DataFileMgr::fast_oplog_insert(NamespaceDetails *d, const char *ns, int len) {
verify( d );
RARELY verify( d == nsdetails(ns) );
DEV verify( d == nsdetails(ns) );
massert( 16509,
str::stream()
<< "fast_oplog_insert requires a capped collection "
<< " but " << ns << " is not capped",
d->isCapped() );
//record timing on oplog inserts
boost::optional<TimerHolder> insertTimer;
//skip non-oplog collections
if (NamespaceString::oplog(ns)) {
insertTimer = boost::in_place(&oplogInsertStats);
oplogInsertBytesStats.increment(len); //record len of inserted records for oplog
}
int lenWHdr = len + Record::HeaderSize;
DiskLoc loc = d->alloc(ns, lenWHdr);
verify( !loc.isNull() );
Record *r = loc.rec();
verify( r->lengthWithHeaders() >= lenWHdr );
Extent *e = r->myExtent(loc);
if ( e->lastRecord.isNull() ) {
Extent::FL *fl = getDur().writing( e->fl() );
fl->firstRecord = fl->lastRecord = loc;
Record::NP *np = getDur().writing(r->np());
np->nextOfs = np->prevOfs = DiskLoc::NullOfs;
}
else {
Record *oldlast = e->lastRecord.rec();
Record::NP *np = getDur().writing(r->np());
np->prevOfs = e->lastRecord.getOfs();
np->nextOfs = DiskLoc::NullOfs;
getDur().writingInt( oldlast->nextOfs() ) = loc.getOfs();
e->lastRecord.writing() = loc;
}
d->incrementStats( r->netLength(), 1 );
return r;
}