0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

move RecoveryJob out to header file

This commit is contained in:
Mathias Stearn 2010-12-21 18:11:45 -05:00
parent a0151972c1
commit 63cbf0d152
2 changed files with 42 additions and 30 deletions

View File

@ -19,6 +19,7 @@
#include "pch.h"
#include "dur.h"
#include "dur_recover.h"
#include "dur_journal.h"
#include "dur_journalformat.h"
#include "durop.h"
@ -159,36 +160,6 @@ namespace mongo {
const char *_lastDbName; // pointer into mmaped journal file
};
/** call go() to execute a recovery from existing journal files.
*/
class RecoveryJob : boost::noncopyable {
public:
RecoveryJob() { _lastDataSyncedFromLastRun = 0; }
void go(vector<path>& files);
~RecoveryJob();
private:
void applyEntry(const ParsedJournalEntry& entry, bool apply, bool dump);
void applyEntries(const vector<ParsedJournalEntry> &entries);
void processSection(const void *, unsigned len);
bool processFileBuffer(const void *, unsigned len);
bool processFile(path journalfile);
void close();
/** retrieve the mmap pointer for the specified dbName plus file number.
open if not yet open.
@param fileNo a value of -1 indicates ".ns"
@param ofs offset to add to the pointer before returning
*/
void* ptr(const char *dbName, int fileNo, unsigned ofs);
// fileno,dbname -> map
map< pair<int,string>, void* > _fileToPtr;
// all close at end (destruction) of RecoveryJob
list< shared_ptr<MemoryMappedFile> > _files;
unsigned long long _lastDataSyncedFromLastRun;
};
/** retrieve the mmap pointer for the specified dbName plus file number.
open if not yet open.

41
db/dur_recover.h Normal file
View File

@ -0,0 +1,41 @@
// @file dur.h durability support
#pragma once
namespace mongo {
class MemoryMappedFile;
namespace dur {
class ParsedJournalEntry;
/** call go() to execute a recovery from existing journal files.
*/
class RecoveryJob : boost::noncopyable {
public:
RecoveryJob() { _lastDataSyncedFromLastRun = 0; }
void go(vector<path>& files);
~RecoveryJob();
private:
void applyEntry(const ParsedJournalEntry& entry, bool apply, bool dump);
void applyEntries(const vector<ParsedJournalEntry> &entries);
void processSection(const void *, unsigned len);
bool processFileBuffer(const void *, unsigned len);
bool processFile(path journalfile);
void close();
/** retrieve the mmap pointer for the specified dbName plus file number.
open if not yet open.
@param fileNo a value of -1 indicates ".ns"
@param ofs offset to add to the pointer before returning
*/
void* ptr(const char *dbName, int fileNo, unsigned ofs);
// fileno,dbname -> map
map< pair<int,string>, void* > _fileToPtr;
// all close at end (destruction) of RecoveryJob
list< shared_ptr<MemoryMappedFile> > _files;
unsigned long long _lastDataSyncedFromLastRun;
};
}
}