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 46 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. More... | |
RPagePool & | operator= (const RPagePool &)=delete |
void | RegisterPage (const RPage &page, const RPageDeleter &deleter) |
Adds a new page to the pool together with the function to free its space. More... | |
void | ReturnPage (const RPage &page) |
Give back a page to the pool and decrease the reference counter. More... | |
Private Attributes | |
std::vector< RPageDeleter > | fDeleters |
std::vector< RPage > | fPages |
TODO(jblomer): should be an efficient index structure that allows. More... | |
std::vector< std::uint32_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 66 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 52 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 30 of file RPagePool.cxx.
|
private |
Definition at line 55 of file RPagePool.hxx.
|
private |
TODO(jblomer): should be an efficient index structure that allows.
Definition at line 53 of file RPagePool.hxx.
|
private |
Definition at line 54 of file RPagePool.hxx.