本文整理汇总了C++中MongoMMF::relativePath方法的典型用法代码示例。如果您正苦于以下问题:C++ MongoMMF::relativePath方法的具体用法?C++ MongoMMF::relativePath怎么用?C++ MongoMMF::relativePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoMMF
的用法示例。
在下文中一共展示了MongoMMF::relativePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepBasicWrite_inlock
/** put the basic write operation into the buffer (bb) to be journaled */
static void prepBasicWrite_inlock(AlignedBuilder&bb, const WriteIntent *i, RelativePath& lastDbPath) {
size_t ofs = 1;
MongoMMF *mmf = findMMF_inlock(i->start(), /*out*/ofs);
if( unlikely(!mmf->willNeedRemap()) ) {
// tag this mmf as needed a remap of its private view later.
// usually it will already be dirty/already set, so we do the if above first
// to avoid possibility of cpu cache line contention
mmf->willNeedRemap() = true;
}
// since we have already looked up the mmf, we go ahead and remember the write view location
// so we don't have to find the MongoMMF again later in WRITETODATAFILES()
//
// this was for WRITETODATAFILES_Impl2 so commented out now
//
/*
dassert( i->w_ptr == 0 );
i->w_ptr = ((char*)mmf->view_write()) + ofs;
*/
JEntry e;
e.len = min(i->length(), (unsigned)(mmf->length() - ofs)); //dont write past end of file
assert( ofs <= 0x80000000 );
e.ofs = (unsigned) ofs;
e.setFileNo( mmf->fileSuffixNo() );
if( mmf->relativePath() == local ) {
e.setLocalDbContextBit();
}
else if( mmf->relativePath() != lastDbPath ) {
lastDbPath = mmf->relativePath();
JDbContext c;
bb.appendStruct(c);
bb.appendStr(lastDbPath.toString());
}
bb.appendStruct(e);
#if defined(_EXPERIMENTAL)
i->ofsInJournalBuffer = bb.len();
#endif
bb.appendBuf(i->start(), e.len);
if (unlikely(e.len != (unsigned)i->length())) {
log() << "journal info splitting prepBasicWrite at boundary" << endl;
// This only happens if we write to the last byte in a file and
// the fist byte in another file that is mapped adjacently. I
// think most OSs leave at least a one page gap between
// mappings, but better to be safe.
WriteIntent next ((char*)i->start() + e.len, i->length() - e.len);
prepBasicWrite_inlock(bb, &next, lastDbPath);
}
}