Example #1
0
 void Journal::journal(const AlignedBuilder& b) {
     try {
         mutex::scoped_lock lk(_lfMutex);
         if( _lf == 0 )
             open();
         written += b.len();
         _lf->synchronousAppend((void *) b.buf(), b.len());
     }
     catch(std::exception& e) { 
         log() << "warning exception in dur::journal " << e.what() << endl;
     }
 }
Example #2
0
 /* 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());
     }
 }