xrootd
XrdTpcTPC.hh
Go to the documentation of this file.
1 
2 #include <memory>
3 #include <string>
4 #include <vector>
5 
7 
10 
11 class XrdOucErrInfo;
12 class XrdOucStream;
13 class XrdSfsFile;
15 typedef void CURL;
16 
17 namespace TPC {
18 class State;
19 
20 class TPCHandler : public XrdHttpExtHandler {
21 public:
22  TPCHandler(XrdSysError *log, const char *config, XrdOucEnv *myEnv);
23  virtual ~TPCHandler();
24 
25  virtual bool MatchesPath(const char *verb, const char *path);
26  virtual int ProcessReq(XrdHttpExtReq &req);
27  // Abstract method in the base class, but does not seem to be used
28  virtual int Init(const char *cfgfile) {return 0;}
29 
30 private:
32 
33  static std::string GetAuthz(XrdHttpExtReq &req);
34 
35  int RedirectTransfer(const std::string &redirect_resource, XrdHttpExtReq &req, XrdOucErrInfo &error);
36 
37  int OpenWaitStall(XrdSfsFile &fh, const std::string &resource, int mode,
38  int openMode, const XrdSecEntity &sec,
39  const std::string &authz);
40 
41 #ifdef XRD_CHUNK_RESP
42  int DetermineXferSize(CURL *curl, XrdHttpExtReq &req, TPC::State &state,
43  bool &success);
44 
45  int SendPerfMarker(XrdHttpExtReq &req, off_t bytes_transferred);
46 
47  // Perform the libcurl transfer, periodically sending back chunked updates.
48  int RunCurlWithUpdates(CURL *curl, XrdHttpExtReq &req, TPC::State &state,
49  const char *log_prefix);
50 
51  // Experimental multi-stream version of RunCurlWithUpdates
52  int RunCurlWithStreams(XrdHttpExtReq &req, TPC::State &state,
53  const char *log_prefix, size_t streams);
54  int RunCurlWithStreamsImpl(XrdHttpExtReq &req, TPC::State &state,
55  const char *log_prefix, size_t streams,
56  std::vector<TPC::State*> streams_handles);
57 #else
58  int RunCurlBasic(CURL *curl, XrdHttpExtReq &req, TPC::State &state,
59  const char *log_prefix);
60 #endif
61 
62  int ProcessPushReq(const std::string & resource, XrdHttpExtReq &req);
63  int ProcessPullReq(const std::string &resource, XrdHttpExtReq &req);
64 
65  bool ConfigureFSLib(XrdOucStream &Config, std::string &path1, bool &path1_alt,
66  std::string &path2, bool &path2_alt);
67  bool Configure(const char *configfn, XrdOucEnv *myEnv);
68 
69  static int m_marker_period;
70  static size_t m_block_size;
72  std::string m_cadir;
74  static uint64_t m_monid;
76  std::unique_ptr<XrdSfsFileSystem> m_sfs;
79 
80  // 16 blocks in flight at 16 MB each, meaning that there will be up to 256MB
81  // in flight; this is equal to the bandwidth delay product of a 200ms transcontinental
82  // connection at 10Gbps.
83 #ifdef USE_PIPELINING
84  static const int m_pipelining_multiplier = 16;
85 #else
86  static const int m_pipelining_multiplier = 1;
87 #endif
88 };
89 }
TPC
Definition: XrdTpcState.hh:15
TPC::TPCHandler::RedirectTransfer
int RedirectTransfer(const std::string &redirect_resource, XrdHttpExtReq &req, XrdOucErrInfo &error)
TPC::TPCHandler::m_log
XrdSysError & m_log
Definition: XrdTpcTPC.hh:75
TPC::TPCHandler::m_handle_base
void * m_handle_base
Definition: XrdTpcTPC.hh:77
XrdSysMutex
Definition: XrdSysPthread.hh:165
TPC::TPCHandler::ProcessReq
virtual int ProcessReq(XrdHttpExtReq &req)
XrdSysPthread.hh
XrdSfsFileSystem
Definition: XrdSfsInterface.hh:209
TPC::TPCHandler::m_desthttps
bool m_desthttps
Definition: XrdTpcTPC.hh:71
TPC::State
Definition: XrdTpcState.hh:18
XrdHttpExtHandler
Definition: XrdHttpExtHandler.hh:79
XrdSfsFile
Definition: XrdSfsInterface.hh:651
TPC::TPCHandler::ConfigureFSLib
bool ConfigureFSLib(XrdOucStream &Config, std::string &path1, bool &path1_alt, std::string &path2, bool &path2_alt)
TPC::TPCHandler::m_pipelining_multiplier
static const int m_pipelining_multiplier
Definition: XrdTpcTPC.hh:86
XrdOucStream
Definition: XrdOucStream.hh:45
TPC::TPCHandler::m_block_size
static size_t m_block_size
Definition: XrdTpcTPC.hh:70
TPC::TPCHandler::GetAuthz
static std::string GetAuthz(XrdHttpExtReq &req)
TPC::TPCHandler::OpenWaitStall
int OpenWaitStall(XrdSfsFile &fh, const std::string &resource, int mode, int openMode, const XrdSecEntity &sec, const std::string &authz)
TPC::TPCHandler::RunCurlBasic
int RunCurlBasic(CURL *curl, XrdHttpExtReq &req, TPC::State &state, const char *log_prefix)
TPC::TPCHandler::m_cadir
std::string m_cadir
Definition: XrdTpcTPC.hh:72
TPC::TPCHandler::Configure
bool Configure(const char *configfn, XrdOucEnv *myEnv)
TPC::TPCHandler::TPCHandler
TPCHandler(XrdSysError *log, const char *config, XrdOucEnv *myEnv)
TPC::TPCHandler::Init
virtual int Init(const char *cfgfile)
Initializes the external request handler.
Definition: XrdTpcTPC.hh:28
TPC::TPCHandler::MatchesPath
virtual bool MatchesPath(const char *verb, const char *path)
Tells if the incoming path is recognized as one of the paths that have to be processed.
XrdHttpExtHandler.hh
CURL
void CURL
Definition: XrdTpcState.hh:12
XrdOucEnv
Definition: XrdOucEnv.hh:41
XrdHttpUtils.hh
Utility functions for XrdHTTP.
XrdCms::Config
XrdCmsConfig Config
TPC::TPCHandler::m_marker_period
static int m_marker_period
Definition: XrdTpcTPC.hh:69
TPC::TPCHandler::m_monid
static uint64_t m_monid
Definition: XrdTpcTPC.hh:74
TPC::TPCHandler::ProcessPullReq
int ProcessPullReq(const std::string &resource, XrdHttpExtReq &req)
TPC::TPCHandler
Definition: XrdTpcTPC.hh:20
XrdSecEntity
Definition: XrdSecEntity.hh:51
TPC::TPCHandler::m_monid_mutex
static XrdSysMutex m_monid_mutex
Definition: XrdTpcTPC.hh:73
XrdOucErrInfo
Definition: XrdOucErrInfo.hh:99
TPC::TPCHandler::ProcessPushReq
int ProcessPushReq(const std::string &resource, XrdHttpExtReq &req)
TPC::TPCHandler::~TPCHandler
virtual ~TPCHandler()
XrdHttpExtReq
Definition: XrdHttpExtHandler.hh:45
TPC::TPCHandler::m_handle_chained
void * m_handle_chained
Definition: XrdTpcTPC.hh:78
XrdSysError
Definition: XrdSysError.hh:89
TPC::TPCHandler::ProcessOptionsReq
int ProcessOptionsReq(XrdHttpExtReq &req)
CURL
void CURL
Definition: XrdTpcTPC.hh:14
TPC::TPCHandler::m_sfs
std::unique_ptr< XrdSfsFileSystem > m_sfs
Definition: XrdTpcTPC.hh:76