XRootD
Loading...
Searching...
No Matches
ProxyPrefixFile.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2017 by European Organization for Nuclear Research (CERN)
3// Author: Elvin Sindrilaru <esindril@cern.ch>
4//------------------------------------------------------------------------------
5// This file is part of the XRootD software suite.
6//
7// XRootD is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Lesser General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// XRootD is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19//
20// In applying this licence, CERN does not waive the privileges and immunities
21// granted to it by virtue of its status as an Intergovernmental Organization
22// or submit itself to any jurisdiction.
23//------------------------------------------------------------------------------
24
25#ifndef SRC_XRDAPPS_PROXYPLUGIN_PROXYPREFIXFILE_HH_
26#define SRC_XRDAPPS_PROXYPLUGIN_PROXYPREFIXFILE_HH_
27
30
31#include <utility>
32
33using namespace XrdCl;
34
35namespace xrdcl_proxy
36{
37//------------------------------------------------------------------------------
40//------------------------------------------------------------------------------
42{
43public:
44 //----------------------------------------------------------------------------
46 //----------------------------------------------------------------------------
48
49 //----------------------------------------------------------------------------
51 //----------------------------------------------------------------------------
52 virtual ~ProxyPrefixFile() override;
53
54 //----------------------------------------------------------------------------
56 //----------------------------------------------------------------------------
57 virtual XRootDStatus Open(const std::string& url,
58 OpenFlags::Flags flags,
59 Access::Mode mode,
60 ResponseHandler* handler,
61 uint16_t timeout) override;
62
63 //----------------------------------------------------------------------------
65 //----------------------------------------------------------------------------
67 uint16_t timeout) override
68 {
69 return pFile->Close(handler, timeout);
70 }
71
72 //----------------------------------------------------------------------------
74 //----------------------------------------------------------------------------
75 virtual XRootDStatus Stat(bool force,
76 ResponseHandler* handler,
77 uint16_t timeout) override
78 {
79 return pFile->Stat(force, handler, timeout);
80 }
81
82
83 //----------------------------------------------------------------------------
85 //----------------------------------------------------------------------------
86 virtual XRootDStatus Read(uint64_t offset,
87 uint32_t size,
88 void* buffer,
89 ResponseHandler* handler,
90 uint16_t timeout) override
91 {
92 return pFile->Read(offset, size, buffer, handler, timeout);
93 }
94
95 //------------------------------------------------------------------------
97 //------------------------------------------------------------------------
98 virtual XRootDStatus PgRead( uint64_t offset,
99 uint32_t size,
100 void *buffer,
101 ResponseHandler *handler,
102 uint16_t timeout ) override
103 {
104 return pFile->PgRead(offset, size, buffer, handler, timeout);
105 }
106
107 //----------------------------------------------------------------------------
109 //----------------------------------------------------------------------------
110 virtual XRootDStatus Write(uint64_t offset,
111 uint32_t size,
112 const void* buffer,
113 ResponseHandler* handler,
114 uint16_t timeout) override
115 {
116 return pFile->Write(offset, size, buffer, handler, timeout);
117 }
118
119 //------------------------------------------------------------------------
121 //------------------------------------------------------------------------
122 virtual XRootDStatus Write( uint64_t offset,
123 Buffer &&buffer,
124 ResponseHandler *handler,
125 uint16_t timeout = 0 ) override
126 {
127 return pFile->Write(offset, std::move(buffer), handler, timeout);
128 }
129
130 //------------------------------------------------------------------------
132 //------------------------------------------------------------------------
133 virtual XRootDStatus Write( uint64_t offset,
134 uint32_t size,
135 Optional<uint64_t> fdoff,
136 int fd,
137 ResponseHandler *handler,
138 uint16_t timeout = 0 ) override
139 {
140 return pFile->Write(offset, size, fdoff, fd, handler, timeout);
141 }
142
143 //------------------------------------------------------------------------
145 //------------------------------------------------------------------------
146 virtual XRootDStatus PgWrite( uint64_t offset,
147 uint32_t nbpgs,
148 const void *buffer,
149 std::vector<uint32_t> &cksums,
150 ResponseHandler *handler,
151 uint16_t timeout ) override
152 {
153 return pFile->PgWrite(offset, nbpgs, buffer, cksums, handler, timeout);
154 }
155
156 //----------------------------------------------------------------------------
158 //----------------------------------------------------------------------------
160 uint16_t timeout) override
161 {
162 return pFile->Sync(handler, timeout);
163 }
164
165 //----------------------------------------------------------------------------
167 //----------------------------------------------------------------------------
168 virtual XRootDStatus Truncate(uint64_t size,
169 ResponseHandler* handler,
170 uint16_t timeout) override
171 {
172 return pFile->Truncate(size, handler, timeout);
173 }
174
175 //----------------------------------------------------------------------------
177 //----------------------------------------------------------------------------
178 virtual XRootDStatus VectorRead(const ChunkList& chunks,
179 void* buffer,
180 ResponseHandler* handler,
181 uint16_t timeout) override
182 {
183 return pFile->VectorRead(chunks, buffer, handler, timeout);
184 }
185
186 //------------------------------------------------------------------------
188 //------------------------------------------------------------------------
189 virtual XRootDStatus VectorWrite( const ChunkList &chunks,
190 ResponseHandler *handler,
191 uint16_t timeout = 0 ) override
192 {
193 return pFile->VectorWrite(chunks, handler, timeout);
194 }
195
196 //------------------------------------------------------------------------
198 //------------------------------------------------------------------------
199 virtual XRootDStatus WriteV( uint64_t offset,
200 const struct iovec *iov,
201 int iovcnt,
202 ResponseHandler *handler,
203 uint16_t timeout = 0 ) override
204 {
205 return pFile->WriteV(offset, iov, iovcnt, handler, timeout);
206 }
207
208 //----------------------------------------------------------------------------
210 //----------------------------------------------------------------------------
211 virtual XRootDStatus Fcntl(const Buffer& arg,
212 ResponseHandler* handler,
213 uint16_t timeout) override
214 {
215 return pFile->Fcntl(arg, handler, timeout);
216 }
217
218 //----------------------------------------------------------------------------
220 //----------------------------------------------------------------------------
222 uint16_t timeout) override
223 {
224 return pFile->Visa(handler, timeout);
225 }
226
227 //----------------------------------------------------------------------------
229 //----------------------------------------------------------------------------
230 virtual bool IsOpen() const override
231 {
232 return pFile->IsOpen();
233 }
234
235 //----------------------------------------------------------------------------
237 //----------------------------------------------------------------------------
238 virtual bool SetProperty(const std::string& name,
239 const std::string& value) override
240 {
241 return pFile->SetProperty(name, value);
242 }
243
244 //----------------------------------------------------------------------------
246 //----------------------------------------------------------------------------
247 virtual bool GetProperty(const std::string& name,
248 std::string& value) const override
249 {
250 return pFile->GetProperty(name, value);
251 }
252
253private:
254
255 //----------------------------------------------------------------------------
259 //----------------------------------------------------------------------------
260 inline std::string trim(const std::string& in) const;
261
262 //----------------------------------------------------------------------------
266 //----------------------------------------------------------------------------
267 inline std::string GetPrefixUrl() const;
268
269 //----------------------------------------------------------------------------
273 //----------------------------------------------------------------------------
274 std::list<std::string> GetExclDomains() const;
275
276 //----------------------------------------------------------------------------
283 //----------------------------------------------------------------------------
284 std::string ConstructFinalUrl(const std::string& orig_url) const;
285
286 //----------------------------------------------------------------------------
292 //----------------------------------------------------------------------------
293 std::string GetFqdn(const std::string& hostname) const;
294
295 bool mIsOpen;
296 XrdCl::File* pFile;
297};
298
299} // namespace xrdcl_proxy
300
301#endif
void trim(std::string &str)
Definition XrdHttpReq.cc:76
Binary blob representation.
An interface for file plug-ins.
A file.
Definition XrdClFile.hh:46
Handle an async response.
virtual XRootDStatus Open(const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout) override
Open.
virtual XRootDStatus Write(uint64_t offset, Buffer &&buffer, ResponseHandler *handler, uint16_t timeout=0) override
Write.
virtual XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout) override
Fcntl.
virtual XRootDStatus Close(ResponseHandler *handler, uint16_t timeout) override
Close.
virtual XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout) override
Truncate.
virtual XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout) override
VectorRead.
virtual XRootDStatus PgRead(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout) override
PgRead.
virtual bool SetProperty(const std::string &name, const std::string &value) override
SetProperty.
virtual XRootDStatus VectorWrite(const ChunkList &chunks, ResponseHandler *handler, uint16_t timeout=0) override
VectorWrite.
virtual XRootDStatus PgWrite(uint64_t offset, uint32_t nbpgs, const void *buffer, std::vector< uint32_t > &cksums, ResponseHandler *handler, uint16_t timeout) override
PgWrite.
virtual XRootDStatus Write(uint64_t offset, uint32_t size, Optional< uint64_t > fdoff, int fd, ResponseHandler *handler, uint16_t timeout=0) override
Write.
virtual XRootDStatus Stat(bool force, ResponseHandler *handler, uint16_t timeout) override
Stat.
virtual XRootDStatus Visa(ResponseHandler *handler, uint16_t timeout) override
Visa.
virtual XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout) override
Read.
virtual bool IsOpen() const override
IsOpen.
virtual bool GetProperty(const std::string &name, std::string &value) const override
GetProperty.
virtual XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout) override
Write.
virtual XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout) override
Sync.
virtual XRootDStatus WriteV(uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0) override
virtual ~ProxyPrefixFile() override
Destructor.
std::vector< ChunkInfo > ChunkList
List of chunks.
Response NullRef< Response >::value
Flags
Open flags, may be or'd when appropriate.