OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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...
 
EpochedPage current () const
 Returns a reference to the most recent version of the page. More...
 
void push (const Page &page, const int epoch)
 Pushes a new page with epoch value. More...
 
void pop ()
 Purges the oldest Page. More...
 
std::vector< EpochedPagefreePagesBeforeEpoch (const int32_t target_epoch, const int32_t current_epoch)
 

Public Attributes

size_t pageSize
 
std::deque< EpochedPagepageVersions
 

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.

Definition at line 79 of file Page.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 84 of file Page.h.

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

Destructor – purges all pages.

Definition at line 87 of file Page.h.

References pageVersions, and pop().

87  {
88  while (pageVersions.size() > 0) {
89  pop();
90  }
91  }
void pop()
Purges the oldest Page.
Definition: Page.h:110
std::deque< EpochedPage > pageVersions
Definition: Page.h:81

+ Here is the call graph for this function:

Member Function Documentation

EpochedPage File_Namespace::MultiPage::current ( ) const
inline

Returns a reference to the most recent version of the page.

Definition at line 94 of file Page.h.

References logger::FATAL, LOG, and pageVersions.

Referenced by File_Namespace::FileBuffer::initMetadataAndPageDataSize().

94  {
95  if (pageVersions.size() < 1) {
96  LOG(FATAL) << "No current version of the page exists in this MultiPage.";
97  }
98  return pageVersions.back();
99  }
#define LOG(tag)
Definition: Logger.h:285
std::deque< EpochedPage > pageVersions
Definition: Page.h:81

+ Here is the caller graph for this function:

std::vector<EpochedPage> File_Namespace::MultiPage::freePagesBeforeEpoch ( const int32_t  target_epoch,
const int32_t  current_epoch 
)
inline

Definition at line 117 of file Page.h.

References CHECK_LE, and pageVersions.

Referenced by File_Namespace::FileBuffer::freePagesBeforeEpochForMultiPage().

118  {
119  std::vector<EpochedPage> pagesBeforeEpoch;
120  int32_t next_page_epoch = current_epoch + 1;
121  for (auto pageIt = pageVersions.rbegin(); pageIt != pageVersions.rend(); ++pageIt) {
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);
126  }
127  next_page_epoch = pageIt->epoch;
128  }
129  if (!pagesBeforeEpoch.empty()) {
130  pageVersions.erase(pageVersions.begin(),
131  pageVersions.begin() + pagesBeforeEpoch.size());
132  }
133  return pagesBeforeEpoch;
134  }
std::deque< EpochedPage > pageVersions
Definition: Page.h:81
#define CHECK_LE(x, y)
Definition: Logger.h:304

+ Here is the caller graph for this function:

void File_Namespace::MultiPage::pop ( )
inline

Purges the oldest Page.

Definition at line 110 of file Page.h.

References logger::FATAL, LOG, and pageVersions.

Referenced by File_Namespace::FileBuffer::freeMetadataPages(), and ~MultiPage().

110  {
111  if (pageVersions.size() < 1) {
112  LOG(FATAL) << "No page to pop.";
113  }
114  pageVersions.pop_front();
115  }
#define LOG(tag)
Definition: Logger.h:285
std::deque< EpochedPage > pageVersions
Definition: Page.h:81

+ Here is the caller graph for this function:

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

Pushes a new page with epoch value.

Definition at line 102 of file Page.h.

References CHECK_GT, and pageVersions.

Referenced by File_Namespace::FileBuffer::addNewMultiPage(), File_Namespace::FileBuffer::FileBuffer(), File_Namespace::FileMgr::init(), and File_Namespace::FileBuffer::writeMetadata().

102  {
103  if (!pageVersions.empty()) {
104  CHECK_GT(epoch, pageVersions.back().epoch);
105  }
106  pageVersions.push_back({page, epoch});
107  }
#define CHECK_GT(x, y)
Definition: Logger.h:305
std::deque< EpochedPage > pageVersions
Definition: Page.h:81

+ Here is the caller graph for this function:

Member Data Documentation

size_t File_Namespace::MultiPage::pageSize

Definition at line 80 of file Page.h.

std::deque<EpochedPage> File_Namespace::MultiPage::pageVersions

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