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  //------------------------------------------------------------------------
49  File( bool enablePlugIns = true );
50 
51  //------------------------------------------------------------------------
53  //------------------------------------------------------------------------
54  virtual ~File();
55 
56  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  XRootDStatus Open( const std::string &url,
68  OpenFlags::Flags flags,
69  Access::Mode mode,
70  ResponseHandler *handler,
71  uint16_t timeout = 0 )
72  XRD_WARN_UNUSED_RESULT;
73 
74  //------------------------------------------------------------------------
83  //------------------------------------------------------------------------
84  XRootDStatus Open( const std::string &url,
85  OpenFlags::Flags flags,
87  uint16_t timeout = 0 )
88  XRD_WARN_UNUSED_RESULT;
89 
90  //------------------------------------------------------------------------
97  //------------------------------------------------------------------------
99  uint16_t timeout = 0 )
100  XRD_WARN_UNUSED_RESULT;
101 
102  //------------------------------------------------------------------------
108  //------------------------------------------------------------------------
109  XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
110 
111  //------------------------------------------------------------------------
121  //------------------------------------------------------------------------
122  XRootDStatus Stat( bool force,
123  ResponseHandler *handler,
124  uint16_t timeout = 0 )
125  XRD_WARN_UNUSED_RESULT;
126 
127  //------------------------------------------------------------------------
135  //------------------------------------------------------------------------
136  XRootDStatus Stat( bool force,
137  StatInfo *&response,
138  uint16_t timeout = 0 )
139  XRD_WARN_UNUSED_RESULT;
140 
141 
142  //------------------------------------------------------------------------
155  //------------------------------------------------------------------------
156  XRootDStatus Read( uint64_t offset,
157  uint32_t size,
158  void *buffer,
159  ResponseHandler *handler,
160  uint16_t timeout = 0 )
161  XRD_WARN_UNUSED_RESULT;
162 
163  //------------------------------------------------------------------------
173  //------------------------------------------------------------------------
174  XRootDStatus Read( uint64_t offset,
175  uint32_t size,
176  void *buffer,
177  uint32_t &bytesRead,
178  uint16_t timeout = 0 )
179  XRD_WARN_UNUSED_RESULT;
180 
181  //------------------------------------------------------------------------
194  //------------------------------------------------------------------------
195  XRootDStatus Write( uint64_t offset,
196  uint32_t size,
197  const void *buffer,
198  ResponseHandler *handler,
199  uint16_t timeout = 0 )
200  XRD_WARN_UNUSED_RESULT;
201 
202  //------------------------------------------------------------------------
215  //------------------------------------------------------------------------
216  XRootDStatus Write( uint64_t offset,
217  uint32_t size,
218  const void *buffer,
219  uint16_t timeout = 0 )
220  XRD_WARN_UNUSED_RESULT;
221 
222  //------------------------------------------------------------------------
229  //------------------------------------------------------------------------
231  uint16_t timeout = 0 )
232  XRD_WARN_UNUSED_RESULT;
233 
234 
235  //------------------------------------------------------------------------
241  //------------------------------------------------------------------------
242  XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
243 
244  //------------------------------------------------------------------------
252  //------------------------------------------------------------------------
253  XRootDStatus Truncate( uint64_t size,
254  ResponseHandler *handler,
255  uint16_t timeout = 0 )
256  XRD_WARN_UNUSED_RESULT;
257 
258 
259  //------------------------------------------------------------------------
266  //------------------------------------------------------------------------
267  XRootDStatus Truncate( uint64_t size,
268  uint16_t timeout = 0 )
269  XRD_WARN_UNUSED_RESULT;
270 
271  //------------------------------------------------------------------------
287  //------------------------------------------------------------------------
288  XRootDStatus VectorRead( const ChunkList &chunks,
289  void *buffer,
290  ResponseHandler *handler,
291  uint16_t timeout = 0 )
292  XRD_WARN_UNUSED_RESULT;
293 
294  //------------------------------------------------------------------------
310  //------------------------------------------------------------------------
311  XRootDStatus VectorRead( const ChunkList &chunks,
312  void *buffer,
313  VectorReadInfo *&vReadInfo,
314  uint16_t timeout = 0 )
315  XRD_WARN_UNUSED_RESULT;
316 
317  //------------------------------------------------------------------------
328  //------------------------------------------------------------------------
329  XRootDStatus Fcntl( const Buffer &arg,
330  ResponseHandler *handler,
331  uint16_t timeout = 0 )
332  XRD_WARN_UNUSED_RESULT;
333 
334  //------------------------------------------------------------------------
343  //------------------------------------------------------------------------
344  XRootDStatus Fcntl( const Buffer &arg,
345  Buffer *&response,
346  uint16_t timeout = 0 )
347  XRD_WARN_UNUSED_RESULT;
348 
349  //------------------------------------------------------------------------
358  //------------------------------------------------------------------------
360  uint16_t timeout = 0 )
361  XRD_WARN_UNUSED_RESULT;
362 
363  //------------------------------------------------------------------------
370  //------------------------------------------------------------------------
371  XRootDStatus Visa( Buffer *&visa,
372  uint16_t timeout = 0 )
373  XRD_WARN_UNUSED_RESULT;
374 
375  //------------------------------------------------------------------------
377  //------------------------------------------------------------------------
378  bool IsOpen() const;
379 
380  //------------------------------------------------------------------------
387  //------------------------------------------------------------------------
388  bool SetProperty( const std::string &name, const std::string &value );
389 
390  //------------------------------------------------------------------------
398  //------------------------------------------------------------------------
399  bool GetProperty( const std::string &name, std::string &value ) const;
400 
401  private:
402  FileStateHandler *pStateHandler;
403  FilePlugIn *pPlugIn;
405  };
406 }
407 
408 #endif // __XRD_CL_FILE_HH__
XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:762
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.
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:402
bool pEnablePlugIns
Definition: XrdClFile.hh:404
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
bool IsOpen() const
Check if the file is open.
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:767
Handle an async response.
Definition: XrdClXRootDResponses.hh:832
Definition: XrdClFileSystem.hh:122
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:403
Flags
Open flags, may be or'd when appropriate.
Definition: XrdClFileSystem.hh:76
XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0) XRD_WARN_UNUSED_RESULT
Binary blob representation.
Definition: XrdClBuffer.hh:33