#include <FuzzyCheckpointSet.h>
Inheritance diagram for FuzzyCheckpointSet:
Public Member Functions | |
FuzzyCheckpointSet () | |
Constructs a new FuzzyCheckpointSet. | |
void | clear () |
Forget all dirty pages. | |
void | finishCheckpoint () |
Receives notification that a checkpoint is completing. | |
void | setDelegatePagePredicate (PagePredicate &pagePredicate) |
virtual bool | operator() (CachePage const &page) |
Tests the predicate. | |
Private Attributes | |
std::hash_set< BlockId > | oldDirtyPages |
Pages dirty during last checkpoint. | |
std::vector< BlockId > | newDirtyPages |
Pages dirty during current checkpoint. | |
PagePredicate * | pDelegatePagePredicate |
It implements the PagePredicate interface by returning true only for pages which have remained dirty since the last checkpoint.
Definition at line 39 of file FuzzyCheckpointSet.h.
FuzzyCheckpointSet::FuzzyCheckpointSet | ( | ) | [explicit] |
Constructs a new FuzzyCheckpointSet.
Definition at line 29 of file FuzzyCheckpointSet.cpp.
References pDelegatePagePredicate.
00030 { 00031 pDelegatePagePredicate = NULL; 00032 }
void FuzzyCheckpointSet::clear | ( | ) |
Forget all dirty pages.
Definition at line 34 of file FuzzyCheckpointSet.cpp.
References newDirtyPages, oldDirtyPages, and pDelegatePagePredicate.
Referenced by VersionedSegment::delegatedCheckpoint().
00035 { 00036 oldDirtyPages.clear(); 00037 newDirtyPages.clear(); 00038 pDelegatePagePredicate = NULL; 00039 }
void FuzzyCheckpointSet::finishCheckpoint | ( | ) |
Receives notification that a checkpoint is completing.
Definition at line 41 of file FuzzyCheckpointSet.cpp.
References newDirtyPages, oldDirtyPages, and pDelegatePagePredicate.
Referenced by VersionedSegment::delegatedCheckpoint().
00042 { 00043 oldDirtyPages.clear(); 00044 oldDirtyPages.insert( 00045 newDirtyPages.begin(), 00046 newDirtyPages.end()); 00047 newDirtyPages.clear(); 00048 pDelegatePagePredicate = NULL; 00049 }
void FuzzyCheckpointSet::setDelegatePagePredicate | ( | PagePredicate & | pagePredicate | ) |
Definition at line 64 of file FuzzyCheckpointSet.cpp.
References pDelegatePagePredicate.
Referenced by VersionedSegment::delegatedCheckpoint().
00065 { 00066 pDelegatePagePredicate = &pagePredicate; 00067 }
bool FuzzyCheckpointSet::operator() | ( | CachePage const & | page | ) | [virtual] |
Tests the predicate.
page | the page to be considered |
Implements PagePredicate.
Definition at line 51 of file FuzzyCheckpointSet.cpp.
References CachePage::isDirty(), newDirtyPages, oldDirtyPages, and pDelegatePagePredicate.
00052 { 00053 if (!page.isDirty()) { 00054 return false; 00055 } 00056 if (pDelegatePagePredicate && !(*pDelegatePagePredicate)(page)) { 00057 return false; 00058 } 00059 BlockId blockId = page.getBlockId(); 00060 newDirtyPages.push_back(blockId); 00061 return (oldDirtyPages.find(blockId) != oldDirtyPages.end()); 00062 }
std::hash_set<BlockId> FuzzyCheckpointSet::oldDirtyPages [private] |
Pages dirty during last checkpoint.
Definition at line 45 of file FuzzyCheckpointSet.h.
Referenced by clear(), finishCheckpoint(), and operator()().
std::vector<BlockId> FuzzyCheckpointSet::newDirtyPages [private] |
Pages dirty during current checkpoint.
Definition at line 50 of file FuzzyCheckpointSet.h.
Referenced by clear(), finishCheckpoint(), and operator()().
Definition at line 52 of file FuzzyCheckpointSet.h.
Referenced by clear(), finishCheckpoint(), FuzzyCheckpointSet(), operator()(), and setDelegatePagePredicate().