23 if (
fOptions.fBlockSize == ROptions::kUseDefaultBlockSize)
39 range.fDestination =
reinterpret_cast<unsigned char *
>(buffer);
40 range.fOffset = offset;
41 range.fLength = nbytes;
42 auto status =
fConnection->SendRangesReq(1, &range);
45 return range.fNBytesRecv;
53 std::vector<RCurlConnection::RUserRange> ranges;
56 for (
unsigned int i = 0; i < nReq; ++i) {
58 range.fDestination =
reinterpret_cast<unsigned char *
>(ioVec[i].
fBuffer);
59 range.fOffset = ioVec[i].
fOffset;
60 range.fLength = ioVec[i].
fSize;
61 ranges.emplace_back(range);
64 auto status =
fConnection->SendRangesReq(ranges.size(), &ranges[0]);
68 for (
unsigned int i = 0; i < nReq; ++i) {
69 ioVec[i].
fOutBytes = ranges[i].fNBytesRecv;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Encapsulates a curl easy handle and provides an interface to send HTTP HEAD and (multi-)range queries...
std::unique_ptr< RCurlConnection > fConnection
static constexpr int kDefaultBlockSize
std::uint64_t GetSizeImpl() final
Derived classes should return the file size.
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 impleme...
void OpenImpl() final
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.
RCurlConnection & GetConnection()
RRawFileCurl(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.
RRawFile(std::string_view url, ROptions options)
void EnsureOpen()
Open the file if not already open. Otherwise noop.
std::string GetUrl() const
Returns the url of the file.
Base class for all ROOT issued exceptions.
Caller-provided byte-range of the remote resource together with a pointer to a buffer.
Used for vector reads from multiple offsets into multiple buffers.
std::size_t fOutBytes
The number of actually read bytes, set by ReadV().
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.