25   std::lock_guard<std::mutex> lockGuard(
fLock);
 
   33   std::lock_guard<std::mutex> lockGuard(fLock);
 
   34   fPages.emplace_back(page);
 
   35   fReferences.emplace_back(0);
 
   36   fDeleters.emplace_back(deleter);
 
   42   std::lock_guard<std::mutex> lockGuard(fLock);
 
   44   unsigned int N = fPages.size();
 
   45   for (
unsigned i = 0; i < 
N; ++i) {
 
   46      if (fPages[i] != page) 
continue;
 
   48      if (--fReferences[i] == 0) {
 
   49         fDeleters[i](fPages[i]);
 
   50         fPages[i] = fPages[
N-1];
 
   51         fReferences[i] = fReferences[
N-1];
 
   52         fDeleters[i] = fDeleters[
N-1];
 
   54         fReferences.resize(
N-1);
 
   55         fDeleters.resize(
N-1);
 
   65   std::lock_guard<std::mutex> lockGuard(fLock);
 
   66   unsigned int N = fPages.size();
 
   67   for (
unsigned int i = 0; i < 
N; ++i) {
 
   68      if (fReferences[i] < 0) 
continue;
 
   69      if (fPages[i].GetColumnId() != columnId) 
continue;
 
   70      if (!fPages[i].Contains(globalIndex)) 
continue;
 
   80   std::lock_guard<std::mutex> lockGuard(fLock);
 
   81   unsigned int N = fPages.size();
 
   82   for (
unsigned int i = 0; i < 
N; ++i) {
 
   83      if (fReferences[i] < 0) 
continue;
 
   84      if (fPages[i].GetColumnId() != columnId) 
continue;
 
   85      if (!fPages[i].Contains(clusterIndex)) 
continue;
 
A closure that can free the memory associated with a mapped page.
 
std::vector< std::int32_t > fReferences
 
std::vector< RPageDeleter > fDeleters
 
void PreloadPage(const RPage &page, const RPageDeleter &deleter)
Like RegisterPage() but the reference counter is initialized to 0.
 
void ReturnPage(const RPage &page)
Give back a page to the pool and decrease the reference counter.
 
RPage GetPage(ColumnId_t columnId, NTupleSize_t globalIndex)
Tries to find the page corresponding to column and index in the cache.
 
std::vector< RPage > fPages
TODO(jblomer): should be an efficient index structure that allows.
 
void RegisterPage(const RPage &page, const RPageDeleter &deleter)
Adds a new page to the pool together with the function to free its space.
 
A page is a slice of a column that is mapped into memory.
 
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
 
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
 
std::int64_t ColumnId_t
Uniquely identifies a physical column within the scope of the current process, used to tag pages.