27 std::lock_guard<std::mutex> lockGuard(
fLock);
28 fPages.emplace_back(std::move(page));
36 std::lock_guard<std::mutex> lockGuard(fLock);
37 fPages.emplace_back(std::move(page));
38 fPageInfos.emplace_back(
RPageInfo{inMemoryType});
39 fReferences.emplace_back(0);
45 std::lock_guard<std::mutex> lockGuard(fLock);
47 unsigned int N = fPages.size();
48 for (
unsigned i = 0; i <
N; ++i) {
49 if (fPages[i] != page)
continue;
51 if (--fReferences[i] == 0) {
52 fPages[i] = std::move(fPages[
N - 1]);
53 fPageInfos[i] = fPageInfos[
N - 1];
54 fReferences[i] = fReferences[
N - 1];
56 fPageInfos.resize(
N - 1);
57 fReferences.resize(
N - 1);
65 std::type_index inMemoryType,
68 std::lock_guard<std::mutex> lockGuard(fLock);
69 unsigned int N = fPages.size();
70 for (
unsigned int i = 0; i <
N; ++i) {
71 if (fReferences[i] < 0)
continue;
72 if (fPages[i].GetColumnId() != columnId)
continue;
73 if (fPageInfos[i].fInMemoryType != inMemoryType)
75 if (!fPages[i].Contains(globalIndex))
continue;
83 std::type_index inMemoryType,
86 std::lock_guard<std::mutex> lockGuard(fLock);
87 unsigned int N = fPages.size();
88 for (
unsigned int i = 0; i <
N; ++i) {
89 if (fReferences[i] < 0)
continue;
90 if (fPages[i].GetColumnId() != columnId)
continue;
91 if (fPageInfos[i].fInMemoryType != inMemoryType)
93 if (!fPages[i].Contains(clusterIndex))
continue;
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
std::vector< RPage > fPages
TODO(jblomer): should be an efficient index structure that allows.
RPageRef GetPage(ColumnId_t columnId, std::type_index inMemoryType, NTupleSize_t globalIndex)
Tries to find the page corresponding to column and index in the cache.
std::vector< std::int32_t > fReferences
void ReleasePage(const RPage &page)
Give back a page to the pool and decrease the reference counter.
RPageRef RegisterPage(RPage page, std::type_index inMemoryType)
Adds a new page to the pool.
void PreloadPage(RPage page, std::type_index inMemoryType)
Like RegisterPage() but the reference counter is initialized to 0.
std::vector< RPageInfo > fPageInfos
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.