当前位置: 首页>>代码示例>>C++>>正文


C++ Extent::fl方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:ChrisKozak,项目名称:mongo,代码行数:19,代码来源:pdfile.cpp

示例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;
    }
开发者ID:ChrisKozak,项目名称:mongo,代码行数:49,代码来源:pdfile.cpp


注:本文中的Extent::fl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。