xrootd
XrdClLocalFileHandler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
3 // Author: Paul-Niklas Kramp <p.n.kramp@gsi.de>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 #ifndef __XRD_CL_LOCAL_FILE_HANDLER_HH__
19 #define __XRD_CL_LOCAL_FILE_HANDLER_HH__
20 #include "XrdCl/XrdClJobManager.hh"
22 #include "XrdCl/XrdClDefaultEnv.hh"
23 #include "XrdCl/XrdClLog.hh"
24 
25 #include <sys/uio.h>
26 
27 namespace XrdCl
28 {
29  class Message;
30  struct MessageSendParams;
31 
33  {
34  public:
35 
37 
39 
40  //------------------------------------------------------------------------
50  //------------------------------------------------------------------------
51  XRootDStatus Open( const std::string &url, uint16_t flags, uint16_t mode,
52  ResponseHandler *handler, uint16_t timeout = 0 );
53 
54  //------------------------------------------------------------------------
56  //------------------------------------------------------------------------
57  XRootDStatus Open( const URL *url, const Message *req, AnyObject *&resp );
58 
59  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  XRootDStatus Close( ResponseHandler *handler, uint16_t timeout = 0 );
68 
69  //------------------------------------------------------------------------
78  //------------------------------------------------------------------------
79  XRootDStatus Stat( ResponseHandler *handler, uint16_t timeout = 0 );
80 
81  //------------------------------------------------------------------------
96  //------------------------------------------------------------------------
97  XRootDStatus Read( uint64_t offset, uint32_t size, void *buffer,
98  ResponseHandler *handler, uint16_t timeout = 0 );
99 
100  //------------------------------------------------------------------------
110  //------------------------------------------------------------------------
111  XRootDStatus ReadV( uint64_t offset,
112  struct iovec *iov,
113  int iovcnt,
114  ResponseHandler *handler,
115  uint16_t timeout = 0 );
116 
117  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
128  XRootDStatus Write( uint64_t offset, uint32_t size, const void *buffer,
129  ResponseHandler *handler, uint16_t timeout = 0 );
130 
131  //------------------------------------------------------------------------
138  //------------------------------------------------------------------------
139  XRootDStatus Sync( ResponseHandler *handler, uint16_t timeout = 0 );
140 
141  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  XRootDStatus Truncate( uint64_t size, ResponseHandler *handler,
151  uint16_t timeout = 0 );
152 
153  //------------------------------------------------------------------------
162  //------------------------------------------------------------------------
163  XRootDStatus VectorRead( const ChunkList &chunks, void *buffer,
164  ResponseHandler *handler, uint16_t timeout = 0 );
165 
166  //------------------------------------------------------------------------
174  //------------------------------------------------------------------------
175  XRootDStatus VectorWrite( const ChunkList &chunks,
176  ResponseHandler *handler, uint16_t timeout = 0 );
177 
178  //------------------------------------------------------------------------
188  //------------------------------------------------------------------------
189  XRootDStatus WriteV( uint64_t offset,
190  ChunkList *chunks,
191  ResponseHandler *handler,
192  uint16_t timeout = 0 );
193 
194  //------------------------------------------------------------------------
201  //------------------------------------------------------------------------
203  ResponseHandler *handler );
204 
205  //------------------------------------------------------------------------
215  //------------------------------------------------------------------------
216  XRootDStatus Fcntl( const Buffer &arg, ResponseHandler *handler,
217  uint16_t timeout = 0 );
218 
219  //------------------------------------------------------------------------
228  //------------------------------------------------------------------------
229  XRootDStatus Visa( ResponseHandler *handler, uint16_t timeout = 0 );
230 
231 
232  //------------------------------------------------------------------------
243  //------------------------------------------------------------------------
244  XRootDStatus SetXAttr( const std::vector<xattr_t> &attrs,
245  ResponseHandler *handler,
246  uint16_t timeout = 0 );
247 
248  //------------------------------------------------------------------------
259  //------------------------------------------------------------------------
260  XRootDStatus GetXAttr( const std::vector<std::string> &attrs,
261  ResponseHandler *handler,
262  uint16_t timeout = 0 );
263 
264  //------------------------------------------------------------------------
275  //------------------------------------------------------------------------
276  XRootDStatus DelXAttr( const std::vector<std::string> &attrs,
277  ResponseHandler *handler,
278  uint16_t timeout = 0 );
279 
280  //------------------------------------------------------------------------
290  //------------------------------------------------------------------------
292  uint16_t timeout = 0 );
293 
294  //------------------------------------------------------------------------
300  //------------------------------------------------------------------------
301  static XRootDStatus MkdirPath( const std::string &path );
302 
303  void SetHostList( const HostList &hostList )
304  {
305  pHostList = hostList;
306  }
307 
309  {
310  return pHostList;
311  }
312 
313  //------------------------------------------------------------------------
315  //------------------------------------------------------------------------
316  XRootDStatus ExecRequest( const URL &url,
317  Message *msg,
318  ResponseHandler *handler,
319  MessageSendParams &sendParams );
320 
321  private:
322 
323  XRootDStatus OpenImpl( const std::string &url, uint16_t flags,
324  uint16_t mode, AnyObject *&resp );
325 
326  //------------------------------------------------------------------------
328  //------------------------------------------------------------------------
330  kXR_char numattr,
331  size_t bodylen,
332  char *body,
333  ResponseHandler *handler );
334 
335  //---------------------------------------------------------------------
336  // Receives LocalFileTasks to handle them async
337  //---------------------------------------------------------------------
339 
340  //---------------------------------------------------------------------
341  // Internal filedescriptor, which is used by all operations after open
342  //---------------------------------------------------------------------
343  int fd;
344 
345  //---------------------------------------------------------------------
346  // The file URL
347  //---------------------------------------------------------------------
348  std::string pUrl;
349 
350  //---------------------------------------------------------------------
351  // The host list returned in the user callback
352  //---------------------------------------------------------------------
354 
355  };
356 }
357 #endif
unsigned char kXR_char
Definition: XPtypes.hh:65
A synchronized queue.
Definition: XrdClJobManager.hh:50
Definition: XrdClAnyObject.hh:32
XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
Definition: XrdClMessageUtils.hh:131
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:970
int fd
Definition: XrdClLocalFileHandler.hh:343
The message representation used throughout the system.
Definition: XrdClMessage.hh:29
XRootDStatus Stat(ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus VectorWrite(const ChunkList &chunks, ResponseHandler *handler, uint16_t timeout=0)
void SetHostList(const HostList &hostList)
Definition: XrdClLocalFileHandler.hh:303
HostList pHostList
Definition: XrdClLocalFileHandler.hh:353
XRootDStatus ReadV(uint64_t offset, struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus GetXAttr(const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus MkdirPath(const std::string &path)
XRootDStatus DelXAttr(const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus SetXAttr(const std::vector< xattr_t > &attrs, ResponseHandler *handler, uint16_t timeout=0)
JobManager * jmngr
Definition: XrdClLocalFileHandler.hh:338
std::string pUrl
Definition: XrdClLocalFileHandler.hh:348
XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus XAttrImpl(kXR_char code, kXR_char numattr, size_t bodylen, char *body, ResponseHandler *handler)
Parses kXR_fattr request and calls respective XAttr operation.
Definition: XrdOucIOVec.hh:65
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1035
XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Open(const std::string &url, uint16_t flags, uint16_t mode, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Close(ResponseHandler *handler, uint16_t timeout=0)
Request status.
Definition: XrdClXRootDResponses.hh:218
Definition: XrdClAnyObject.hh:25
XRootDStatus QueueTask(XRootDStatus *st, AnyObject *obj, ResponseHandler *handler)
XRootDStatus ListXAttr(ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout=0)
const HostList & GetHostList()
Definition: XrdClLocalFileHandler.hh:308
XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
Handle an async response.
Definition: XrdClXRootDResponses.hh:1040
Definition: XrdClLocalFileHandler.hh:32
URL representation.
Definition: XrdClURL.hh:30
XRootDStatus OpenImpl(const std::string &url, uint16_t flags, uint16_t mode, AnyObject *&resp)
XRootDStatus ExecRequest(const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams)
Translate an XRootD request into LocalFileHandler call.
XRootDStatus WriteV(uint64_t offset, ChunkList *chunks, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Visa(ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0)
Binary blob representation.
Definition: XrdClBuffer.hh:33