19#include <XrdCl/XrdClFile.hh>
20#include <XrdCl/XrdClFileSystem.hh>
24constexpr int kDefaultBlockSize = 128 * 1024;
55 return std::make_unique<RRawFileNetXNG>( fUrl, fOptions );
60 XrdCl::StatInfo *info =
nullptr;
61 auto st = pImpl->file.Stat(
true, info );
63 throw std::runtime_error(
"Cannot determine size of '" + fUrl +
"', " +
64 st.ToString() +
"; " + st.GetErrorMessage() );
65 std::uint64_t ret = info->GetSize();
72 auto st = pImpl->file.Open( fUrl, XrdCl::OpenFlags::Read );
74 throw std::runtime_error(
"Cannot open '" + fUrl +
"', " +
75 st.ToString() +
"; " + st.GetErrorMessage() );
76 if( fOptions.fBlockSize < 0 ) fOptions.fBlockSize = kDefaultBlockSize;
81 std::uint32_t btsread = 0;
82 auto st = pImpl->file.Read(
offset, nbytes, buffer, btsread );
84 throw std::runtime_error(
"Cannot read from '" + fUrl +
"', " +
85 st.ToString() +
"; " + st.GetErrorMessage() );
91 XrdCl::ChunkList chunks;
92 chunks.reserve( nReq );
93 for( std::size_t i = 0; i < nReq; ++i )
96 XrdCl::VectorReadInfo *info =
nullptr;
97 auto st = pImpl->file.VectorRead( chunks,
nullptr, info );
99 throw std::runtime_error(
"Cannot do vector read from '" + fUrl +
"', " +
100 st.ToString() +
"; " + st.GetErrorMessage() );
102 XrdCl::ChunkList &rsp = info->GetChunks();
103 for( std::size_t i = 0; i < nReq; ++i )
104 ioVec[i].fOutBytes = rsp[i].
length;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
void OpenImpl() final
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.
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 impleme...
RRawFileNetXNG(std::string_view url, RRawFile::ROptions options)
std::unique_ptr< RRawFile > Clone() const final
Create a new RawFile that accesses the same resource. The file pointer is reset to zero.
size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final
Derived classes should implement low-level reading without buffering.
std::uint64_t GetSizeImpl() final
Derived classes should return the file size or kUnknownFileSize.
The RRawFile provides read-only access to local and remote files.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
RRawFileNetXNGImpl()=default
RRawFileNetXNGImpl & operator=(const RRawFileNetXNGImpl &)=delete
~RRawFileNetXNGImpl()=default
RRawFileNetXNGImpl(const RRawFileNetXNGImpl &)=delete
Used for vector reads from multiple offsets into multiple buffers.
std::size_t fSize
The number of desired bytes.
void * fBuffer
The destination for reading.
std::uint64_t fOffset
The file offset.
On construction, an ROptions parameter can customize the RRawFile behavior.