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>
30#include <XrdCl/XrdClURL.hh>
31
32#include <shared_mutex>
33#include <string>
34#include <unordered_map>
35#include <utility>
36#include <vector>
37
38namespace XrdCl {
39
40class Log;
41
42}
43
44namespace XrdClHttp {
45
46class HandlerQueue;
47
48class Filesystem final : public XrdCl::FileSystemPlugIn {
49public:
50 Filesystem(const std::string &, std::shared_ptr<HandlerQueue> queue, XrdCl::Log *log);
51
52 virtual ~Filesystem() noexcept;
53
54 XrdCl::XRootDStatus DirList(const std::string &path,
57 time_t timeout) override;
58
59 virtual bool GetProperty(const std::string &name,
60 std::string &value) const override;
61
62 virtual XrdCl::XRootDStatus Locate(const std::string &path,
65 time_t timeout) override;
66
67 virtual XrdCl::XRootDStatus MkDir(const std::string &path,
71 time_t timeout) override;
72
73 virtual XrdCl::XRootDStatus Rm(const std::string &path,
75 time_t timeout) override;
76
77 virtual XrdCl::XRootDStatus RmDir(const std::string &path,
79 time_t timeout) override;
80
81 virtual bool SetProperty(const std::string &name,
82 const std::string &value) override;
83
84 virtual XrdCl::XRootDStatus Stat(const std::string &path,
86 time_t timeout) override;
87
89 const XrdCl::Buffer &arg,
91 time_t timeout) override;
92
93private:
94 // Return a function pointer to the connection callout
95 // Returns nullptr if this file isn't using the callout
96 CreateConnCalloutType GetConnCallout() const;
97
98 // The "*Response" variant of the callback response objects defined in DirectorCacheResponse.hh
99 // are opt-in; if the caller isn't expecting them, then they will leak memory. This
100 // function determines whether the opt-in is enabled.
101 bool SendResponseInfo() const;
102
103 // Return the current computed URL to use for HTTP requests, provided the path
104 //
105 // Potentially the user-provided URL plus extra query parameters from the Filesystem properties.
106 std::string GetCurrentURL(const std::string &path) const;
107
108 // Protects the contents of m_properties
109 mutable std::shared_mutex m_properties_mutex;
110
111 std::shared_ptr<HandlerQueue> m_queue;
112 std::atomic<XrdClHttp::HeaderCallout *> m_header_callout{};
113 XrdCl::Log *m_logger{nullptr};
114 XrdCl::URL m_url;
115 std::unordered_map<std::string, std::string> m_properties;
116};
117
118}
119
120#endif // XRDCLHTTP_FILESYSTEM_HH
struct stat Stat
Definition XrdCks.cc:49
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
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 Locate(const std::string &path, XrdCl::OpenFlags::Flags flags, XrdCl::ResponseHandler *handler, time_t timeout) override
virtual ~Filesystem() noexcept
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 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.