OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
File_Namespace::MultiPage Struct Reference

The MultiPage stores versions of the same logical page in a deque. More...

#include <Page.h>

Public Member Functions

 MultiPage (size_t pageSizeIn)
 Constructor. More...
 
 ~MultiPage ()
 Destructor – purges all pages. More...
 
Page current (int *epoch=NULL) const
 
void push (Page &page, const int epoch)
 Pushes a new page with epoch value. More...
 
void pop ()
 Purges the oldest Page. More...
 

Public Attributes

size_t pageSize
 
std::deque< PagepageVersions
 
std::deque< int > epochs
 

Detailed Description

The MultiPage stores versions of the same logical page in a deque.

The purpose of MultiPage is to support storing multiple versions of the same page, which may be located in different locations and in different files. Associated with each version of a page is an "epoch" value, which is a temporal reference.

Note that it should always be the case that version.size() == epoch.size().

Definition at line 69 of file Page.h.

Constructor & Destructor Documentation

File_Namespace::MultiPage::MultiPage ( size_t  pageSizeIn)
inline

Constructor.

Definition at line 75 of file Page.h.

75 : pageSize(pageSizeIn) {}
File_Namespace::MultiPage::~MultiPage ( )
inline

Destructor – purges all pages.

Definition at line 78 of file Page.h.

References pageVersions, and pop().

78  {
79  while (pageVersions.size() > 0) {
80  pop();
81  }
82  }
void pop()
Purges the oldest Page.
Definition: Page.h:104
std::deque< Page > pageVersions
Definition: Page.h:71

+ Here is the call graph for this function:

Member Function Documentation

Page File_Namespace::MultiPage::current ( int *  epoch = NULL) const
inline

Returns a reference to the most recent version of the page (optionally, the epoch is returned via the parameter "epoch").

Definition at line 86 of file Page.h.

References epochs, logger::FATAL, LOG, and pageVersions.

86  {
87  if (pageVersions.size() < 1) {
88  LOG(FATAL) << "No current version of the page exists in this MultiPage.";
89  }
90  if (epoch != NULL) {
91  *epoch = this->epochs.back();
92  }
93  return pageVersions.back();
94  }
#define LOG(tag)
Definition: Logger.h:185
std::deque< Page > pageVersions
Definition: Page.h:71
std::deque< int > epochs
Definition: Page.h:72
void File_Namespace::MultiPage::pop ( )
inline

Purges the oldest Page.

Definition at line 104 of file Page.h.

References CHECK_EQ, epochs, logger::FATAL, LOG, and pageVersions.

Referenced by ~MultiPage().

104  {
105  if (pageVersions.size() < 1) {
106  LOG(FATAL) << "No page to pop.";
107  }
108  pageVersions.pop_front();
109  epochs.pop_front();
110  CHECK_EQ(pageVersions.size(), epochs.size());
111  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
#define LOG(tag)
Definition: Logger.h:185
std::deque< Page > pageVersions
Definition: Page.h:71
std::deque< int > epochs
Definition: Page.h:72

+ Here is the caller graph for this function:

void File_Namespace::MultiPage::push ( Page page,
const int  epoch 
)
inline

Pushes a new page with epoch value.

Definition at line 97 of file Page.h.

References CHECK_EQ, epochs, and pageVersions.

97  {
98  pageVersions.push_back(page);
99  epochs.push_back(epoch);
100  CHECK_EQ(pageVersions.size(), epochs.size());
101  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
std::deque< Page > pageVersions
Definition: Page.h:71
std::deque< int > epochs
Definition: Page.h:72

Member Data Documentation

size_t File_Namespace::MultiPage::pageSize

Definition at line 70 of file Page.h.


The documentation for this struct was generated from the following file: