Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RRawFileCurl.hxx
Go to the documentation of this file.
1// @(#)root/net:$Id$
2// Author: Jakob Blomer
3
4/*************************************************************************
5 * Copyright (C) 1995-2025, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_RRawFileCurl
13#define ROOT_RRawFileCurl
14
15#include <ROOT/RRawFile.hxx>
16
17#include <memory>
18
19namespace ROOT {
20namespace Internal {
21
22class RCurlConnection;
23
24/// \class RRawFileCurl
25/// \ingroup net
26///
27/// The RRawFileCurl class reads HTTP(S) resources using the curl library. The passed URL of the file
28/// needs to start with http:// or https://. The URL does not need to be escaped; URL encoding is handled internally.
29class RRawFileCurl : public RRawFile {
30private:
31 std::unique_ptr<RCurlConnection> fConnection;
32
33protected:
34 void OpenImpl() final;
35 size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final;
36 void ReadVImpl(RIOVec *ioVec, unsigned int nReq) final;
37 std::uint64_t GetSizeImpl() final;
38
39public:
40 static constexpr int kDefaultBlockSize = 128 * 1024; // relatively large 128k blocks for better network utilization
41
42 RRawFileCurl(std::string_view url, RRawFile::ROptions options);
44 std::unique_ptr<RRawFile> Clone() const final;
45
47};
48
49} // namespace Internal
50} // namespace ROOT
51
52#endif
#define const
Definition Tailor.h:92
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)
Definition RRawFile.cxx:61
STL class.
STL class.
These are definitions of various free functions for the C-style compression routines in ROOT.
Definition TPython.h:26
Small utility to parse cmdline options.
Definition RExports.h:71
Used for vector reads from multiple offsets into multiple buffers.
Definition RRawFile.hxx:61
On construction, an ROptions parameter can customize the RRawFile behavior.
Definition RRawFile.hxx:49