A thread-safe cache of column pages.
The page pool provides memory tracking for data written into an ntuple or read from an ntuple. Adding and removing pages is thread-safe. The page pool does not allocate the memory – allocation and deallocation is performed by the page storage, which might do it in a way optimized to the backing store (e.g., mmap()). Multiple page caches can coexist.
TODO(jblomer): it should be possible to register pages and to find them by column and index; this would facilitate pre-filling a cache, e.g. by read-ahead.
Definition at line 47 of file RPagePool.hxx.
Public Member Functions | |
RPagePool ()=default | |
RPagePool (const RPagePool &)=delete | |
~RPagePool ()=default | |
RPage | GetPage (ColumnId_t columnId, const RClusterIndex &clusterIndex) |
RPage | GetPage (ColumnId_t columnId, NTupleSize_t globalIndex) |
Tries to find the page corresponding to column and index in the cache. | |
RPagePool & | operator= (const RPagePool &)=delete |
void | PreloadPage (const RPage &page, const RPageDeleter &deleter) |
Like RegisterPage() but the reference counter is initialized to 0. | |
void | RegisterPage (const RPage &page, const RPageDeleter &deleter) |
Adds a new page to the pool together with the function to free its space. | |
void | ReturnPage (const RPage &page) |
Give back a page to the pool and decrease the reference counter. | |
Private Attributes | |
std::vector< RPageDeleter > | fDeleters |
std::mutex | fLock |
std::vector< RPage > | fPages |
TODO(jblomer): should be an efficient index structure that allows. | |
std::vector< std::int32_t > | fReferences |
#include <ROOT/RPagePool.hxx>
|
default |
|
delete |
|
default |
ROOT::Experimental::Detail::RPage ROOT::Experimental::Detail::RPagePool::GetPage | ( | ColumnId_t | columnId, |
const RClusterIndex & | clusterIndex | ||
) |
Definition at line 77 of file RPagePool.cxx.
ROOT::Experimental::Detail::RPage ROOT::Experimental::Detail::RPagePool::GetPage | ( | ColumnId_t | columnId, |
NTupleSize_t | globalIndex | ||
) |
Tries to find the page corresponding to column and index in the cache.
If the page is found, its reference counter is increased
Definition at line 62 of file RPagePool.cxx.
void ROOT::Experimental::Detail::RPagePool::PreloadPage | ( | const RPage & | page, |
const RPageDeleter & | deleter | ||
) |
Like RegisterPage() but the reference counter is initialized to 0.
Definition at line 31 of file RPagePool.cxx.
void ROOT::Experimental::Detail::RPagePool::RegisterPage | ( | const RPage & | page, |
const RPageDeleter & | deleter | ||
) |
Adds a new page to the pool together with the function to free its space.
Upon registration, the page pool takes ownership of the page's memory. The new page has its reference counter set to 1.
Definition at line 23 of file RPagePool.cxx.
Give back a page to the pool and decrease the reference counter.
There must not be any pointers anymore into this page. If the reference counter drops to zero, the page pool might decide to call the deleter given in during registration.
Definition at line 39 of file RPagePool.cxx.
|
private |
Definition at line 56 of file RPagePool.hxx.
|
private |
Definition at line 57 of file RPagePool.hxx.
|
private |
TODO(jblomer): should be an efficient index structure that allows.
Definition at line 54 of file RPagePool.hxx.
|
private |
Definition at line 55 of file RPagePool.hxx.