Logo ROOT   master
Reference Guide
ROOT::Experimental::Detail::RPageSink Class Referenceabstract


Abstract interface to write data into an ntuple

The page sink takes the list of columns and afterwards a series of page commits and cluster commits. The user is responsible to commit clusters at a consistent point, i.e. when all pages corresponding to data up to the given entry number are committed.

Definition at line 102 of file RPageStorage.hxx.

Public Member Functions

 RPageSink (std::string_view ntupleName, const RNTupleWriteOptions &options)
 
virtual ~RPageSink ()
 
ColumnHandle_t AddColumn (DescriptorId_t fieldId, const RColumn &column) final
 Register a new column. More...
 
void CommitCluster (NTupleSize_t nEntries)
 Finalize the current cluster and create a new one for the following data. More...
 
void CommitDataset ()
 Finalize the current cluster and the entrire data set. More...
 
void CommitPage (ColumnHandle_t columnHandle, const RPage &page)
 Write a page to the storage. The column must have been added before. More...
 
void Create (RNTupleModel &model)
 Physically creates the storage container to hold the ntuple (e.g., a keys a TFile or an S3 bucket) To do so, Create() calls CreateImpl() after updating the descriptor. More...
 
EPageStorageType GetType () final
 Whether the concrete implementation is a sink or a source. More...
 
virtual RPage ReservePage (ColumnHandle_t columnHandle, std::size_t nElements=0)=0
 Get a new, empty page for the given column that can be filled with up to nElements. More...
 
- Public Member Functions inherited from ROOT::Experimental::Detail::RPageStorage
 RPageStorage (std::string_view name)
 
 RPageStorage (const RPageStorage &other)=delete
 
virtual ~RPageStorage ()
 
virtual RNTupleMetricsGetMetrics ()=0
 Page storage implementations usually have their own metrics. More...
 
RPageStorageoperator= (const RPageStorage &other)=delete
 
virtual void ReleasePage (RPage &page)=0
 Every page store needs to be able to free pages it handed out. More...
 

Static Public Member Functions

static std::unique_ptr< RPageSinkCreate (std::string_view ntupleName, std::string_view location, const RNTupleWriteOptions &options=RNTupleWriteOptions())
 Guess the concrete derived page source from the file name (location) More...
 

Protected Member Functions

virtual RClusterDescriptor::RLocator CommitClusterImpl (NTupleSize_t nEntries)=0
 
virtual void CommitDatasetImpl ()=0
 
virtual RClusterDescriptor::RLocator CommitPageImpl (ColumnHandle_t columnHandle, const RPage &page)=0
 
virtual void CreateImpl (const RNTupleModel &model)=0
 

Protected Attributes

RNTupleDescriptorBuilder fDescriptorBuilder
 
DescriptorId_t fLastClusterId = 0
 
DescriptorId_t fLastColumnId = 0
 
DescriptorId_t fLastFieldId = 0
 Building the ntuple descriptor while writing is done in the same way for all the storage sink implementations. More...
 
std::vector< RClusterDescriptor::RColumnRangefOpenColumnRanges
 Keeps track of the number of elements in the currently open cluster. Indexed by column id. More...
 
std::vector< RClusterDescriptor::RPageRangefOpenPageRanges
 Keeps track of the written pages in the currently open cluster. Indexed by column id. More...
 
const RNTupleWriteOptions fOptions
 
NTupleSize_t fPrevClusterNEntries = 0
 
- Protected Attributes inherited from ROOT::Experimental::Detail::RPageStorage
std::string fNTupleName
 

Additional Inherited Members

- Public Types inherited from ROOT::Experimental::Detail::RPageStorage
using ColumnHandle_t = RColumnHandle
 The column handle identifies a column with the current open page storage. More...
 

#include <ROOT/RPageStorage.hxx>

Inheritance diagram for ROOT::Experimental::Detail::RPageSink:
[legend]

Constructor & Destructor Documentation

◆ RPageSink()

ROOT::Experimental::Detail::RPageSink::RPageSink ( std::string_view  ntupleName,
const RNTupleWriteOptions options 
)

Definition at line 88 of file RPageStorage.cxx.

◆ ~RPageSink()

ROOT::Experimental::Detail::RPageSink::~RPageSink ( )
virtual

Definition at line 93 of file RPageStorage.cxx.

Member Function Documentation

◆ AddColumn()

ROOT::Experimental::Detail::RPageStorage::ColumnHandle_t ROOT::Experimental::Detail::RPageSink::AddColumn ( DescriptorId_t  fieldId,
const RColumn column 
)
finalvirtual

Register a new column.

When reading, the column must exist in the ntuple on disk corresponding to the meta-data. When writing, every column can only be attached once.

Implements ROOT::Experimental::Detail::RPageStorage.

Definition at line 104 of file RPageStorage.cxx.

◆ CommitCluster()

void ROOT::Experimental::Detail::RPageSink::CommitCluster ( NTupleSize_t  nEntries)

Finalize the current cluster and create a new one for the following data.

Definition at line 161 of file RPageStorage.cxx.

◆ CommitClusterImpl()

virtual RClusterDescriptor::RLocator ROOT::Experimental::Detail::RPageSink::CommitClusterImpl ( NTupleSize_t  nEntries)
protectedpure virtual

◆ CommitDataset()

void ROOT::Experimental::Detail::RPageSink::CommitDataset ( )
inline

Finalize the current cluster and the entrire data set.

Definition at line 142 of file RPageStorage.hxx.

◆ CommitDatasetImpl()

virtual void ROOT::Experimental::Detail::RPageSink::CommitDatasetImpl ( )
protectedpure virtual

◆ CommitPage()

void ROOT::Experimental::Detail::RPageSink::CommitPage ( ColumnHandle_t  columnHandle,
const RPage page 
)

Write a page to the storage. The column must have been added before.

Definition at line 148 of file RPageStorage.cxx.

◆ CommitPageImpl()

virtual RClusterDescriptor::RLocator ROOT::Experimental::Detail::RPageSink::CommitPageImpl ( ColumnHandle_t  columnHandle,
const RPage page 
)
protectedpure virtual

◆ Create() [1/2]

std::unique_ptr< ROOT::Experimental::Detail::RPageSink > ROOT::Experimental::Detail::RPageSink::Create ( std::string_view  ntupleName,
std::string_view  location,
const RNTupleWriteOptions options = RNTupleWriteOptions() 
)
static

Guess the concrete derived page source from the file name (location)

Definition at line 97 of file RPageStorage.cxx.

◆ Create() [2/2]

void ROOT::Experimental::Detail::RPageSink::Create ( RNTupleModel model)

Physically creates the storage container to hold the ntuple (e.g., a keys a TFile or an S3 bucket) To do so, Create() calls CreateImpl() after updating the descriptor.

Create() associates column handles to the columns referenced by the model

Definition at line 112 of file RPageStorage.cxx.

◆ CreateImpl()

virtual void ROOT::Experimental::Detail::RPageSink::CreateImpl ( const RNTupleModel model)
protectedpure virtual

◆ GetType()

EPageStorageType ROOT::Experimental::Detail::RPageSink::GetType ( )
inlinefinalvirtual

Whether the concrete implementation is a sink or a source.

Implements ROOT::Experimental::Detail::RPageStorage.

Definition at line 129 of file RPageStorage.hxx.

◆ ReservePage()

virtual RPage ROOT::Experimental::Detail::RPageSink::ReservePage ( ColumnHandle_t  columnHandle,
std::size_t  nElements = 0 
)
pure virtual

Get a new, empty page for the given column that can be filled with up to nElements.

If nElements is zero, the page sink picks an appropriate size.

Implemented in ROOT::Experimental::Detail::RPageSinkFile.

Member Data Documentation

◆ fDescriptorBuilder

RNTupleDescriptorBuilder ROOT::Experimental::Detail::RPageSink::fDescriptorBuilder
protected

Definition at line 116 of file RPageStorage.hxx.

◆ fLastClusterId

DescriptorId_t ROOT::Experimental::Detail::RPageSink::fLastClusterId = 0
protected

Definition at line 110 of file RPageStorage.hxx.

◆ fLastColumnId

DescriptorId_t ROOT::Experimental::Detail::RPageSink::fLastColumnId = 0
protected

Definition at line 109 of file RPageStorage.hxx.

◆ fLastFieldId

DescriptorId_t ROOT::Experimental::Detail::RPageSink::fLastFieldId = 0
protected

Building the ntuple descriptor while writing is done in the same way for all the storage sink implementations.

Field, column, cluster ids and page indexes per cluster are issued sequentially starting with 0

Definition at line 108 of file RPageStorage.hxx.

◆ fOpenColumnRanges

std::vector<RClusterDescriptor::RColumnRange> ROOT::Experimental::Detail::RPageSink::fOpenColumnRanges
protected

Keeps track of the number of elements in the currently open cluster. Indexed by column id.

Definition at line 113 of file RPageStorage.hxx.

◆ fOpenPageRanges

std::vector<RClusterDescriptor::RPageRange> ROOT::Experimental::Detail::RPageSink::fOpenPageRanges
protected

Keeps track of the written pages in the currently open cluster. Indexed by column id.

Definition at line 115 of file RPageStorage.hxx.

◆ fOptions

const RNTupleWriteOptions ROOT::Experimental::Detail::RPageSink::fOptions
protected

Definition at line 104 of file RPageStorage.hxx.

◆ fPrevClusterNEntries

NTupleSize_t ROOT::Experimental::Detail::RPageSink::fPrevClusterNEntries = 0
protected

Definition at line 111 of file RPageStorage.hxx.


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