OmniSciDB  bf83d84833
 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...
 
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 72 of file Page.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 77 of file Page.h.

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

Destructor – purges all pages.

Definition at line 80 of file Page.h.

References pageVersions, and pop().

80  {
81  while (pageVersions.size() > 0) {
82  pop();
83  }
84  }
void pop()
Purges the oldest Page.
Definition: Page.h:100
std::deque< EpochedPage > pageVersions
Definition: Page.h:74

+ 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 87 of file Page.h.

References logger::FATAL, LOG, and pageVersions.

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

87  {
88  if (pageVersions.size() < 1) {
89  LOG(FATAL) << "No current version of the page exists in this MultiPage.";
90  }
91  return pageVersions.back();
92  }
#define LOG(tag)
Definition: Logger.h:188
std::deque< EpochedPage > pageVersions
Definition: Page.h:74

+ 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 107 of file Page.h.

References CHECK_LE, and pageVersions.

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

108  {
109  std::vector<EpochedPage> pagesBeforeEpoch;
110  int32_t next_page_epoch = current_epoch + 1;
111  for (auto pageIt = pageVersions.rbegin(); pageIt != pageVersions.rend(); ++pageIt) {
112  const int32_t epoch_ceiling = next_page_epoch - 1;
113  CHECK_LE(pageIt->epoch, epoch_ceiling);
114  if (epoch_ceiling < target_epoch) {
115  pagesBeforeEpoch.emplace_back(*pageIt);
116  }
117  next_page_epoch = pageIt->epoch;
118  }
119  if (!pagesBeforeEpoch.empty()) {
120  pageVersions.erase(pageVersions.begin(),
121  pageVersions.begin() + pagesBeforeEpoch.size());
122  }
123  return pagesBeforeEpoch;
124  }
std::deque< EpochedPage > pageVersions
Definition: Page.h:74
#define CHECK_LE(x, y)
Definition: Logger.h:208

+ Here is the caller graph for this function:

void File_Namespace::MultiPage::pop ( )
inline

Purges the oldest Page.

Definition at line 100 of file Page.h.

References logger::FATAL, LOG, and pageVersions.

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

100  {
101  if (pageVersions.size() < 1) {
102  LOG(FATAL) << "No page to pop.";
103  }
104  pageVersions.pop_front();
105  }
#define LOG(tag)
Definition: Logger.h:188
std::deque< EpochedPage > pageVersions
Definition: Page.h:74

+ 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 95 of file Page.h.

References pageVersions.

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

95  {
96  pageVersions.push_back({page, epoch});
97  }
std::deque< EpochedPage > pageVersions
Definition: Page.h:74

+ Here is the caller graph for this function:

Member Data Documentation

size_t File_Namespace::MultiPage::pageSize

Definition at line 73 of file Page.h.

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

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