Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Internal::RMiniFileReader Class Reference

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 58 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< RNTupleGetNTuple (std::string_view ntupleName)
 Extracts header and footer location for the RNTuple identified by ntupleName.
 
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.
 

Private Member Functions

RResult< RNTupleGetNTupleBare (std::string_view ntupleName)
 Used when the file container turns out to be a bare file.
 
RResult< RNTupleGetNTupleProper (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::RRawFilefRawFile = nullptr
 The raw file used to read byte ranges.
 

#include <ROOT/RMiniFile.hxx>

Constructor & Destructor Documentation

◆ RMiniFileReader() [1/2]

ROOT::Experimental::Internal::RMiniFileReader::RMiniFileReader ( )
default

◆ RMiniFileReader() [2/2]

ROOT::Experimental::Internal::RMiniFileReader::RMiniFileReader ( ROOT::Internal::RRawFile rawFile)
explicit

Uses the given raw file to read byte ranges.

Definition at line 661 of file RMiniFile.cxx.

Member Function Documentation

◆ GetMaxKeySize()

std::uint64_t ROOT::Experimental::Internal::RMiniFileReader::GetMaxKeySize ( ) const
inline

Definition at line 92 of file RMiniFile.hxx.

◆ GetNTuple()

ROOT::RResult< ROOT::RNTuple > ROOT::Experimental::Internal::RMiniFileReader::GetNTuple ( std::string_view  ntupleName)

Extracts header and footer location for the RNTuple identified by ntupleName.

Definition at line 663 of file RMiniFile.cxx.

◆ GetNTupleBare()

ROOT::RResult< ROOT::RNTuple > ROOT::Experimental::Internal::RMiniFileReader::GetNTupleBare ( std::string_view  ntupleName)
private

Used when the file container turns out to be a bare file.

Definition at line 793 of file RMiniFile.cxx.

◆ GetNTupleProper()

ROOT::RResult< ROOT::RNTuple > ROOT::Experimental::Internal::RMiniFileReader::GetNTupleProper ( std::string_view  ntuplePath)
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 715 of file RMiniFile.cxx.

◆ ReadBuffer()

void ROOT::Experimental::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.

Definition at line 821 of file RMiniFile.cxx.

◆ SearchInDirectory()

std::uint64_t ROOT::Experimental::Internal::RMiniFileReader::SearchInDirectory ( std::uint64_t &  offsetDir,
std::string_view  keyName,
std::string_view  typeName 
)
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 675 of file RMiniFile.cxx.

◆ SetMaxKeySize()

void ROOT::Experimental::Internal::RMiniFileReader::SetMaxKeySize ( std::uint64_t  maxKeySize)
inline

If the reader is not used to retrieve the anchor, we need to set the max key size manually.

Definition at line 94 of file RMiniFile.hxx.

Member Data Documentation

◆ fIsBare

bool ROOT::Experimental::Internal::RMiniFileReader::fIsBare = false
private

Indicates whether the file is a TFile container or an RNTuple bare file.

Definition at line 63 of file RMiniFile.hxx.

◆ fMaxKeySize

std::uint64_t ROOT::Experimental::Internal::RMiniFileReader::fMaxKeySize = 0
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 67 of file RMiniFile.hxx.

◆ fRawFile

ROOT::Internal::RRawFile* ROOT::Experimental::Internal::RMiniFileReader::fRawFile = nullptr
private

The raw file used to read byte ranges.

Definition at line 61 of file RMiniFile.hxx.

Libraries for ROOT::Experimental::Internal::RMiniFileReader:

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