XRootD
Loading...
Searching...
No Matches
XrdClHttpFilesystem.hh
Go to the documentation of this file.
1/******************************************************************************/
2/* Copyright (C) 2025, Pelican Project, Morgridge Institute for Research */
3/* */
4/* This file is part of the XrdClHttp client plugin for XRootD. */
5/* */
6/* XRootD is free software: you can redistribute it and/or modify it under */
7/* the terms of the GNU Lesser General Public License as published by the */
8/* Free Software Foundation, either version 3 of the License, or (at your */
9/* option) any later version. */
10/* */
11/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
12/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
13/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
14/* License for more details. */
15/* */
16/* The copyright holder's institutional names and contributor's names may not */
17/* be used to endorse or promote products derived from this software without */
18/* specific prior written permission of the institution or contributor. */
19/******************************************************************************/
20
21#ifndef XRDCLHTTP_FILESYSTEM_HH
22#define XRDCLHTTP_FILESYSTEM_HH
23
26
28#include <XrdCl/XrdClLog.hh>
31#include <XrdCl/XrdClURL.hh>
32
33#include <shared_mutex>
34#include <string>
35#include <unordered_map>
36#include <utility>
37#include <vector>
38
39namespace XrdCl {
40
41class Log;
42
43class PropertyList;
44
45}
46
47namespace XrdClHttp {
48
49class HandlerQueue;
50class CurlOperation;
51
54public:
55 Filesystem(const std::string &, std::shared_ptr<HandlerQueue> queue, XrdCl::Log *log);
56
57 virtual ~Filesystem() noexcept;
58
59 XrdCl::XRootDStatus DirList(const std::string &path,
62 time_t timeout) override;
63
64 virtual bool GetProperty(const std::string &name,
65 std::string &value) const override;
66
67 virtual XrdCl::XRootDStatus Locate(const std::string &path,
70 time_t timeout) override;
71
72 virtual XrdCl::XRootDStatus MkDir(const std::string &path,
76 time_t timeout) override;
77
79 const std::vector<std::string> &fileList,
81 uint8_t priority,
83 time_t timeout) override;
84
85 virtual XrdCl::XRootDStatus Rm(const std::string &path,
87 time_t timeout) override;
88
89 virtual XrdCl::XRootDStatus RmDir(const std::string &path,
91 time_t timeout) override;
92
93 virtual bool SetProperty(const std::string &name,
94 const std::string &value) override;
95
96 virtual XrdCl::XRootDStatus Stat(const std::string &path,
98 time_t timeout) override;
99
101 const XrdCl::Buffer &arg,
102 XrdCl::ResponseHandler *handler,
103 time_t timeout) override;
104
105 virtual XrdCl::XRootDStatus ThirdPartyCopy( const std::string &source,
106 const std::string &dest,
107 const XrdCl::PropertyList *properties,
108 XrdCl::ProgressHandler *progress_handler,
109 time_t timeout = 0 ) override;
110
111private:
112 XrdCl::XRootDStatus QueueOperation(
113 std::unique_ptr<CurlOperation> operation,
114 const char *description);
115
116 // Return a function pointer to the connection callout
117 // Returns nullptr if this file isn't using the callout
118 CreateConnCalloutType GetConnCallout() const;
119
120 // The "*Response" variant of the callback response objects defined in DirectorCacheResponse.hh
121 // are opt-in; if the caller isn't expecting them, then they will leak memory. This
122 // function determines whether the opt-in is enabled.
123 bool SendResponseInfo() const;
124
125 // Return the current computed URL to use for HTTP requests, provided the path
126 //
127 // Potentially the user-provided URL plus extra query parameters from the Filesystem properties.
128 std::string GetCurrentURL(const std::string &path) const;
129
130 // Protects the contents of m_properties
131 mutable std::shared_mutex m_properties_mutex;
132
133 std::shared_ptr<HandlerQueue> m_queue;
134 std::atomic<XrdClHttp::HeaderCallout *> m_header_callout{};
135 XrdCl::Log *m_logger{nullptr};
136 XrdCl::URL m_url;
137 std::unordered_map<std::string, std::string> m_properties;
138};
139
140}
141
142#endif // XRDCLHTTP_FILESYSTEM_HH
virtual XrdCl::XRootDStatus MkDir(const std::string &path, XrdCl::MkDirFlags::Flags flags, XrdCl::Access::Mode mode, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual bool SetProperty(const std::string &name, const std::string &value) override
virtual XrdCl::XRootDStatus Prepare(const std::vector< std::string > &fileList, XrdCl::PrepareFlags::Flags flags, uint8_t priority, XrdCl::ResponseHandler *handler, time_t timeout) override
XrdCl::XRootDStatus DirList(const std::string &path, XrdCl::DirListFlags::Flags flags, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual XrdCl::XRootDStatus Rm(const std::string &path, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual XrdCl::XRootDStatus Stat(const std::string &path, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual XrdCl::XRootDStatus ThirdPartyCopy(const std::string &source, const std::string &dest, const XrdCl::PropertyList *properties, XrdCl::ProgressHandler *progress_handler, time_t timeout=0) override
virtual XrdCl::XRootDStatus Locate(const std::string &path, XrdCl::OpenFlags::Flags flags, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual XrdCl::XRootDStatus RmDir(const std::string &path, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual bool GetProperty(const std::string &name, std::string &value) const override
virtual XrdCl::XRootDStatus Query(XrdCl::QueryCode::Code queryCode, const XrdCl::Buffer &arg, XrdCl::ResponseHandler *handler, time_t timeout) override
Filesystem(const std::string &, std::shared_ptr< HandlerQueue > queue, XrdCl::Log *log)
Binary blob representation.
An interface for file plug-ins.
Handle diagnostics.
Definition XrdClLog.hh:101
Handle the progress of an asynchronous operation.
A key-value pair map storing both keys and values as strings.
Handle an async response.
URL representation.
Definition XrdClURL.hh:31
ConnectionCallout *(*)(const std::string &, const ResponseInfo &) CreateConnCalloutType
Flags
Open flags, may be or'd when appropriate.
Code
XRootD query request codes.