00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // This file is part of the XRootD software suite. 00006 // 00007 // XRootD is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU Lesser General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // XRootD is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // In applying this licence, CERN does not waive the privileges and immunities 00021 // granted to it by virtue of its status as an Intergovernmental Organization 00022 // or submit itself to any jurisdiction. 00023 //------------------------------------------------------------------------------ 00024 00025 #ifndef __XRD_CL_FILE_HH__ 00026 #define __XRD_CL_FILE_HH__ 00027 00028 #include "XrdCl/XrdClFileSystem.hh" 00029 #include "XrdCl/XrdClXRootDResponses.hh" 00030 #include "XrdOuc/XrdOucCompiler.hh" 00031 #include <stdint.h> 00032 #include <string> 00033 #include <vector> 00034 #include <sys/uio.h> 00035 00036 namespace XrdCl 00037 { 00038 class FileStateHandler; 00039 class FilePlugIn; 00040 00041 //---------------------------------------------------------------------------- 00043 //---------------------------------------------------------------------------- 00044 class File 00045 { 00046 public: 00047 00048 enum VirtRedirect 00049 { 00050 EnableVirtRedirect, 00051 DisableVirtRedirect 00052 }; 00053 00054 //------------------------------------------------------------------------ 00056 //------------------------------------------------------------------------ 00057 File( bool enablePlugIns = true ); 00058 00059 //------------------------------------------------------------------------ 00061 //------------------------------------------------------------------------ 00062 File( VirtRedirect virtRedirect, bool enablePlugIns = true ); 00063 00064 //------------------------------------------------------------------------ 00066 //------------------------------------------------------------------------ 00067 virtual ~File(); 00068 00069 //------------------------------------------------------------------------ 00079 //------------------------------------------------------------------------ 00080 XRootDStatus Open( const std::string &url, 00081 OpenFlags::Flags flags, 00082 Access::Mode mode, 00083 ResponseHandler *handler, 00084 uint16_t timeout = 0 ) 00085 XRD_WARN_UNUSED_RESULT; 00086 00087 //------------------------------------------------------------------------ 00096 //------------------------------------------------------------------------ 00097 XRootDStatus Open( const std::string &url, 00098 OpenFlags::Flags flags, 00099 Access::Mode mode = Access::None, 00100 uint16_t timeout = 0 ) 00101 XRD_WARN_UNUSED_RESULT; 00102 00103 //------------------------------------------------------------------------ 00110 //------------------------------------------------------------------------ 00111 XRootDStatus Close( ResponseHandler *handler, 00112 uint16_t timeout = 0 ) 00113 XRD_WARN_UNUSED_RESULT; 00114 00115 //------------------------------------------------------------------------ 00121 //------------------------------------------------------------------------ 00122 XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00123 00124 //------------------------------------------------------------------------ 00134 //------------------------------------------------------------------------ 00135 XRootDStatus Stat( bool force, 00136 ResponseHandler *handler, 00137 uint16_t timeout = 0 ) 00138 XRD_WARN_UNUSED_RESULT; 00139 00140 //------------------------------------------------------------------------ 00148 //------------------------------------------------------------------------ 00149 XRootDStatus Stat( bool force, 00150 StatInfo *&response, 00151 uint16_t timeout = 0 ) 00152 XRD_WARN_UNUSED_RESULT; 00153 00154 00155 //------------------------------------------------------------------------ 00168 //------------------------------------------------------------------------ 00169 XRootDStatus Read( uint64_t offset, 00170 uint32_t size, 00171 void *buffer, 00172 ResponseHandler *handler, 00173 uint16_t timeout = 0 ) 00174 XRD_WARN_UNUSED_RESULT; 00175 00176 //------------------------------------------------------------------------ 00186 //------------------------------------------------------------------------ 00187 XRootDStatus Read( uint64_t offset, 00188 uint32_t size, 00189 void *buffer, 00190 uint32_t &bytesRead, 00191 uint16_t timeout = 0 ) 00192 XRD_WARN_UNUSED_RESULT; 00193 00194 //------------------------------------------------------------------------ 00207 //------------------------------------------------------------------------ 00208 XRootDStatus Write( uint64_t offset, 00209 uint32_t size, 00210 const void *buffer, 00211 ResponseHandler *handler, 00212 uint16_t timeout = 0 ) 00213 XRD_WARN_UNUSED_RESULT; 00214 00215 //------------------------------------------------------------------------ 00228 //------------------------------------------------------------------------ 00229 XRootDStatus Write( uint64_t offset, 00230 uint32_t size, 00231 const void *buffer, 00232 uint16_t timeout = 0 ) 00233 XRD_WARN_UNUSED_RESULT; 00234 00235 //------------------------------------------------------------------------ 00242 //------------------------------------------------------------------------ 00243 XRootDStatus Sync( ResponseHandler *handler, 00244 uint16_t timeout = 0 ) 00245 XRD_WARN_UNUSED_RESULT; 00246 00247 00248 //------------------------------------------------------------------------ 00254 //------------------------------------------------------------------------ 00255 XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00256 00257 //------------------------------------------------------------------------ 00265 //------------------------------------------------------------------------ 00266 XRootDStatus Truncate( uint64_t size, 00267 ResponseHandler *handler, 00268 uint16_t timeout = 0 ) 00269 XRD_WARN_UNUSED_RESULT; 00270 00271 00272 //------------------------------------------------------------------------ 00279 //------------------------------------------------------------------------ 00280 XRootDStatus Truncate( uint64_t size, 00281 uint16_t timeout = 0 ) 00282 XRD_WARN_UNUSED_RESULT; 00283 00284 //------------------------------------------------------------------------ 00300 //------------------------------------------------------------------------ 00301 XRootDStatus VectorRead( const ChunkList &chunks, 00302 void *buffer, 00303 ResponseHandler *handler, 00304 uint16_t timeout = 0 ) 00305 XRD_WARN_UNUSED_RESULT; 00306 00307 //------------------------------------------------------------------------ 00323 //------------------------------------------------------------------------ 00324 XRootDStatus VectorRead( const ChunkList &chunks, 00325 void *buffer, 00326 VectorReadInfo *&vReadInfo, 00327 uint16_t timeout = 0 ) 00328 XRD_WARN_UNUSED_RESULT; 00329 00330 //------------------------------------------------------------------------ 00338 //------------------------------------------------------------------------ 00339 XRootDStatus VectorWrite( const ChunkList &chunks, 00340 ResponseHandler *handler, 00341 uint16_t timeout = 0 ) 00342 XRD_WARN_UNUSED_RESULT; 00343 00344 //------------------------------------------------------------------------ 00351 //------------------------------------------------------------------------ 00352 XRootDStatus VectorWrite( const ChunkList &chunks, 00353 uint16_t timeout = 0 ) 00354 XRD_WARN_UNUSED_RESULT; 00355 00356 //------------------------------------------------------------------------ 00366 //------------------------------------------------------------------------ 00367 XRootDStatus WriteV( uint64_t offset, 00368 const struct iovec *iov, 00369 int iovcnt, 00370 ResponseHandler *handler, 00371 uint16_t timeout = 0 ); 00372 00373 //------------------------------------------------------------------------ 00383 //------------------------------------------------------------------------ 00384 XRootDStatus WriteV( uint64_t offset, 00385 const struct iovec *iov, 00386 int iovcnt, 00387 uint16_t timeout = 0 ); 00388 00389 //------------------------------------------------------------------------ 00400 //------------------------------------------------------------------------ 00401 XRootDStatus Fcntl( const Buffer &arg, 00402 ResponseHandler *handler, 00403 uint16_t timeout = 0 ) 00404 XRD_WARN_UNUSED_RESULT; 00405 00406 //------------------------------------------------------------------------ 00415 //------------------------------------------------------------------------ 00416 XRootDStatus Fcntl( const Buffer &arg, 00417 Buffer *&response, 00418 uint16_t timeout = 0 ) 00419 XRD_WARN_UNUSED_RESULT; 00420 00421 //------------------------------------------------------------------------ 00430 //------------------------------------------------------------------------ 00431 XRootDStatus Visa( ResponseHandler *handler, 00432 uint16_t timeout = 0 ) 00433 XRD_WARN_UNUSED_RESULT; 00434 00435 //------------------------------------------------------------------------ 00442 //------------------------------------------------------------------------ 00443 XRootDStatus Visa( Buffer *&visa, 00444 uint16_t timeout = 0 ) 00445 XRD_WARN_UNUSED_RESULT; 00446 00447 //------------------------------------------------------------------------ 00449 //------------------------------------------------------------------------ 00450 bool IsOpen() const; 00451 00452 //------------------------------------------------------------------------ 00459 //------------------------------------------------------------------------ 00460 bool SetProperty( const std::string &name, const std::string &value ); 00461 00462 //------------------------------------------------------------------------ 00470 //------------------------------------------------------------------------ 00471 bool GetProperty( const std::string &name, std::string &value ) const; 00472 00473 private: 00474 FileStateHandler *pStateHandler; 00475 FilePlugIn *pPlugIn; 00476 bool pEnablePlugIns; 00477 }; 00478 } 00479 00480 #endif // __XRD_CL_FILE_HH__