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

The RRawFileNetXNG class provides read-only access to remote files using root/roots protocol.

It uses the XrdCl (XRootD client) library for the transport layer. It instructs the RRawFile base class to buffer in larger chunks than the default for local files, assuming that remote file access has high(er) latency.

Definition at line 32 of file RRawFileNetXNG.hxx.

Public Member Functions

 RRawFileNetXNG (std::string_view url, RRawFile::ROptions options)
 
 ~RRawFileNetXNG ()
 
std::unique_ptr< RRawFileClone () const final
 Create a new RawFile that accesses the same resource. The file pointer is reset to zero.
 
RIOVecLimits GetReadVLimits () final
 Returns the limits regarding the ioVec input to ReadV for this specific file; may open the file as a side-effect.
 
- Public Member Functions inherited from ROOT::Internal::RRawFile
 RRawFile (const RRawFile &)=delete
 
 RRawFile (std::string_view url, ROptions options)
 
virtual ~RRawFile ()=default
 
std::uint64_t GetFilePos () const
 Returns the offset for the next Read/Readln call.
 
std::uint64_t GetSize ()
 Returns the size of the file.
 
std::string GetUrl () const
 Returns the url of the file.
 
bool IsBuffering () const
 
bool IsOpen () const
 Once opened, the file stay open until destruction of the RRawFile object.
 
RRawFileoperator= (const RRawFile &)=delete
 
size_t Read (void *buffer, size_t nbytes)
 Read from fFilePos offset. Returns the actual number of bytes read.
 
size_t ReadAt (void *buffer, size_t nbytes, std::uint64_t offset)
 Buffered read from a random position.
 
bool Readln (std::string &line)
 Read the next line starting from the current value of fFilePos. Returns false if the end of the file is reached.
 
void ReadV (RIOVec *ioVec, unsigned int nReq)
 Opens the file if necessary and calls ReadVImpl.
 
void Seek (std::uint64_t offset)
 Change the cursor fFilePos.
 
void SetBuffering (bool value)
 Turn off buffered reads; all scalar read requests go directly to the implementation.
 

Protected Member Functions

std::uint64_t GetSizeImpl () final
 Derived classes should return the file size.
 
void OpenImpl () final
 OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.
 
size_t ReadAtImpl (void *buffer, size_t nbytes, std::uint64_t offset) final
 Derived classes should implement low-level reading without buffering.
 
void ReadVImpl (RIOVec *ioVec, unsigned int nReq) final
 By default implemented as a loop of ReadAt calls but can be overwritten, e.g. XRootD or DAVIX implementations.
 
- Protected Member Functions inherited from ROOT::Internal::RRawFile
void EnsureOpen ()
 Open the file if not already open. Otherwise noop.
 

Private Attributes

std::optional< RIOVecLimitsfIOVecLimits
 Set by GetReadVLimits and then cached.
 
std::unique_ptr< RRawFileNetXNGImplpImpl
 pointer to implementation
 

Additional Inherited Members

- Public Types inherited from ROOT::Internal::RRawFile
enum class  ELineBreaks { kAuto , kSystem , kUnix , kWindows }
 kAuto detects the line break from the first line, kSystem picks the system's default More...
 
- Static Public Member Functions inherited from ROOT::Internal::RRawFile
static std::unique_ptr< RRawFileCreate (std::string_view url, ROptions options=ROptions())
 Factory method that returns a suitable concrete implementation according to the transport in the url.
 
static std::string GetLocation (std::string_view url)
 Returns only the file location, e.g. "server/file" for http://server/file.
 
static std::string GetTransport (std::string_view url)
 Returns only the transport protocol in lower case, e.g. "http" for HTTP://server/file.
 
- Protected Attributes inherited from ROOT::Internal::RRawFile
std::uint64_t fFilePos = 0
 The current position in the file, which can be changed by Seek, Read, and Readln.
 
ROptions fOptions
 
std::string fUrl
 

#include <ROOT/RRawFileNetXNG.hxx>

Inheritance diagram for ROOT::Internal::RRawFileNetXNG:
[legend]

Constructor & Destructor Documentation

◆ RRawFileNetXNG()

ROOT::Internal::RRawFileNetXNG::RRawFileNetXNG ( std::string_view  url,
RRawFile::ROptions  options 
)

Definition at line 47 of file RRawFileNetXNG.cxx.

◆ ~RRawFileNetXNG()

ROOT::Internal::RRawFileNetXNG::~RRawFileNetXNG ( )

Definition at line 53 of file RRawFileNetXNG.cxx.

Member Function Documentation

◆ Clone()

std::unique_ptr< ROOT::Internal::RRawFile > ROOT::Internal::RRawFileNetXNG::Clone ( ) const
finalvirtual

Create a new RawFile that accesses the same resource. The file pointer is reset to zero.

Implements ROOT::Internal::RRawFile.

Definition at line 57 of file RRawFileNetXNG.cxx.

◆ GetReadVLimits()

ROOT::Internal::RRawFile::RIOVecLimits ROOT::Internal::RRawFileNetXNG::GetReadVLimits ( )
finalvirtual

Returns the limits regarding the ioVec input to ReadV for this specific file; may open the file as a side-effect.

Reimplemented from ROOT::Internal::RRawFile.

Definition at line 113 of file RRawFileNetXNG.cxx.

◆ GetSizeImpl()

std::uint64_t ROOT::Internal::RRawFileNetXNG::GetSizeImpl ( )
finalprotectedvirtual

Derived classes should return the file size.

Implements ROOT::Internal::RRawFile.

Definition at line 62 of file RRawFileNetXNG.cxx.

◆ OpenImpl()

void ROOT::Internal::RRawFileNetXNG::OpenImpl ( )
finalprotectedvirtual

OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.

If fOptions.fBlocksize is negative, derived classes are responsible to set a sensible value. After a call to OpenImpl(), fOptions.fBlocksize must be larger or equal to zero.

Implements ROOT::Internal::RRawFile.

Definition at line 74 of file RRawFileNetXNG.cxx.

◆ ReadAtImpl()

size_t ROOT::Internal::RRawFileNetXNG::ReadAtImpl ( void *  buffer,
size_t  nbytes,
std::uint64_t  offset 
)
finalprotectedvirtual

Derived classes should implement low-level reading without buffering.

Short reads indicate the end of the file, therefore derived classes should return nbytes bytes if available.

Implements ROOT::Internal::RRawFile.

Definition at line 84 of file RRawFileNetXNG.cxx.

◆ ReadVImpl()

void ROOT::Internal::RRawFileNetXNG::ReadVImpl ( RIOVec ioVec,
unsigned int  nReq 
)
finalprotectedvirtual

By default implemented as a loop of ReadAt calls but can be overwritten, e.g. XRootD or DAVIX implementations.

Reimplemented from ROOT::Internal::RRawFile.

Definition at line 94 of file RRawFileNetXNG.cxx.

Member Data Documentation

◆ fIOVecLimits

std::optional<RIOVecLimits> ROOT::Internal::RRawFileNetXNG::fIOVecLimits
private

Set by GetReadVLimits and then cached.

Definition at line 36 of file RRawFileNetXNG.hxx.

◆ pImpl

std::unique_ptr<RRawFileNetXNGImpl> ROOT::Internal::RRawFileNetXNG::pImpl
private

pointer to implementation

Definition at line 35 of file RRawFileNetXNG.hxx.

Libraries for ROOT::Internal::RRawFileNetXNG:

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