Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Detail::RPagePool Class Reference

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.
 
RPagePooloperator= (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< RPageDeleterfDeleters
 
std::mutex fLock
 
std::vector< RPagefPages
 TODO(jblomer): should be an efficient index structure that allows.
 
std::vector< std::int32_t > fReferences
 

#include <ROOT/RPagePool.hxx>

Constructor & Destructor Documentation

◆ RPagePool() [1/2]

ROOT::Experimental::Detail::RPagePool::RPagePool ( )
default

◆ RPagePool() [2/2]

ROOT::Experimental::Detail::RPagePool::RPagePool ( const RPagePool )
delete

◆ ~RPagePool()

ROOT::Experimental::Detail::RPagePool::~RPagePool ( )
default

Member Function Documentation

◆ GetPage() [1/2]

ROOT::Experimental::Detail::RPage ROOT::Experimental::Detail::RPagePool::GetPage ( ColumnId_t  columnId,
const RClusterIndex clusterIndex 
)

Definition at line 77 of file RPagePool.cxx.

◆ GetPage() [2/2]

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.

◆ operator=()

RPagePool & ROOT::Experimental::Detail::RPagePool::operator= ( const RPagePool )
delete

◆ PreloadPage()

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.

◆ RegisterPage()

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.

◆ ReturnPage()

void ROOT::Experimental::Detail::RPagePool::ReturnPage ( const RPage page)

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.

Member Data Documentation

◆ fDeleters

std::vector<RPageDeleter> ROOT::Experimental::Detail::RPagePool::fDeleters
private

Definition at line 56 of file RPagePool.hxx.

◆ fLock

std::mutex ROOT::Experimental::Detail::RPagePool::fLock
private

Definition at line 57 of file RPagePool.hxx.

◆ fPages

std::vector<RPage> ROOT::Experimental::Detail::RPagePool::fPages
private

TODO(jblomer): should be an efficient index structure that allows.

  • random insert
  • random delete
  • searching by page
  • searching by tree index

Definition at line 54 of file RPagePool.hxx.

◆ fReferences

std::vector<std::int32_t> ROOT::Experimental::Detail::RPagePool::fReferences
private

Definition at line 55 of file RPagePool.hxx.

Libraries for ROOT::Experimental::Detail::RPagePool:

The documentation for this class was generated from the following files: