本文整理汇总了C++中DurableMappedFile::fileSuffixNo方法的典型用法代码示例。如果您正苦于以下问题:C++ DurableMappedFile::fileSuffixNo方法的具体用法?C++ DurableMappedFile::fileSuffixNo怎么用?C++ DurableMappedFile::fileSuffixNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DurableMappedFile
的用法示例。
在下文中一共展示了DurableMappedFile::fileSuffixNo方法的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;
DurableMappedFile* mmf = findMMF_inlock(i->start(), /*out*/ ofs);
if (MONGO_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->setWillNeedRemap();
}
// 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 DurableMappedFile 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)); // don't write past end of file
verify(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);
bb.appendBuf(i->start(), e.len);
if (MONGO_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);
}
}