void Journal::_open() { assert( _curLogFile == 0 ); string fname = getFilePathFor(_nextFileNumber).string(); _curLogFile = new LogFile(fname); _nextFileNumber++; { JHeader h(fname); AlignedBuilder b(8192); b.appendStruct(h); _curLogFile->synchronousAppend(b.buf(), b.len()); } }
/* threading: only durThread() calls this, thus safe. */ void Journal::open() { mutex::scoped_lock lk(_lfMutex); assert( _lf == 0 ); string fname = getFilePathFor(nextFileNumber).string(); _lf = new LogFile(fname); nextFileNumber++; { JHeader h(fname); AlignedBuilder b(8192); b.appendStruct(h); _lf->synchronousAppend(b.buf(), b.len()); } }