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 
35 namespace XrdCl
36 {
37  class FileStateHandler;
38  class FilePlugIn;
39 
40  //----------------------------------------------------------------------------
42  //----------------------------------------------------------------------------
43  class File
44  {
45  public:
46 
48  {
51  };
52 
53  //------------------------------------------------------------------------
55  //------------------------------------------------------------------------
56  File( bool enablePlugIns = true );
57 
58  //------------------------------------------------------------------------
60  //------------------------------------------------------------------------
61  File( VirtRedirect virtRedirect, bool enablePlugIns = true );
62 
63  //------------------------------------------------------------------------
65  //------------------------------------------------------------------------
66  virtual ~File();
67 
68  //------------------------------------------------------------------------
78  //------------------------------------------------------------------------
79  XRootDStatus Open( const std::string &url,
80  OpenFlags::Flags flags,
81  Access::Mode mode,
82  ResponseHandler *handler,
83  uint16_t timeout = 0 )
84  XRD_WARN_UNUSED_RESULT;
85 
86  //------------------------------------------------------------------------
95  //------------------------------------------------------------------------
96  XRootDStatus Open( const std::string &url,
97  OpenFlags::Flags flags,
98  Access::Mode mode = Access::None,
99  uint16_t timeout = 0 )
100  XRD_WARN_UNUSED_RESULT;
101 
102  //------------------------------------------------------------------------
109  //------------------------------------------------------------------------
111  uint16_t timeout = 0 )
112  XRD_WARN_UNUSED_RESULT;
113 
114  //------------------------------------------------------------------------
120  //------------------------------------------------------------------------
121  XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
122 
123  //------------------------------------------------------------------------
133  //------------------------------------------------------------------------
134  XRootDStatus Stat( bool force,
135  ResponseHandler *handler,
136  uint16_t timeout = 0 )
137  XRD_WARN_UNUSED_RESULT;
138 
139  //------------------------------------------------------------------------
147  //------------------------------------------------------------------------
148  XRootDStatus Stat( bool force,
149  StatInfo *&response,
150  uint16_t timeout = 0 )
151  XRD_WARN_UNUSED_RESULT;
152 
153 
154  //------------------------------------------------------------------------
167  //------------------------------------------------------------------------
168  XRootDStatus Read( uint64_t offset,
169  uint32_t size,
170  void *buffer,
171  ResponseHandler *handler,
172  uint16_t timeout = 0 )
173  XRD_WARN_UNUSED_RESULT;
174 
175  //------------------------------------------------------------------------
185  //------------------------------------------------------------------------
186  XRootDStatus Read( uint64_t offset,
187  uint32_t size,
188  void *buffer,
189  uint32_t &bytesRead,
190  uint16_t timeout = 0 )
191  XRD_WARN_UNUSED_RESULT;
192 
193  //------------------------------------------------------------------------
206  //------------------------------------------------------------------------
207  XRootDStatus Write( uint64_t offset,
208  uint32_t size,
209  const void *buffer,
210  ResponseHandler *handler,
211  uint16_t timeout = 0 )
212  XRD_WARN_UNUSED_RESULT;
213 
214  //------------------------------------------------------------------------
227  //------------------------------------------------------------------------
228  XRootDStatus Write( uint64_t offset,
229  uint32_t size,
230  const void *buffer,
231  uint16_t timeout = 0 )
232  XRD_WARN_UNUSED_RESULT;
233 
234  //------------------------------------------------------------------------
241  //------------------------------------------------------------------------
243  uint16_t timeout = 0 )
244  XRD_WARN_UNUSED_RESULT;
245 
246 
247  //------------------------------------------------------------------------
253  //------------------------------------------------------------------------
254  XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
255 
256  //------------------------------------------------------------------------
264  //------------------------------------------------------------------------
265  XRootDStatus Truncate( uint64_t size,
266  ResponseHandler *handler,
267  uint16_t timeout = 0 )
268  XRD_WARN_UNUSED_RESULT;
269 
270 
271  //------------------------------------------------------------------------
278  //------------------------------------------------------------------------
279  XRootDStatus Truncate( uint64_t size,
280  uint16_t timeout = 0 )
281  XRD_WARN_UNUSED_RESULT;
282 
283  //------------------------------------------------------------------------
299  //------------------------------------------------------------------------
300  XRootDStatus VectorRead( const ChunkList &chunks,
301  void *buffer,
302  ResponseHandler *handler,
303  uint16_t timeout = 0 )
304  XRD_WARN_UNUSED_RESULT;
305 
306  //------------------------------------------------------------------------
322  //------------------------------------------------------------------------
323  XRootDStatus VectorRead( const ChunkList &chunks,
324  void *buffer,
325  VectorReadInfo *&vReadInfo,
326  uint16_t timeout = 0 )
327  XRD_WARN_UNUSED_RESULT;
328 
329  //------------------------------------------------------------------------
340  //------------------------------------------------------------------------
341  XRootDStatus Fcntl( const Buffer &arg,
342  ResponseHandler *handler,
343  uint16_t timeout = 0 )
344  XRD_WARN_UNUSED_RESULT;
345 
346  //------------------------------------------------------------------------
355  //------------------------------------------------------------------------
356  XRootDStatus Fcntl( const Buffer &arg,
357  Buffer *&response,
358  uint16_t timeout = 0 )
359  XRD_WARN_UNUSED_RESULT;
360 
361  //------------------------------------------------------------------------
370  //------------------------------------------------------------------------
372  uint16_t timeout = 0 )
373  XRD_WARN_UNUSED_RESULT;
374 
375  //------------------------------------------------------------------------
382  //------------------------------------------------------------------------
383  XRootDStatus Visa( Buffer *&visa,
384  uint16_t timeout = 0 )
385  XRD_WARN_UNUSED_RESULT;
386 
387  //------------------------------------------------------------------------
389  //------------------------------------------------------------------------
390  bool IsOpen() const;
391 
392  //------------------------------------------------------------------------
399  //------------------------------------------------------------------------
400  bool SetProperty( const std::string &name, const std::string &value );
401 
402  //------------------------------------------------------------------------
410  //------------------------------------------------------------------------
411  bool GetProperty( const std::string &name, std::string &value ) const;
412 
413  private:
414  FileStateHandler *pStateHandler;
415  FilePlugIn *pPlugIn;
417  };
418 }
419 
420 #endif // __XRD_CL_FILE_HH__
XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
VirtRedirect
Definition: XrdClFile.hh:47
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:763
bool GetProperty(const std::string &name, std::string &value) const
Object stat info.
Definition: XrdClXRootDResponses.hh:332
XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
bool IsOpen() const
Check if the file is open.
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:414
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:71
bool pEnablePlugIns
Definition: XrdClFile.hh:416
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:43
XRootDStatus Close(ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Request status.
Definition: XrdClXRootDResponses.hh:212
Definition: XrdClEnv.hh:28
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
Mode
Access mode.
Definition: XrdClFileSystem.hh:120
FilePlugIn * pPlugIn
Definition: XrdClFile.hh:415
Flags
Open flags, may be or&#39;d when appropriate.
Definition: XrdClFileSystem.hh:76
Definition: XrdClFile.hh:49
Definition: XrdClFile.hh:50
XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Binary blob representation.
Definition: XrdClBuffer.hh:33