xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 #pragma once
26 #include "XrdCl/XrdClDefaultEnv.hh"
28 
29 using namespace XrdCl;
30 
31 namespace xrdcl_proxy
32 {
33 //------------------------------------------------------------------------------
36 //------------------------------------------------------------------------------
38 {
39 public:
40  //----------------------------------------------------------------------------
42  //----------------------------------------------------------------------------
44 
45  //----------------------------------------------------------------------------
47  //----------------------------------------------------------------------------
48  virtual ~ProxyPrefixFile();
49 
50  //----------------------------------------------------------------------------
52  //----------------------------------------------------------------------------
53  virtual XRootDStatus Open(const std::string& url,
54  OpenFlags::Flags flags,
55  Access::Mode mode,
56  ResponseHandler* handler,
57  uint16_t timeout);
58 
59  //----------------------------------------------------------------------------
61  //----------------------------------------------------------------------------
63  uint16_t timeout)
64  {
65  return pFile->Close(handler, timeout);
66  }
67 
68  //----------------------------------------------------------------------------
70  //----------------------------------------------------------------------------
71  virtual XRootDStatus Stat(bool force,
72  ResponseHandler* handler,
73  uint16_t timeout)
74  {
75  return pFile->Stat(force, handler, timeout);
76  }
77 
78 
79  //----------------------------------------------------------------------------
81  //----------------------------------------------------------------------------
82  virtual XRootDStatus Read(uint64_t offset,
83  uint32_t size,
84  void* buffer,
85  ResponseHandler* handler,
86  uint16_t timeout)
87  {
88  return pFile->Read(offset, size, buffer, handler, timeout);
89  }
90 
91  //----------------------------------------------------------------------------
93  //----------------------------------------------------------------------------
94  virtual XRootDStatus Write(uint64_t offset,
95  uint32_t size,
96  const void* buffer,
97  ResponseHandler* handler,
98  uint16_t timeout)
99  {
100  return pFile->Write(offset, size, buffer, handler, timeout);
101  }
102 
103  //----------------------------------------------------------------------------
105  //----------------------------------------------------------------------------
107  uint16_t timeout)
108  {
109  return pFile->Sync(handler, timeout);
110  }
111 
112  //----------------------------------------------------------------------------
114  //----------------------------------------------------------------------------
115  virtual XRootDStatus Truncate(uint64_t size,
116  ResponseHandler* handler,
117  uint16_t timeout)
118  {
119  return pFile->Truncate(size, handler, timeout);
120  }
121 
122  //----------------------------------------------------------------------------
124  //----------------------------------------------------------------------------
125  virtual XRootDStatus VectorRead(const ChunkList& chunks,
126  void* buffer,
127  ResponseHandler* handler,
128  uint16_t timeout)
129  {
130  return pFile->VectorRead(chunks, buffer, handler, timeout);
131  }
132 
133  //----------------------------------------------------------------------------
135  //----------------------------------------------------------------------------
136  virtual XRootDStatus Fcntl(const Buffer& arg,
137  ResponseHandler* handler,
138  uint16_t timeout)
139  {
140  return pFile->Fcntl(arg, handler, timeout);
141  }
142 
143  //----------------------------------------------------------------------------
145  //----------------------------------------------------------------------------
147  uint16_t timeout)
148  {
149  return pFile->Visa(handler, timeout);
150  }
151 
152  //----------------------------------------------------------------------------
154  //----------------------------------------------------------------------------
155  virtual bool IsOpen() const
156  {
157  return pFile->IsOpen();
158  }
159 
160  //----------------------------------------------------------------------------
162  //----------------------------------------------------------------------------
163  virtual bool SetProperty(const std::string& name,
164  const std::string& value)
165  {
166  return pFile->SetProperty(name, value);
167  }
168 
169  //----------------------------------------------------------------------------
171  //----------------------------------------------------------------------------
172  virtual bool GetProperty(const std::string& name,
173  std::string& value) const
174  {
175  return pFile->GetProperty(name, value);
176  }
177 
178 private:
179 
180  //----------------------------------------------------------------------------
184  //----------------------------------------------------------------------------
185  inline std::string trim(const std::string& in) const;
186 
187  //----------------------------------------------------------------------------
191  //----------------------------------------------------------------------------
192  inline std::string GetPrefixUrl() const;
193 
194  //----------------------------------------------------------------------------
198  //----------------------------------------------------------------------------
199  std::list<std::string> GetExclDomains() const;
200 
201  //----------------------------------------------------------------------------
208  //----------------------------------------------------------------------------
209  std::string ConstructFinalUrl(const std::string& orig_url) const;
210 
211  //----------------------------------------------------------------------------
217  //----------------------------------------------------------------------------
218  std::string GetFqdn(const std::string& hostname) const;
219 
220  bool mIsOpen;
222 };
223 
224 } // namespace xrdcl_proxy
virtual bool SetProperty(const std::string &name, const std::string &value)
SetProperty.
Definition: ProxyPrefixFile.hh:163
virtual XRootDStatus Stat(bool force, ResponseHandler *handler, uint16_t timeout)
Stat.
Definition: ProxyPrefixFile.hh:71
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:1046
void trim(std::string &str)
virtual XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout)
Fcntl.
Definition: ProxyPrefixFile.hh:136
virtual bool IsOpen() const
IsOpen.
Definition: ProxyPrefixFile.hh:155
virtual XRootDStatus Visa(ResponseHandler *handler, uint16_t timeout)
Visa.
Definition: ProxyPrefixFile.hh:146
virtual XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout)
Write.
Definition: ProxyPrefixFile.hh:94
An interface for file plug-ins.
Definition: XrdClPlugInInterface.hh:38
A file.
Definition: XrdClFile.hh:45
virtual bool GetProperty(const std::string &name, std::string &value) const
GetProperty.
Definition: ProxyPrefixFile.hh:172
virtual XRootDStatus Close(ResponseHandler *handler, uint16_t timeout)
Close.
Definition: ProxyPrefixFile.hh:62
Request status.
Definition: XrdClXRootDResponses.hh:218
virtual XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout)
Truncate.
Definition: ProxyPrefixFile.hh:115
virtual XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout)
Sync.
Definition: ProxyPrefixFile.hh:106
virtual XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout)
VectorRead.
Definition: ProxyPrefixFile.hh:125
Handle an async response.
Definition: XrdClXRootDResponses.hh:1116
Mode
Access mode.
Definition: XrdClFileSystem.hh:121
Flags
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:75
OpenImpl< false > Open(Ctx< File > file, Arg< std::string > url, Arg< OpenFlags::Flags > flags, Arg< Access::Mode > mode=Access::None, uint16_t timeout=0)
Factory for creating ReadImpl objects.
Definition: XrdClFileOperations.hh:215
XrdCl::File * pFile
Definition: ProxyPrefixFile.hh:221
virtual XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout)
Read.
Definition: ProxyPrefixFile.hh:82
bool mIsOpen
Definition: ProxyPrefixFile.hh:220
Binary blob representation.
Definition: XrdClBuffer.hh:33
Definition: ProxyPrefixFile.hh:37