An RNTuple that gets filled with entries (data) and writes them to storage.
An output ntuple can be filled with entries. The caller has to make sure that the data that gets filled into an ntuple 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 writer. On I/O errors, an exception is thrown.
Definition at line 60 of file RNTupleWriter.hxx.
Public Member Functions | |
RNTupleWriter (const RNTupleWriter &)=delete | |
~RNTupleWriter () | |
void | CommitCluster (bool commitClusterGroup=false) |
Ensure that the data from the so far seen Fill calls has been written to storage. | |
void | CommitDataset () |
Closes the underlying file (page sink) and expires the model. | |
std::unique_ptr< REntry > | CreateEntry () |
std::unique_ptr< RNTupleModel::RUpdater > | CreateModelUpdater () |
Get a RNTupleModel::RUpdater that provides limited support for incremental updates to the underlying model, e.g. | |
void | EnableMetrics () |
std::size_t | Fill () |
The simplest user interface if the default entry that comes with the ntuple model is used. | |
std::size_t | Fill (REntry &entry) |
Multiple entries can have been instantiated from the ntuple model. | |
void | FillNoFlush (REntry &entry, RNTupleFillStatus &status) |
Fill an entry into this ntuple, 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. | |
NTupleSize_t | GetLastCommitted () const |
Return the entry number that was last committed in a cluster. | |
NTupleSize_t | GetLastCommittedClusterGroup () const |
Return the entry number that was last committed in a cluster group. | |
NTupleSize_t | GetLastFlushed () const |
Return the entry number that was last flushed in a cluster. | |
const Detail::RNTupleMetrics & | GetMetrics () const |
const RNTupleModel & | GetModel () const |
NTupleSize_t | GetNEntries () const |
Return the number of entries filled so far. | |
RNTupleWriter & | operator= (const RNTupleWriter &)=delete |
Static Public Member Functions | |
static std::unique_ptr< RNTupleWriter > | Append (std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, TFile &file, const RNTupleWriteOptions &options=RNTupleWriteOptions()) |
Throws an exception if the model is null. | |
static std::unique_ptr< RNTupleWriter > | Recreate (std::initializer_list< std::pair< std::string_view, std::string_view > > fields, std::string_view ntupleName, std::string_view storage, const RNTupleWriteOptions &options=RNTupleWriteOptions()) |
static std::unique_ptr< RNTupleWriter > | Recreate (std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleWriteOptions &options=RNTupleWriteOptions()) |
Throws an exception if the model is null. | |
Private Member Functions | |
RNTupleWriter (std::unique_ptr< RNTupleModel > model, std::unique_ptr< Internal::RPageSink > sink) | |
void | CommitClusterGroup () |
Internal::RPageSink & | GetSink () |
RNTupleModel & | GetUpdatableModel () |
Static Private Member Functions | |
static std::unique_ptr< RNTupleWriter > | Create (std::unique_ptr< RNTupleModel > model, std::unique_ptr< Internal::RPageSink > sink, const RNTupleWriteOptions &options) |
Create a writer, potentially wrapping the sink in a RPageSinkBuf. | |
Private Attributes | |
RNTupleFillContext | fFillContext |
NTupleSize_t | fLastCommittedClusterGroup = 0 |
Detail::RNTupleMetrics | fMetrics |
std::unique_ptr< Internal::RPageStorage::RTaskScheduler > | fZipTasks |
The page sink's parallel page compression scheduler if IMT is on. | |
Friends | |
std::unique_ptr< RNTupleWriter > | Internal::CreateRNTupleWriter (std::unique_ptr< RNTupleModel >, std::unique_ptr< Internal::RPageSink >) |
#include <ROOT/RNTupleWriter.hxx>
|
private |
Definition at line 33 of file RNTupleWriter.cxx.
|
delete |
ROOT::Experimental::RNTupleWriter::~RNTupleWriter | ( | ) |
Definition at line 48 of file RNTupleWriter.cxx.
|
static |
Throws an exception if the model is null.
Definition at line 95 of file RNTupleWriter.cxx.
|
inline |
Ensure that the data from the so far seen Fill calls has been written to storage.
Definition at line 119 of file RNTupleWriter.hxx.
|
private |
Definition at line 106 of file RNTupleWriter.cxx.
void ROOT::Experimental::RNTupleWriter::CommitDataset | ( | ) |
Closes the underlying file (page sink) and expires the model.
Automatically called on destruct. Once the dataset is committed, calls to Fill(), [Commit|Flush]Cluster(), FlushColumns(), CreateEntry(), and model updating fail.
Definition at line 122 of file RNTupleWriter.cxx.
|
staticprivate |
Create a writer, potentially wrapping the sink in a RPageSinkBuf.
Definition at line 58 of file RNTupleWriter.cxx.
|
inline |
Definition at line 130 of file RNTupleWriter.hxx.
|
inline |
Get a RNTupleModel::RUpdater
that provides limited support for incremental updates to the underlying model, e.g.
addition of new fields.
Example: add a new field after the model has been used to construct a RNTupleWriter
object
Definition at line 165 of file RNTupleWriter.hxx.
|
inline |
Definition at line 141 of file RNTupleWriter.hxx.
|
inline |
The simplest user interface if the default entry that comes with the ntuple model is used.
Definition at line 105 of file RNTupleWriter.hxx.
|
inline |
Multiple entries can have been instantiated from the ntuple model.
This method will perform a light check whether the entry comes from the ntuple's own model.
Definition at line 109 of file RNTupleWriter.hxx.
|
inline |
Fill an entry into this ntuple, but don't commit the cluster.
The calling code must pass an RNTupleFillStatus and check RNTupleFillStatus::ShouldFlushCluster.
Definition at line 112 of file RNTupleWriter.hxx.
|
inline |
Flush so far filled entries to storage.
Definition at line 117 of file RNTupleWriter.hxx.
|
inline |
Flush column data, preparing for CommitCluster or to reduce memory usage.
This will trigger compression of pages, but not actually write to storage (unless buffered writing is turned off).
Definition at line 115 of file RNTupleWriter.hxx.
|
inline |
Return the entry number that was last committed in a cluster.
Definition at line 135 of file RNTupleWriter.hxx.
|
inline |
Return the entry number that was last committed in a cluster group.
Definition at line 137 of file RNTupleWriter.hxx.
|
inline |
Return the entry number that was last flushed in a cluster.
Definition at line 133 of file RNTupleWriter.hxx.
|
inline |
Definition at line 142 of file RNTupleWriter.hxx.
|
inline |
Definition at line 144 of file RNTupleWriter.hxx.
|
inline |
Return the number of entries filled so far.
Definition at line 139 of file RNTupleWriter.hxx.
|
inlineprivate |
Definition at line 77 of file RNTupleWriter.hxx.
|
private |
Definition at line 114 of file RNTupleWriter.cxx.
|
delete |
|
static |
Definition at line 79 of file RNTupleWriter.cxx.
|
static |
Throws an exception if the model is null.
Definition at line 71 of file RNTupleWriter.cxx.
|
friend |
|
private |
Definition at line 69 of file RNTupleWriter.hxx.
|
private |
Definition at line 72 of file RNTupleWriter.hxx.
|
private |
Definition at line 70 of file RNTupleWriter.hxx.
|
private |
The page sink's parallel page compression scheduler if IMT is on.
Needs to be destructed after the page sink (in the fill context) is destructed and so declared before.
Definition at line 68 of file RNTupleWriter.hxx.