本文整理汇总了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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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();
}