xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 )
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 )
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  //------------------------------------------------------------------------
338  //------------------------------------------------------------------------
339  XRootDStatus VectorWrite( const ChunkList &chunks,
340  ResponseHandler *handler,
341  uint16_t timeout = 0 )
342  XRD_WARN_UNUSED_RESULT;
343 
344  //------------------------------------------------------------------------
351  //------------------------------------------------------------------------
352  XRootDStatus VectorWrite( const ChunkList &chunks,
353  uint16_t timeout = 0 )
354  XRD_WARN_UNUSED_RESULT;
355 
356  //------------------------------------------------------------------------
366  //------------------------------------------------------------------------
367  XRootDStatus WriteV( uint64_t offset,
368  const struct iovec *iov,
369  int iovcnt,
370  ResponseHandler *handler,
371  uint16_t timeout = 0 );
372 
373  //------------------------------------------------------------------------
383  //------------------------------------------------------------------------
384  XRootDStatus WriteV( uint64_t offset,
385  const struct iovec *iov,
386  int iovcnt,
387  uint16_t timeout = 0 );
388 
389  //------------------------------------------------------------------------
400  //------------------------------------------------------------------------
401  XRootDStatus Fcntl( const Buffer &arg,
402  ResponseHandler *handler,
403  uint16_t timeout = 0 )
404  XRD_WARN_UNUSED_RESULT;
405 
406  //------------------------------------------------------------------------
415  //------------------------------------------------------------------------
416  XRootDStatus Fcntl( const Buffer &arg,
417  Buffer *&response,
418  uint16_t timeout = 0 )
419  XRD_WARN_UNUSED_RESULT;
420 
421  //------------------------------------------------------------------------
430  //------------------------------------------------------------------------
432  uint16_t timeout = 0 )
433  XRD_WARN_UNUSED_RESULT;
434 
435  //------------------------------------------------------------------------
442  //------------------------------------------------------------------------
443  XRootDStatus Visa( Buffer *&visa,
444  uint16_t timeout = 0 )
445  XRD_WARN_UNUSED_RESULT;
446 
447  //------------------------------------------------------------------------
449  //------------------------------------------------------------------------
450  bool IsOpen() const;
451 
452  //------------------------------------------------------------------------
459  //------------------------------------------------------------------------
460  bool SetProperty( const std::string &name, const std::string &value );
461 
462  //------------------------------------------------------------------------
470  //------------------------------------------------------------------------
471  bool GetProperty( const std::string &name, std::string &value ) const;
472 
473  private:
477  };
478 }
479 
480 #endif // __XRD_CL_FILE_HH__
Close operation (.
Definition: XrdClFileOperations.hh:308
VirtRedirect
Definition: XrdClFile.hh:48
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:769
VectorRead operation (.
Definition: XrdClFileOperations.hh:582
Object stat info.
Definition: XrdClXRootDResponses.hh:332
VectorWrite operation (.
Definition: XrdClFileOperations.hh:639
Fcntl operation (.
Definition: XrdClFileOperations.hh:752
bool SetProperty(const std::string &name, const std::string &value)
Visa operation (.
Definition: XrdClFileOperations.hh:806
virtual ~File()
Destructor.
Access mode.
Definition: XrdClFileSystem.hh:115
Read operation (.
Definition: XrdClFileOperations.hh:250
XRootDStatus Open(const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
File(bool enablePlugIns=true)
Constructor.
FileStateHandler * pStateHandler
Definition: XrdClFile.hh:474
#define XRD_WARN_UNUSED_RESULT
Definition: XrdOucCompiler.hh:31
WriteV operation (.
Definition: XrdClFileOperations.hh:694
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:71
bool pEnablePlugIns
Definition: XrdClFile.hh:476
An interface for file plug-ins.
Definition: XrdClPlugInInterface.hh:36
A file.
Definition: XrdClFile.hh:44
bool IsOpen() const
Check if the file is open.
Request status.
Definition: XrdClXRootDResponses.hh:212
Sync operation (.
Definition: XrdClFileOperations.hh:474
XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Vector read info.
Definition: XrdClXRootDResponses.hh:774
Handle an async response.
Definition: XrdClXRootDResponses.hh:839
Handle the stateful operations.
Definition: XrdClFileStateHandler.hh:47
Open operation (.
Definition: XrdClFileOperations.hh:104
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:475
Flags
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:76
Definition: XrdClFile.hh:50
Definition: XrdClFile.hh:51
Write operation (.
Definition: XrdClFileOperations.hh:416
Binary blob representation.
Definition: XrdClBuffer.hh:33