xrootd
XrdClFile.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 #ifndef __XRD_CL_FILE_HH__
20 #define __XRD_CL_FILE_HH__
21 
22 #include "XrdCl/XrdClFileSystem.hh"
24 #include <stdint.h>
25 #include <string>
26 #include <vector>
27 
28 namespace XrdCl
29 {
30  class FileStateHandler;
31 
32  //----------------------------------------------------------------------------
34  //----------------------------------------------------------------------------
35  class File
36  {
37  public:
38  //------------------------------------------------------------------------
40  //------------------------------------------------------------------------
41  File();
42 
43  //------------------------------------------------------------------------
45  //------------------------------------------------------------------------
46  virtual ~File();
47 
48  //------------------------------------------------------------------------
58  //------------------------------------------------------------------------
59  XRootDStatus Open( const std::string &url,
60  OpenFlags::Flags flags,
61  Access::Mode mode,
62  ResponseHandler *handler,
63  uint16_t timeout = 0 );
64 
65  //------------------------------------------------------------------------
74  //------------------------------------------------------------------------
75  XRootDStatus Open( const std::string &url,
76  OpenFlags::Flags flags,
78  uint16_t timeout = 0 );
79 
80  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
89  uint16_t timeout = 0 );
90 
91  //------------------------------------------------------------------------
97  //------------------------------------------------------------------------
98  XRootDStatus Close( uint16_t timeout = 0 );
99 
100  //------------------------------------------------------------------------
110  //------------------------------------------------------------------------
111  XRootDStatus Stat( bool force,
112  ResponseHandler *handler,
113  uint16_t timeout = 0 );
114 
115  //------------------------------------------------------------------------
123  //------------------------------------------------------------------------
124  XRootDStatus Stat( bool force,
125  StatInfo *&response,
126  uint16_t timeout = 0 );
127 
128 
129  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  XRootDStatus Read( uint64_t offset,
144  uint32_t size,
145  void *buffer,
146  ResponseHandler *handler,
147  uint16_t timeout = 0 );
148 
149  //------------------------------------------------------------------------
159  //------------------------------------------------------------------------
160  XRootDStatus Read( uint64_t offset,
161  uint32_t size,
162  void *buffer,
163  uint32_t &bytesRead,
164  uint16_t timeout = 0 );
165 
166  //------------------------------------------------------------------------
179  //------------------------------------------------------------------------
180  XRootDStatus Write( uint64_t offset,
181  uint32_t size,
182  const void *buffer,
183  ResponseHandler *handler,
184  uint16_t timeout = 0 );
185 
186  //------------------------------------------------------------------------
199  //------------------------------------------------------------------------
200  XRootDStatus Write( uint64_t offset,
201  uint32_t size,
202  const void *buffer,
203  uint16_t timeout = 0 );
204 
205  //------------------------------------------------------------------------
212  //------------------------------------------------------------------------
214  uint16_t timeout = 0 );
215 
216 
217  //------------------------------------------------------------------------
223  //------------------------------------------------------------------------
224  XRootDStatus Sync( uint16_t timeout = 0 );
225 
226  //------------------------------------------------------------------------
234  //------------------------------------------------------------------------
235  XRootDStatus Truncate( uint64_t size,
236  ResponseHandler *handler,
237  uint16_t timeout = 0 );
238 
239 
240  //------------------------------------------------------------------------
247  //------------------------------------------------------------------------
248  XRootDStatus Truncate( uint64_t size, uint16_t timeout = 0 );
249 
250  //------------------------------------------------------------------------
266  //------------------------------------------------------------------------
267  XRootDStatus VectorRead( const ChunkList &chunks,
268  void *buffer,
269  ResponseHandler *handler,
270  uint16_t timeout = 0 );
271 
272  //------------------------------------------------------------------------
288  //------------------------------------------------------------------------
289  XRootDStatus VectorRead( const ChunkList &chunks,
290  void *buffer,
291  VectorReadInfo *&vReadInfo,
292  uint16_t timeout = 0 );
293 
294  //------------------------------------------------------------------------
296  //------------------------------------------------------------------------
297  bool IsOpen() const;
298 
299  //------------------------------------------------------------------------
302  //------------------------------------------------------------------------
303  void EnableReadRecovery( bool enable = true );
304 
305  //------------------------------------------------------------------------
308  //------------------------------------------------------------------------
309  void EnableWriteRecovery( bool enable = true );
310 
311  //------------------------------------------------------------------------
313  //------------------------------------------------------------------------
314  std::string GetDataServer() const;
315 
316  //------------------------------------------------------------------------
318  //------------------------------------------------------------------------
319  URL GetLastURL() const;
320 
321  private:
322  FileStateHandler *pStateHandler;
323  };
324 }
325 
326 #endif // __XRD_CL_FILE_HH__
XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:743
XRootDStatus Stat(bool force, ResponseHandler *handler, uint16_t timeout=0)
Object stat info.
Definition: XrdClXRootDResponses.hh:326
virtual ~File()
Destructor.
void EnableReadRecovery(bool enable=true)
FileStateHandler * pStateHandler
Definition: XrdClFile.hh:322
URL GetLastURL() const
Get final url with all the cgi information.
XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Sync(ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Close(ResponseHandler *handler, uint16_t timeout=0)
A file.
Definition: XrdClFile.hh:35
bool IsOpen() const
Check if the file is open.
Request status.
Definition: XrdClXRootDResponses.hh:208
Vector read info.
Definition: XrdClXRootDResponses.hh:748
Handle an async response.
Definition: XrdClXRootDResponses.hh:833
Definition: XrdClFileSystem.hh:108
XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
URL representation.
Definition: XrdClURL.hh:30
Mode
Access mode.
Definition: XrdClFileSystem.hh:106
XRootDStatus Open(const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
File()
Constructor.
Flags
Open flags, may be or'd when appropriate.
Definition: XrdClFileSystem.hh:68
std::string GetDataServer() const
Get the data server the file is accessed at.
void EnableWriteRecovery(bool enable=true)