xrootd
XrdClFile.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@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 __XRD_CL_FILE_HH__
26 #define __XRD_CL_FILE_HH__
27 
28 #include "XrdCl/XrdClFileSystem.hh"
30 #include "XrdOuc/XrdOucCompiler.hh"
31 #include <stdint.h>
32 #include <string>
33 #include <vector>
34 #include <sys/uio.h>
35 
36 namespace XrdCl
37 {
38  class FileStateHandler;
39  class FilePlugIn;
40 
41  //----------------------------------------------------------------------------
43  //----------------------------------------------------------------------------
44  class File
45  {
46  public:
47 
49  {
52  };
53 
54  //------------------------------------------------------------------------
56  //------------------------------------------------------------------------
57  File( bool enablePlugIns = true );
58 
59  //------------------------------------------------------------------------
61  //------------------------------------------------------------------------
62  File( VirtRedirect virtRedirect, bool enablePlugIns = true );
63 
64  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  virtual ~File();
68 
69  //------------------------------------------------------------------------
79  //------------------------------------------------------------------------
80  XRootDStatus Open( const std::string &url,
81  OpenFlags::Flags flags,
82  Access::Mode mode,
83  ResponseHandler *handler,
84  uint16_t timeout = 0 )
85  XRD_WARN_UNUSED_RESULT;
86 
87  //------------------------------------------------------------------------
96  //------------------------------------------------------------------------
97  XRootDStatus Open( const std::string &url,
98  OpenFlags::Flags flags,
99  Access::Mode mode = Access::None,
100  uint16_t timeout = 0 )
101  XRD_WARN_UNUSED_RESULT;
102 
103  //------------------------------------------------------------------------
110  //------------------------------------------------------------------------
112  uint16_t timeout = 0 )
113  XRD_WARN_UNUSED_RESULT;
114 
115  //------------------------------------------------------------------------
121  //------------------------------------------------------------------------
122  XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
123 
124  //------------------------------------------------------------------------
134  //------------------------------------------------------------------------
135  XRootDStatus Stat( bool force,
136  ResponseHandler *handler,
137  uint16_t timeout = 0 )
138  XRD_WARN_UNUSED_RESULT;
139 
140  //------------------------------------------------------------------------
148  //------------------------------------------------------------------------
149  XRootDStatus Stat( bool force,
150  StatInfo *&response,
151  uint16_t timeout = 0 )
152  XRD_WARN_UNUSED_RESULT;
153 
154 
155  //------------------------------------------------------------------------
168  //------------------------------------------------------------------------
169  XRootDStatus Read( uint64_t offset,
170  uint32_t size,
171  void *buffer,
172  ResponseHandler *handler,
173  uint16_t timeout = 0 )
174  XRD_WARN_UNUSED_RESULT;
175 
176  //------------------------------------------------------------------------
186  //------------------------------------------------------------------------
187  XRootDStatus Read( uint64_t offset,
188  uint32_t size,
189  void *buffer,
190  uint32_t &bytesRead,
191  uint16_t timeout = 0 )
192  XRD_WARN_UNUSED_RESULT;
193 
194  //------------------------------------------------------------------------
207  //------------------------------------------------------------------------
208  XRootDStatus Write( uint64_t offset,
209  uint32_t size,
210  const void *buffer,
211  ResponseHandler *handler,
212  uint16_t timeout = 0 )
213  XRD_WARN_UNUSED_RESULT;
214 
215  //------------------------------------------------------------------------
228  //------------------------------------------------------------------------
229  XRootDStatus Write( uint64_t offset,
230  uint32_t size,
231  const void *buffer,
232  uint16_t timeout = 0 )
233  XRD_WARN_UNUSED_RESULT;
234 
235  //------------------------------------------------------------------------
242  //------------------------------------------------------------------------
244  uint16_t timeout = 0 )
245  XRD_WARN_UNUSED_RESULT;
246 
247 
248  //------------------------------------------------------------------------
254  //------------------------------------------------------------------------
255  XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
256 
257  //------------------------------------------------------------------------
265  //------------------------------------------------------------------------
266  XRootDStatus Truncate( uint64_t size,
267  ResponseHandler *handler,
268  uint16_t timeout = 0 )
269  XRD_WARN_UNUSED_RESULT;
270 
271 
272  //------------------------------------------------------------------------
279  //------------------------------------------------------------------------
280  XRootDStatus Truncate( uint64_t size,
281  uint16_t timeout = 0 )
282  XRD_WARN_UNUSED_RESULT;
283 
284  //------------------------------------------------------------------------
300  //------------------------------------------------------------------------
301  XRootDStatus VectorRead( const ChunkList &chunks,
302  void *buffer,
303  ResponseHandler *handler,
304  uint16_t timeout = 0 )
305  XRD_WARN_UNUSED_RESULT;
306 
307  //------------------------------------------------------------------------
323  //------------------------------------------------------------------------
324  XRootDStatus VectorRead( const ChunkList &chunks,
325  void *buffer,
326  VectorReadInfo *&vReadInfo,
327  uint16_t timeout = 0 )
328  XRD_WARN_UNUSED_RESULT;
329 
330  //------------------------------------------------------------------------
340  //------------------------------------------------------------------------
341  XRootDStatus WriteV( uint64_t offset,
342  const struct iovec *iov,
343  int iovcnt,
344  ResponseHandler *handler,
345  uint16_t timeout = 0 );
346 
347  //------------------------------------------------------------------------
357  //------------------------------------------------------------------------
358  XRootDStatus WriteV( uint64_t offset,
359  const struct iovec *iov,
360  int iovcnt,
361  uint16_t timeout = 0 );
362 
363  //------------------------------------------------------------------------
374  //------------------------------------------------------------------------
375  XRootDStatus Fcntl( const Buffer &arg,
376  ResponseHandler *handler,
377  uint16_t timeout = 0 )
378  XRD_WARN_UNUSED_RESULT;
379 
380  //------------------------------------------------------------------------
389  //------------------------------------------------------------------------
390  XRootDStatus Fcntl( const Buffer &arg,
391  Buffer *&response,
392  uint16_t timeout = 0 )
393  XRD_WARN_UNUSED_RESULT;
394 
395  //------------------------------------------------------------------------
404  //------------------------------------------------------------------------
406  uint16_t timeout = 0 )
407  XRD_WARN_UNUSED_RESULT;
408 
409  //------------------------------------------------------------------------
416  //------------------------------------------------------------------------
417  XRootDStatus Visa( Buffer *&visa,
418  uint16_t timeout = 0 )
419  XRD_WARN_UNUSED_RESULT;
420 
421  //------------------------------------------------------------------------
423  //------------------------------------------------------------------------
424  bool IsOpen() const;
425 
426  //------------------------------------------------------------------------
433  //------------------------------------------------------------------------
434  bool SetProperty( const std::string &name, const std::string &value );
435 
436  //------------------------------------------------------------------------
444  //------------------------------------------------------------------------
445  bool GetProperty( const std::string &name, std::string &value ) const;
446 
447  private:
448  FileStateHandler *pStateHandler;
449  FilePlugIn *pPlugIn;
451  };
452 }
453 
454 #endif // __XRD_CL_FILE_HH__
XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus WriteV(uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0)
VirtRedirect
Definition: XrdClFile.hh:48
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:763
Object stat info.
Definition: XrdClXRootDResponses.hh:332
XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool SetProperty(const std::string &name, const std::string &value)
virtual ~File()
Destructor.
Access mode.
Definition: XrdClFileSystem.hh:115
XRootDStatus Open(const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Visa(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
File(bool enablePlugIns=true)
Constructor.
FileStateHandler * pStateHandler
Definition: XrdClFile.hh:448
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:71
bool pEnablePlugIns
Definition: XrdClFile.hh:450
XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
A file.
Definition: XrdClFile.hh:44
XRootDStatus Close(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool IsOpen() const
Check if the file is open.
Request status.
Definition: XrdClXRootDResponses.hh:212
XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Vector read info.
Definition: XrdClXRootDResponses.hh:768
Handle an async response.
Definition: XrdClXRootDResponses.hh:833
XRootDStatus Stat(bool force, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool GetProperty(const std::string &name, std::string &value) const
Mode
Access mode.
Definition: XrdClFileSystem.hh:120
FilePlugIn * pPlugIn
Definition: XrdClFile.hh:449
Flags
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:76
Definition: XrdClFile.hh:50
Definition: XrdClFile.hh:51
XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Binary blob representation.
Definition: XrdClBuffer.hh:33