Write RNTuple data blocks in a TFile or a bare file container.
The writer can create a new TFile container for an RNTuple or add an RNTuple to an existing TFile. Creating a single RNTuple in a new TFile container can be done with a C file stream without a TFile class. Updating an existing TFile requires a proper TFile object. Also, writing a remote file requires a proper TFile object. A stand-alone version of RNTuple can remove the TFile based writer.
Definition at line 109 of file RMiniFile.hxx.
Classes | |
struct | RFileProper |
struct | RFileSimple |
Public Types | |
enum class | EContainerFormat { kTFile , kBare } |
For testing purposes, RNTuple data can be written into a bare file container instead of a ROOT file. More... | |
Public Member Functions | |
RNTupleFileWriter (const RNTupleFileWriter &other)=delete | |
RNTupleFileWriter (RNTupleFileWriter &&other)=delete | |
~RNTupleFileWriter () | |
void | Commit () |
Writes the RNTuple key to the file so that the header and footer keys can be found. | |
RNTupleFileWriter & | operator= (const RNTupleFileWriter &other)=delete |
RNTupleFileWriter & | operator= (RNTupleFileWriter &&other)=delete |
std::uint64_t | ReserveBlob (size_t nbytes, size_t len) |
Reserves a new record as an RBlob key in the file. | |
void | UpdateStreamerInfos (const RNTupleSerializer::StreamerInfoMap_t &streamerInfos) |
Ensures that the streamer info records passed as argument are written to the file. | |
std::uint64_t | WriteBlob (const void *data, size_t nbytes, size_t len) |
Writes a new record as an RBlob key into the file. | |
void | WriteIntoReservedBlob (const void *buffer, size_t nbytes, std::int64_t offset) |
Write into a reserved record; the caller is responsible for making sure that the written byte range is in the previously reserved key. | |
std::uint64_t | WriteNTupleFooter (const void *data, size_t nbytes, size_t lenFooter) |
Writes the compressed footer and registeres its location; lenFooter is the size of the uncompressed footer. | |
std::uint64_t | WriteNTupleHeader (const void *data, size_t nbytes, size_t lenHeader) |
Writes the compressed header and registeres its location; lenHeader is the size of the uncompressed header. | |
Static Public Member Functions | |
static std::unique_ptr< RNTupleFileWriter > | Append (std::string_view ntupleName, TDirectory &fileOrDirectory, std::uint64_t maxKeySize) |
The directory parameter can also be a TFile object (TFile inherits from TDirectory). | |
static std::unique_ptr< RNTupleFileWriter > | Recreate (std::string_view ntupleName, std::string_view path, EContainerFormat containerFormat, const RNTupleWriteOptions &options) |
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName. | |
Private Member Functions | |
RNTupleFileWriter (std::string_view name, std::uint64_t maxKeySize) | |
void | WriteBareFileSkeleton (int defaultCompression) |
For a bare file, which is necessarily written by a C file stream, write file header. | |
void | WriteTFileFreeList () |
Last record in the file. | |
void | WriteTFileKeysList () |
Write the TList with the RNTuple key. | |
void | WriteTFileNTupleKey () |
The only key that will be visible in file->ls() | |
void | WriteTFileSkeleton (int defaultCompression) |
For a TFile container written by a C file stream, write the header and TFile object. | |
void | WriteTFileStreamerInfo () |
Write the compressed streamer info record with the description of the RNTuple class. | |
Private Attributes | |
std::string | fFileName |
The file name without parent directory; only required when writing with a C file stream. | |
RFileProper | fFileProper |
For updating existing files and for storing more than just an RNTuple in the file. | |
RFileSimple | fFileSimple |
For simple use cases, survives without libRIO dependency. | |
bool | fIsBare = false |
A simple file can either be written as TFile container or as NTuple bare file. | |
RNTuple | fNTupleAnchor |
Header and footer location of the ntuple, written on Commit() | |
std::string | fNTupleName |
The identifier of the RNTuple; A single writer object can only write a single RNTuple but multiple writers can operate on the same file if (and only if) they use a proper TFile object for writing. | |
RNTupleSerializer::StreamerInfoMap_t | fStreamerInfoMap |
Set of streamer info records that should be written to the file. | |
#include <ROOT/RMiniFile.hxx>
For testing purposes, RNTuple data can be written into a bare file container instead of a ROOT file.
Enumerator | |
---|---|
kTFile | |
kBare |
Definition at line 203 of file RMiniFile.hxx.
|
explicitprivate |
Definition at line 1080 of file RMiniFile.cxx.
|
delete |
|
delete |
ROOT::Experimental::Internal::RNTupleFileWriter::~RNTupleFileWriter | ( | ) |
Definition at line 1089 of file RMiniFile.cxx.
|
static |
The directory parameter can also be a TFile object (TFile inherits from TDirectory).
Definition at line 1143 of file RMiniFile.cxx.
void ROOT::Experimental::Internal::RNTupleFileWriter::Commit | ( | ) |
Writes the RNTuple key to the file so that the header and footer keys can be found.
Definition at line 1162 of file RMiniFile.cxx.
|
delete |
|
delete |
|
static |
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName.
Uses a C stream for writing
Definition at line 1092 of file RMiniFile.cxx.
std::uint64_t ROOT::Experimental::Internal::RNTupleFileWriter::ReserveBlob | ( | size_t | nbytes, |
size_t | len ) |
Reserves a new record as an RBlob key in the file.
Definition at line 1282 of file RMiniFile.cxx.
void ROOT::Experimental::Internal::RNTupleFileWriter::UpdateStreamerInfos | ( | const RNTupleSerializer::StreamerInfoMap_t & | streamerInfos | ) |
Ensures that the streamer info records passed as argument are written to the file.
Definition at line 1156 of file RMiniFile.cxx.
|
private |
For a bare file, which is necessarily written by a C file stream, write file header.
Definition at line 1331 of file RMiniFile.cxx.
std::uint64_t ROOT::Experimental::Internal::RNTupleFileWriter::WriteBlob | ( | const void * | data, |
size_t | nbytes, | ||
size_t | len ) |
Writes a new record as an RBlob key into the file.
Definition at line 1207 of file RMiniFile.cxx.
void ROOT::Experimental::Internal::RNTupleFileWriter::WriteIntoReservedBlob | ( | const void * | buffer, |
size_t | nbytes, | ||
std::int64_t | offset ) |
Write into a reserved record; the caller is responsible for making sure that the written byte range is in the previously reserved key.
Definition at line 1301 of file RMiniFile.cxx.
std::uint64_t ROOT::Experimental::Internal::RNTupleFileWriter::WriteNTupleFooter | ( | const void * | data, |
size_t | nbytes, | ||
size_t | lenFooter ) |
Writes the compressed footer and registeres its location; lenFooter is the size of the uncompressed footer.
Definition at line 1322 of file RMiniFile.cxx.
std::uint64_t ROOT::Experimental::Internal::RNTupleFileWriter::WriteNTupleHeader | ( | const void * | data, |
size_t | nbytes, | ||
size_t | lenHeader ) |
Writes the compressed header and registeres its location; lenHeader is the size of the uncompressed header.
Definition at line 1312 of file RMiniFile.cxx.
|
private |
Last record in the file.
Definition at line 1421 of file RMiniFile.cxx.
|
private |
Write the TList with the RNTuple key.
Definition at line 1392 of file RMiniFile.cxx.
|
private |
The only key that will be visible in file->ls()
Definition at line 1438 of file RMiniFile.cxx.
|
private |
For a TFile container written by a C file stream, write the header and TFile object.
Definition at line 1458 of file RMiniFile.cxx.
|
private |
Write the compressed streamer info record with the description of the RNTuple class.
Definition at line 1348 of file RMiniFile.cxx.
|
private |
The file name without parent directory; only required when writing with a C file stream.
Definition at line 179 of file RMiniFile.hxx.
|
private |
For updating existing files and for storing more than just an RNTuple in the file.
Definition at line 170 of file RMiniFile.hxx.
|
private |
For simple use cases, survives without libRIO dependency.
Definition at line 172 of file RMiniFile.hxx.
A simple file can either be written as TFile container or as NTuple bare file.
Definition at line 174 of file RMiniFile.hxx.
|
private |
Header and footer location of the ntuple, written on Commit()
Definition at line 181 of file RMiniFile.hxx.
|
private |
The identifier of the RNTuple; A single writer object can only write a single RNTuple but multiple writers can operate on the same file if (and only if) they use a proper TFile object for writing.
Definition at line 177 of file RMiniFile.hxx.
|
private |
Set of streamer info records that should be written to the file.
The RNTuple class description is always present.
Definition at line 184 of file RMiniFile.hxx.