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 <stdint.h>
31 #include <string>
32 #include <vector>
33 
34 namespace XrdCl
35 {
36  class FileStateHandler;
37  class FilePlugIn;
38 
39  //----------------------------------------------------------------------------
41  //----------------------------------------------------------------------------
42  class File
43  {
44  public:
45  //------------------------------------------------------------------------
47  //------------------------------------------------------------------------
48  File( bool enablePlugIns = true );
49 
50  //------------------------------------------------------------------------
52  //------------------------------------------------------------------------
53  virtual ~File();
54 
55  //------------------------------------------------------------------------
65  //------------------------------------------------------------------------
66  XRootDStatus Open( const std::string &url,
67  OpenFlags::Flags flags,
68  Access::Mode mode,
69  ResponseHandler *handler,
70  uint16_t timeout = 0 );
71 
72  //------------------------------------------------------------------------
81  //------------------------------------------------------------------------
82  XRootDStatus Open( const std::string &url,
83  OpenFlags::Flags flags,
85  uint16_t timeout = 0 );
86 
87  //------------------------------------------------------------------------
94  //------------------------------------------------------------------------
96  uint16_t timeout = 0 );
97 
98  //------------------------------------------------------------------------
104  //------------------------------------------------------------------------
105  XRootDStatus Close( uint16_t timeout = 0 );
106 
107  //------------------------------------------------------------------------
117  //------------------------------------------------------------------------
118  XRootDStatus Stat( bool force,
119  ResponseHandler *handler,
120  uint16_t timeout = 0 );
121 
122  //------------------------------------------------------------------------
130  //------------------------------------------------------------------------
131  XRootDStatus Stat( bool force,
132  StatInfo *&response,
133  uint16_t timeout = 0 );
134 
135 
136  //------------------------------------------------------------------------
149  //------------------------------------------------------------------------
150  XRootDStatus Read( uint64_t offset,
151  uint32_t size,
152  void *buffer,
153  ResponseHandler *handler,
154  uint16_t timeout = 0 );
155 
156  //------------------------------------------------------------------------
166  //------------------------------------------------------------------------
167  XRootDStatus Read( uint64_t offset,
168  uint32_t size,
169  void *buffer,
170  uint32_t &bytesRead,
171  uint16_t timeout = 0 );
172 
173  //------------------------------------------------------------------------
186  //------------------------------------------------------------------------
187  XRootDStatus Write( uint64_t offset,
188  uint32_t size,
189  const void *buffer,
190  ResponseHandler *handler,
191  uint16_t timeout = 0 );
192 
193  //------------------------------------------------------------------------
206  //------------------------------------------------------------------------
207  XRootDStatus Write( uint64_t offset,
208  uint32_t size,
209  const void *buffer,
210  uint16_t timeout = 0 );
211 
212  //------------------------------------------------------------------------
219  //------------------------------------------------------------------------
221  uint16_t timeout = 0 );
222 
223 
224  //------------------------------------------------------------------------
230  //------------------------------------------------------------------------
231  XRootDStatus Sync( uint16_t timeout = 0 );
232 
233  //------------------------------------------------------------------------
241  //------------------------------------------------------------------------
242  XRootDStatus Truncate( uint64_t size,
243  ResponseHandler *handler,
244  uint16_t timeout = 0 );
245 
246 
247  //------------------------------------------------------------------------
254  //------------------------------------------------------------------------
255  XRootDStatus Truncate( uint64_t size, uint16_t timeout = 0 );
256 
257  //------------------------------------------------------------------------
273  //------------------------------------------------------------------------
274  XRootDStatus VectorRead( const ChunkList &chunks,
275  void *buffer,
276  ResponseHandler *handler,
277  uint16_t timeout = 0 );
278 
279  //------------------------------------------------------------------------
295  //------------------------------------------------------------------------
296  XRootDStatus VectorRead( const ChunkList &chunks,
297  void *buffer,
298  VectorReadInfo *&vReadInfo,
299  uint16_t timeout = 0 );
300 
301  //------------------------------------------------------------------------
312  //------------------------------------------------------------------------
313  XRootDStatus Fcntl( const Buffer &arg,
314  ResponseHandler *handler,
315  uint16_t timeout = 0 );
316 
317  //------------------------------------------------------------------------
326  //------------------------------------------------------------------------
327  XRootDStatus Fcntl( const Buffer &arg,
328  Buffer *&response,
329  uint16_t timeout = 0 );
330 
331  //------------------------------------------------------------------------
340  //------------------------------------------------------------------------
342  uint16_t timeout = 0 );
343 
344  //------------------------------------------------------------------------
351  //------------------------------------------------------------------------
352  XRootDStatus Visa( Buffer *&visa,
353  uint16_t timeout = 0 );
354 
355  //------------------------------------------------------------------------
357  //------------------------------------------------------------------------
358  bool IsOpen() const;
359 
360  //------------------------------------------------------------------------
367  //------------------------------------------------------------------------
368  bool SetProperty( const std::string &name, const std::string &value );
369 
370  //------------------------------------------------------------------------
378  //------------------------------------------------------------------------
379  bool GetProperty( const std::string &name, std::string &value ) const;
380 
381  private:
382  FileStateHandler *pStateHandler;
383  FilePlugIn *pPlugIn;
385  };
386 }
387 
388 #endif // __XRD_CL_FILE_HH__