Read RNTuple data blocks from a TFile container, provided by a RRawFile.
A RRawFile is used for the byte access. The class implements a minimal subset of TFile, enough to extract RNTuple data keys.
Definition at line 60 of file RMiniFile.hxx.
Public Member Functions | |
| RMiniFileReader ()=default | |
| RMiniFileReader (ROOT::Internal::RRawFile *rawFile) | |
| Uses the given raw file to read byte ranges. | |
| std::uint64_t | GetMaxKeySize () const |
| RResult< RNTuple > | GetNTuple (std::string_view ntupleName) |
| Extracts header and footer location for the RNTuple identified by ntupleName. | |
| RResult< RNTuple > | GetNTupleProperAtOffset (std::uint64_t payloadOffset, std::uint64_t compSize, std::uint64_t uncompLen) |
| Loads an RNTuple anchor from a TFile at the given file offset (unzipping it if necessary). | |
| void | LoadStreamerInfo () |
| Attempts to load the streamer info from the file. | |
| void | ReadBuffer (void *buffer, size_t nbytes, std::uint64_t offset) |
| Reads a given byte range from the file into the provided memory buffer. | |
| void | SetMaxKeySize (std::uint64_t maxKeySize) |
| If the reader is not used to retrieve the anchor, we need to set the max key size manually. | |
| ROOT::RResult< void > | TryReadBuffer (void *buffer, size_t nbytes, std::uint64_t offset) |
| Like ReadBuffer but returns a RResult instead of throwing. | |
Private Member Functions | |
| RResult< RNTuple > | GetNTupleBare (std::string_view ntupleName) |
| Used when the file container turns out to be a bare file. | |
| RResult< RNTuple > | GetNTupleProper (std::string_view ntuplePath) |
| Used when the file turns out to be a TFile container. | |
| std::uint64_t | SearchInDirectory (std::uint64_t &offsetDir, std::string_view keyName, std::string_view typeName) |
| Searches for a key with the given name and type in the key index of the directory starting at offsetDir. | |
Private Attributes | |
| bool | fIsBare = false |
| Indicates whether the file is a TFile container or an RNTuple bare file. | |
| std::uint64_t | fMaxKeySize = 0 |
If fMaxKeySize > 0 and ReadBuffer attempts to read nbytes > maxKeySize, it will assume the blob being read is chunked and read all the chunks into the buffer. | |
| ROOT::Internal::RRawFile * | fRawFile = nullptr |
| The raw file used to read byte ranges. | |
#include <ROOT/RMiniFile.hxx>
|
default |
|
explicit |
Uses the given raw file to read byte ranges.
Definition at line 673 of file RMiniFile.cxx.
|
inline |
Definition at line 102 of file RMiniFile.hxx.
| ROOT::RResult< ROOT::RNTuple > ROOT::Internal::RMiniFileReader::GetNTuple | ( | std::string_view | ntupleName | ) |
Extracts header and footer location for the RNTuple identified by ntupleName.
Definition at line 675 of file RMiniFile.cxx.
|
private |
Used when the file container turns out to be a bare file.
Definition at line 861 of file RMiniFile.cxx.
|
private |
Used when the file turns out to be a TFile container.
The ntuplePath variable is either the ntuple name or an ntuple name preceded by a directory (myNtuple or foo/bar/myNtuple or /foo/bar/myNtuple)
Definition at line 770 of file RMiniFile.cxx.
| ROOT::RResult< ROOT::RNTuple > ROOT::Internal::RMiniFileReader::GetNTupleProperAtOffset | ( | std::uint64_t | payloadOffset, |
| std::uint64_t | compSize, | ||
| std::uint64_t | uncompLen ) |
Loads an RNTuple anchor from a TFile at the given file offset (unzipping it if necessary).
Definition at line 825 of file RMiniFile.cxx.
| void ROOT::Internal::RMiniFileReader::LoadStreamerInfo | ( | ) |
Attempts to load the streamer info from the file.
Definition at line 726 of file RMiniFile.cxx.
| void ROOT::Internal::RMiniFileReader::ReadBuffer | ( | void * | buffer, |
| size_t | nbytes, | ||
| std::uint64_t | offset ) |
Reads a given byte range from the file into the provided memory buffer.
If nbytes > fMaxKeySize it will perform chunked read from multiple blobs, whose addresses are listed at the end of the first chunk.
| ROOT::RException | if the read fails. |
Definition at line 889 of file RMiniFile.cxx.
|
private |
Searches for a key with the given name and type in the key index of the directory starting at offsetDir.
Searches for a key with the given name and type in the key index of the given directory.
The offset points to the start of the TDirectory DATA section, without the key and without the name and title of the TFile record (the root directory). Return 0 if the key was not found. Otherwise returns the offset of found key.
Return 0 if the key was not found.
Definition at line 687 of file RMiniFile.cxx.
|
inline |
If the reader is not used to retrieve the anchor, we need to set the max key size manually.
Definition at line 104 of file RMiniFile.hxx.
| ROOT::RResult< void > ROOT::Internal::RMiniFileReader::TryReadBuffer | ( | void * | buffer, |
| size_t | nbytes, | ||
| std::uint64_t | offset ) |
Like ReadBuffer but returns a RResult instead of throwing.
Definition at line 894 of file RMiniFile.cxx.
Indicates whether the file is a TFile container or an RNTuple bare file.
Definition at line 65 of file RMiniFile.hxx.
|
private |
If fMaxKeySize > 0 and ReadBuffer attempts to read nbytes > maxKeySize, it will assume the blob being read is chunked and read all the chunks into the buffer.
This is symmetrical to what happens in RNTupleFileWriter::WriteBlob().
Definition at line 69 of file RMiniFile.hxx.
|
private |
The raw file used to read byte ranges.
Definition at line 63 of file RMiniFile.hxx.