23 #ifndef DATAMGR_MEMORY_FILE_PAGE_H
24 #define DATAMGR_MEMORY_FILE_PAGE_H
32 #include "../../Shared/types.h"
34 namespace File_Namespace {
96 LOG(
FATAL) <<
"No current version of the page exists in this MultiPage.";
102 inline void push(
const Page& page,
const int epoch) {
118 const int32_t current_epoch) {
119 std::vector<EpochedPage> pagesBeforeEpoch;
120 int32_t next_page_epoch = current_epoch + 1;
122 const int32_t epoch_ceiling = next_page_epoch - 1;
123 CHECK_LE(pageIt->epoch, epoch_ceiling);
124 if (epoch_ceiling < target_epoch) {
125 pagesBeforeEpoch.emplace_back(*pageIt);
127 next_page_epoch = pageIt->epoch;
129 if (!pagesBeforeEpoch.empty()) {
133 return pagesBeforeEpoch;
153 : chunkKey(chunkKey), pageId(pageId), versionEpoch(versionEpoch), page(page) {}
168 #endif // DATAMGR_MEMORY_FILE_PAGE_H
std::vector< int > ChunkKey
~MultiPage()
Destructor – purges all pages.
A logical page (Page) belongs to a file on disk.
void pop()
Purges the oldest Page.
std::deque< EpochedPage > pageVersions
size_t pageNum
unique identifier of the owning file
MultiPage(size_t pageSizeIn)
Constructor.
bool operator<(const Page other) const
void push(const Page &page, const int epoch)
Pushes a new page with epoch value.
std::vector< EpochedPage > freePagesBeforeEpoch(const int32_t target_epoch, const int32_t current_epoch)
Page(int32_t fileId, size_t pageNum)
page number
EpochedPage current() const
Returns a reference to the most recent version of the page.
The MultiPage stores versions of the same logical page in a deque.