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


C++ MongoFile类代码示例

本文整理汇总了C++中MongoFile的典型用法代码示例。如果您正苦于以下问题:C++ MongoFile类的具体用法?C++ MongoFile怎么用?C++ MongoFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MongoFile类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: debugValidateMapsMatch

        /** (SLOW) diagnostic to check that the private view and the non-private view are in sync.
        */
        static void debugValidateMapsMatch() {
            if( !DebugValidateMapsMatch ) 
                 return;

            Timer t;
            set<MongoFile*>& files = MongoFile::getAllFiles();
            for( set<MongoFile*>::iterator i = files.begin(); i != files.end(); i++ ) { 
                MongoFile *mf = *i;
                if( mf->isMongoMMF() ) { 
                    MongoMMF *mmf = (MongoMMF*) mf;
                    const char *p = (const char *) mmf->getView();
                    const char *w = (const char *) mmf->view_write();
                    unsigned low = 0xffffffff;
                    unsigned high = 0;
                    for( unsigned i = 0; i < mmf->length(); i++ ) {
                        if( p[i] != w[i] ) { 
                            log() << i << '\t' << (int) p[i] << '\t' << (int) w[i] << endl;
                            if( i < low ) low = i;
                            if( i > high ) high = i;
                        }
                    }
                    if( low != 0xffffffff ) { 
                        std::stringstream ss;
                        ss << "dur error warning views mismatch " << mmf->filename() << ' ' << (hex) << low << ".." << high << " len:" << high-low+1;
                        log() << ss.str() << endl;
                        log() << "priv loc: " << (void*)(p+low) << endl;
                        vector<WriteIntent>& w = commitJob.writes();
                        (void)w; // mark as unused. Useful for inspection in debugger

                        breakpoint();
                    }
                }
            }
            log() << "debugValidateMapsMatch " << t.millis() << "ms " << endl;
        }
开发者ID:meganyao,项目名称:mongo,代码行数:37,代码来源:dur.cpp

示例2: lk

 void MongoFile::unmarkAllWritable() {
     rwlock lk( mmmutex , false );
     for ( set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ){
         MongoFile * mmf = *i;
         if (mmf) mmf->_unlock();
     }
 }
开发者ID:ALFIO,项目名称:mongo,代码行数:7,代码来源:mmap.cpp

示例3: lk

 void MongoFile::unmarkAllWritable() {
     if( cmdLine.dur )
         return;
     RWLockRecursive::Shared lk(mmmutex);
     for ( set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ) {
         MongoFile * mmf = *i;
         if (mmf) mmf->_unlock();
     }
 }
开发者ID:DumaGit,项目名称:mongo,代码行数:9,代码来源:mmap.cpp

示例4: lk

    void MongoFile::markAllWritable() {
      if( cmdLine.dur )
	return;
        rwlock lk( mmmutex , false );
        for ( set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ) {
            MongoFile * mmf = *i;
            if (mmf) mmf->_lock();
        }
    }
开发者ID:avelino,项目名称:mongo,代码行数:9,代码来源:mmap.cpp

示例5: lk

    /*static*/ int MongoFile::flushAll( bool sync ){
        int num = 0;

        rwlock lk( mmmutex , false );
        for ( set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++ ){
            num++;
            MongoFile * mmf = *i;
            if ( ! mmf )
                continue;

            mmf->flush( sync );
        }
        return num;
    }
开发者ID:anagri,项目名称:mongo,代码行数:14,代码来源:mmap.cpp

示例6:

/*static*/ int MongoFile::_flushAll(bool sync) {
    if (!sync) {
        int num = 0;
        LockMongoFilesShared lk;
        for (set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++) {
            num++;
            MongoFile* mmf = *i;
            if (!mmf)
                continue;

            mmf->flush(sync);
        }
        return num;
    }

    // want to do it sync

    // get a thread-safe Flushable object for each file first in a single lock
    // so that we can iterate and flush without doing any locking here
    OwnedPointerVector<Flushable> thingsToFlushWrapper;
    vector<Flushable*>& thingsToFlush = thingsToFlushWrapper.mutableVector();
    {
        LockMongoFilesShared lk;
        for (set<MongoFile*>::iterator i = mmfiles.begin(); i != mmfiles.end(); i++) {
            MongoFile* mmf = *i;
            if (!mmf)
                continue;
            thingsToFlush.push_back(mmf->prepareFlush());
        }
    }

    for (size_t i = 0; i < thingsToFlush.size(); i++) {
        thingsToFlush[i]->flush();
    }

    return thingsToFlush.size();
}
开发者ID:Andiry,项目名称:mongo,代码行数:37,代码来源:mmap.cpp


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