Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::RNTupleFillContext Class Reference

A context for filling entries (data) into clusters of an RNTuple.

An output cluster can be filled with entries. The caller has to make sure that the data that gets filled into a cluster is not modified for the time of the Fill() call. The fill call serializes the C++ object into the column format and writes data into the corresponding column page buffers. Writing of the buffers to storage is deferred and can be triggered by FlushCluster() or by destructing the context. On I/O errors, an exception is thrown.

Instances of this class are not meant to be used in isolation and can be created from an RNTupleParallelWriter. For sequential writing, please refer to RNTupleWriter.

Definition at line 52 of file RNTupleFillContext.hxx.

Public Member Functions

 ~RNTupleFillContext ()
void CommitStagedClusters ()
 Logically append staged clusters to the RNTuple.
std::unique_ptr< ROOT::REntryCreateEntry () const
std::unique_ptr< ROOT::Detail::RRawPtrWriteEntryCreateRawPtrWriteEntry () const
void EnableMetrics ()
void EnableStagedClusterCommitting (bool val=true)
std::size_t Fill (ROOT::Detail::RRawPtrWriteEntry &entry)
 Fill an RRawPtrWriteEntry into this context.
std::size_t Fill (ROOT::REntry &entry)
 Fill an entry into this context.
void FillNoFlush (ROOT::Detail::RRawPtrWriteEntry &entry, ROOT::RNTupleFillStatus &status)
 Fill an RRawPtrWriteEntry into this context, but don't commit the cluster.
void FillNoFlush (ROOT::REntry &entry, ROOT::RNTupleFillStatus &status)
 Fill an entry into this context, but don't commit the cluster.
void FlushCluster ()
 Flush so far filled entries to storage.
void FlushColumns ()
 Flush column data, preparing for CommitCluster or to reduce memory usage.
ROOT::NTupleSize_t GetLastFlushed () const
 Return the entry number that was last flushed in a cluster.
const Experimental::Detail::RNTupleMetricsGetMetrics () const
const ROOT::RNTupleModelGetModel () const
ROOT::NTupleSize_t GetNEntries () const
 Return the number of entries filled so far.
bool IsStagedClusterCommittingEnabled () const

Private Member Functions

 RNTupleFillContext (const RNTupleFillContext &)=delete
 RNTupleFillContext (RNTupleFillContext &&)=delete
 RNTupleFillContext (std::unique_ptr< ROOT::RNTupleModel > model, std::unique_ptr< ROOT::Internal::RPageSink > sink)
template<typename Entry>
std::size_t FillImpl (Entry &entry)
template<typename Entry>
void FillNoFlushImpl (Entry &entry, ROOT::RNTupleFillStatus &status)
RNTupleFillContextoperator= (const RNTupleFillContext &)=delete
RNTupleFillContextoperator= (RNTupleFillContext &&)=delete

Private Attributes

ROOT::NTupleSize_t fLastFlushed = 0
std::size_t fMaxUnzippedClusterSize
 Limit for committing cluster no matter the other tunables.
Experimental::Detail::RNTupleMetrics fMetrics
std::unique_ptr< ROOT::RNTupleModelfModel
 Needs to be destructed before fSink.
std::uint64_t fNBytesFilled = 0
 The total number of bytes filled into all the so far committed clusters, i.e.
std::uint64_t fNBytesFlushed = 0
 The total number of bytes written to storage (i.e., after compression).
ROOT::NTupleSize_t fNEntries = 0
std::unique_ptr< ROOT::Internal::RPageSinkfSink
bool fStagedClusterCommitting = false
 Whether to enable staged cluster committing, where only an explicit call to CommitStagedClusters() will logically append the clusters to the RNTuple.
std::vector< ROOT::Internal::RPageSink::RStagedClusterfStagedClusters
 Vector of currently staged clusters.
std::size_t fUnzippedClusterSize = 0
 Keeps track of the number of bytes written into the current cluster.
std::size_t fUnzippedClusterSizeEst
 Estimator of uncompressed cluster size, taking into account the estimated compression ratio.
std::unique_ptr< ROOT::Internal::RPageStorage::RTaskSchedulerfZipTasks
 The page sink's parallel page compression scheduler if IMT is on.

Friends

class RNTupleParallelWriter
class ROOT::Experimental::RNTupleAttrSetWriter
class ROOT::RNTupleWriter

#include <ROOT/RNTupleFillContext.hxx>

Constructor & Destructor Documentation

◆ RNTupleFillContext() [1/3]

ROOT::RNTupleFillContext::RNTupleFillContext ( std::unique_ptr< ROOT::RNTupleModel > model,
std::unique_ptr< ROOT::Internal::RPageSink > sink )
private

Definition at line 27 of file RNTupleFillContext.cxx.

◆ RNTupleFillContext() [2/3]

ROOT::RNTupleFillContext::RNTupleFillContext ( const RNTupleFillContext & )
privatedelete

◆ RNTupleFillContext() [3/3]

ROOT::RNTupleFillContext::RNTupleFillContext ( RNTupleFillContext && )
privatedelete

◆ ~RNTupleFillContext()

ROOT::RNTupleFillContext::~RNTupleFillContext ( )

Definition at line 42 of file RNTupleFillContext.cxx.

Member Function Documentation

◆ CommitStagedClusters()

void ROOT::RNTupleFillContext::CommitStagedClusters ( )

Logically append staged clusters to the RNTuple.

Definition at line 91 of file RNTupleFillContext.cxx.

◆ CreateEntry()

std::unique_ptr< ROOT::REntry > ROOT::RNTupleFillContext::CreateEntry ( ) const
inline

Definition at line 156 of file RNTupleFillContext.hxx.

◆ CreateRawPtrWriteEntry()

std::unique_ptr< ROOT::Detail::RRawPtrWriteEntry > ROOT::RNTupleFillContext::CreateRawPtrWriteEntry ( ) const
inline

Definition at line 157 of file RNTupleFillContext.hxx.

◆ EnableMetrics()

void ROOT::RNTupleFillContext::EnableMetrics ( )
inline

Definition at line 176 of file RNTupleFillContext.hxx.

◆ EnableStagedClusterCommitting()

void ROOT::RNTupleFillContext::EnableStagedClusterCommitting ( bool val = true)
inline

Definition at line 167 of file RNTupleFillContext.hxx.

◆ Fill() [1/2]

std::size_t ROOT::RNTupleFillContext::Fill ( ROOT::Detail::RRawPtrWriteEntry & entry)
inline

Fill an RRawPtrWriteEntry into this context.

This method will check the entry's model ID to ensure it comes from the context's own model or throw an exception otherwise.

Returns
The number of uncompressed bytes written.

Definition at line 145 of file RNTupleFillContext.hxx.

◆ Fill() [2/2]

std::size_t ROOT::RNTupleFillContext::Fill ( ROOT::REntry & entry)
inline

Fill an entry into this context.

This method will check the entry's model ID to ensure it comes from the context's own model or throw an exception otherwise.

Returns
The number of uncompressed bytes written.

Definition at line 131 of file RNTupleFillContext.hxx.

◆ FillImpl()

template<typename Entry>
std::size_t ROOT::RNTupleFillContext::FillImpl ( Entry & entry)
inlineprivate

Definition at line 104 of file RNTupleFillContext.hxx.

◆ FillNoFlush() [1/2]

void ROOT::RNTupleFillContext::FillNoFlush ( ROOT::Detail::RRawPtrWriteEntry & entry,
ROOT::RNTupleFillStatus & status )
inline

Fill an RRawPtrWriteEntry into this context, but don't commit the cluster.

The calling code must pass an RNTupleFillStatus and check RNTupleFillStatus::ShouldFlushCluster.

This method will check the entry's model ID to ensure it comes from the context's own model or throw an exception otherwise.

Definition at line 138 of file RNTupleFillContext.hxx.

◆ FillNoFlush() [2/2]

void ROOT::RNTupleFillContext::FillNoFlush ( ROOT::REntry & entry,
ROOT::RNTupleFillStatus & status )
inline

Fill an entry into this context, but don't commit the cluster.

The calling code must pass an RNTupleFillStatus and check RNTupleFillStatus::ShouldFlushCluster.

This method will check the entry's model ID to ensure it comes from the context's own model or throw an exception otherwise.

Definition at line 127 of file RNTupleFillContext.hxx.

◆ FillNoFlushImpl()

template<typename Entry>
void ROOT::RNTupleFillContext::FillNoFlushImpl ( Entry & entry,
ROOT::RNTupleFillStatus & status )
inlineprivate

Definition at line 88 of file RNTupleFillContext.hxx.

◆ FlushCluster()

void ROOT::RNTupleFillContext::FlushCluster ( )

Flush so far filled entries to storage.

Definition at line 63 of file RNTupleFillContext.cxx.

◆ FlushColumns()

void ROOT::RNTupleFillContext::FlushColumns ( )

Flush column data, preparing for CommitCluster or to reduce memory usage.

This will trigger compression of pages, but not actually write to storage.

Definition at line 56 of file RNTupleFillContext.cxx.

◆ GetLastFlushed()

ROOT::NTupleSize_t ROOT::RNTupleFillContext::GetLastFlushed ( ) const
inline

Return the entry number that was last flushed in a cluster.

Definition at line 163 of file RNTupleFillContext.hxx.

◆ GetMetrics()

const Experimental::Detail::RNTupleMetrics & ROOT::RNTupleFillContext::GetMetrics ( ) const
inline

Definition at line 177 of file RNTupleFillContext.hxx.

◆ GetModel()

const ROOT::RNTupleModel & ROOT::RNTupleFillContext::GetModel ( ) const
inline

Definition at line 155 of file RNTupleFillContext.hxx.

◆ GetNEntries()

ROOT::NTupleSize_t ROOT::RNTupleFillContext::GetNEntries ( ) const
inline

Return the number of entries filled so far.

Definition at line 165 of file RNTupleFillContext.hxx.

◆ IsStagedClusterCommittingEnabled()

bool ROOT::RNTupleFillContext::IsStagedClusterCommittingEnabled ( ) const
inline

Definition at line 174 of file RNTupleFillContext.hxx.

◆ operator=() [1/2]

RNTupleFillContext & ROOT::RNTupleFillContext::operator= ( const RNTupleFillContext & )
privatedelete

◆ operator=() [2/2]

RNTupleFillContext & ROOT::RNTupleFillContext::operator= ( RNTupleFillContext && )
privatedelete

◆ RNTupleParallelWriter

friend class RNTupleParallelWriter
friend

Definition at line 54 of file RNTupleFillContext.hxx.

◆ ROOT::Experimental::RNTupleAttrSetWriter

Definition at line 55 of file RNTupleFillContext.hxx.

◆ ROOT::RNTupleWriter

friend class ROOT::RNTupleWriter
friend

Definition at line 53 of file RNTupleFillContext.hxx.

Member Data Documentation

◆ fLastFlushed

ROOT::NTupleSize_t ROOT::RNTupleFillContext::fLastFlushed = 0
private

Definition at line 67 of file RNTupleFillContext.hxx.

◆ fMaxUnzippedClusterSize

std::size_t ROOT::RNTupleFillContext::fMaxUnzippedClusterSize
private

Limit for committing cluster no matter the other tunables.

Definition at line 77 of file RNTupleFillContext.hxx.

◆ fMetrics

Experimental::Detail::RNTupleMetrics ROOT::RNTupleFillContext::fMetrics
private

Definition at line 65 of file RNTupleFillContext.hxx.

◆ fModel

std::unique_ptr<ROOT::RNTupleModel> ROOT::RNTupleFillContext::fModel
private

Needs to be destructed before fSink.

Definition at line 63 of file RNTupleFillContext.hxx.

◆ fNBytesFilled

std::uint64_t ROOT::RNTupleFillContext::fNBytesFilled = 0
private

The total number of bytes filled into all the so far committed clusters, i.e.

the uncompressed size of the written clusters

Definition at line 75 of file RNTupleFillContext.hxx.

◆ fNBytesFlushed

std::uint64_t ROOT::RNTupleFillContext::fNBytesFlushed = 0
private

The total number of bytes written to storage (i.e., after compression).

Definition at line 72 of file RNTupleFillContext.hxx.

◆ fNEntries

ROOT::NTupleSize_t ROOT::RNTupleFillContext::fNEntries = 0
private

Definition at line 68 of file RNTupleFillContext.hxx.

◆ fSink

std::unique_ptr<ROOT::Internal::RPageSink> ROOT::RNTupleFillContext::fSink
private

Definition at line 61 of file RNTupleFillContext.hxx.

◆ fStagedClusterCommitting

bool ROOT::RNTupleFillContext::fStagedClusterCommitting = false
private

Whether to enable staged cluster committing, where only an explicit call to CommitStagedClusters() will logically append the clusters to the RNTuple.

Definition at line 83 of file RNTupleFillContext.hxx.

◆ fStagedClusters

std::vector<ROOT::Internal::RPageSink::RStagedCluster> ROOT::RNTupleFillContext::fStagedClusters
private

Vector of currently staged clusters.

Definition at line 85 of file RNTupleFillContext.hxx.

◆ fUnzippedClusterSize

std::size_t ROOT::RNTupleFillContext::fUnzippedClusterSize = 0
private

Keeps track of the number of bytes written into the current cluster.

Definition at line 70 of file RNTupleFillContext.hxx.

◆ fUnzippedClusterSizeEst

std::size_t ROOT::RNTupleFillContext::fUnzippedClusterSizeEst
private

Estimator of uncompressed cluster size, taking into account the estimated compression ratio.

Definition at line 79 of file RNTupleFillContext.hxx.

◆ fZipTasks

std::unique_ptr<ROOT::Internal::RPageStorage::RTaskScheduler> ROOT::RNTupleFillContext::fZipTasks
private

The page sink's parallel page compression scheduler if IMT is on.

Needs to be destructed after the page sink is destructed and so declared before.

Definition at line 60 of file RNTupleFillContext.hxx.


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