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 00035 namespace XrdCl 00036 { 00037 class FileStateHandler; 00038 class FilePlugIn; 00039 00040 //---------------------------------------------------------------------------- 00042 //---------------------------------------------------------------------------- 00043 class File 00044 { 00045 public: 00046 00047 enum VirtRedirect 00048 { 00049 EnableVirtRedirect, 00050 DisableVirtRedirect 00051 }; 00052 00053 //------------------------------------------------------------------------ 00055 //------------------------------------------------------------------------ 00056 File( bool enablePlugIns = true ); 00057 00058 //------------------------------------------------------------------------ 00060 //------------------------------------------------------------------------ 00061 File( VirtRedirect virtRedirect, bool enablePlugIns = true ); 00062 00063 //------------------------------------------------------------------------ 00065 //------------------------------------------------------------------------ 00066 virtual ~File(); 00067 00068 //------------------------------------------------------------------------ 00078 //------------------------------------------------------------------------ 00079 XRootDStatus Open( const std::string &url, 00080 OpenFlags::Flags flags, 00081 Access::Mode mode, 00082 ResponseHandler *handler, 00083 uint16_t timeout = 0 ) 00084 XRD_WARN_UNUSED_RESULT; 00085 00086 //------------------------------------------------------------------------ 00095 //------------------------------------------------------------------------ 00096 XRootDStatus Open( const std::string &url, 00097 OpenFlags::Flags flags, 00098 Access::Mode mode = Access::None, 00099 uint16_t timeout = 0 ) 00100 XRD_WARN_UNUSED_RESULT; 00101 00102 //------------------------------------------------------------------------ 00109 //------------------------------------------------------------------------ 00110 XRootDStatus Close( ResponseHandler *handler, 00111 uint16_t timeout = 0 ) 00112 XRD_WARN_UNUSED_RESULT; 00113 00114 //------------------------------------------------------------------------ 00120 //------------------------------------------------------------------------ 00121 XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00122 00123 //------------------------------------------------------------------------ 00133 //------------------------------------------------------------------------ 00134 XRootDStatus Stat( bool force, 00135 ResponseHandler *handler, 00136 uint16_t timeout = 0 ) 00137 XRD_WARN_UNUSED_RESULT; 00138 00139 //------------------------------------------------------------------------ 00147 //------------------------------------------------------------------------ 00148 XRootDStatus Stat( bool force, 00149 StatInfo *&response, 00150 uint16_t timeout = 0 ) 00151 XRD_WARN_UNUSED_RESULT; 00152 00153 00154 //------------------------------------------------------------------------ 00167 //------------------------------------------------------------------------ 00168 XRootDStatus Read( uint64_t offset, 00169 uint32_t size, 00170 void *buffer, 00171 ResponseHandler *handler, 00172 uint16_t timeout = 0 ) 00173 XRD_WARN_UNUSED_RESULT; 00174 00175 //------------------------------------------------------------------------ 00185 //------------------------------------------------------------------------ 00186 XRootDStatus Read( uint64_t offset, 00187 uint32_t size, 00188 void *buffer, 00189 uint32_t &bytesRead, 00190 uint16_t timeout = 0 ) 00191 XRD_WARN_UNUSED_RESULT; 00192 00193 //------------------------------------------------------------------------ 00206 //------------------------------------------------------------------------ 00207 XRootDStatus Write( uint64_t offset, 00208 uint32_t size, 00209 const void *buffer, 00210 ResponseHandler *handler, 00211 uint16_t timeout = 0 ) 00212 XRD_WARN_UNUSED_RESULT; 00213 00214 //------------------------------------------------------------------------ 00227 //------------------------------------------------------------------------ 00228 XRootDStatus Write( uint64_t offset, 00229 uint32_t size, 00230 const void *buffer, 00231 uint16_t timeout = 0 ) 00232 XRD_WARN_UNUSED_RESULT; 00233 00234 //------------------------------------------------------------------------ 00241 //------------------------------------------------------------------------ 00242 XRootDStatus Sync( ResponseHandler *handler, 00243 uint16_t timeout = 0 ) 00244 XRD_WARN_UNUSED_RESULT; 00245 00246 00247 //------------------------------------------------------------------------ 00253 //------------------------------------------------------------------------ 00254 XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00255 00256 //------------------------------------------------------------------------ 00264 //------------------------------------------------------------------------ 00265 XRootDStatus Truncate( uint64_t size, 00266 ResponseHandler *handler, 00267 uint16_t timeout = 0 ) 00268 XRD_WARN_UNUSED_RESULT; 00269 00270 00271 //------------------------------------------------------------------------ 00278 //------------------------------------------------------------------------ 00279 XRootDStatus Truncate( uint64_t size, 00280 uint16_t timeout = 0 ) 00281 XRD_WARN_UNUSED_RESULT; 00282 00283 //------------------------------------------------------------------------ 00299 //------------------------------------------------------------------------ 00300 XRootDStatus VectorRead( const ChunkList &chunks, 00301 void *buffer, 00302 ResponseHandler *handler, 00303 uint16_t timeout = 0 ) 00304 XRD_WARN_UNUSED_RESULT; 00305 00306 //------------------------------------------------------------------------ 00322 //------------------------------------------------------------------------ 00323 XRootDStatus VectorRead( const ChunkList &chunks, 00324 void *buffer, 00325 VectorReadInfo *&vReadInfo, 00326 uint16_t timeout = 0 ) 00327 XRD_WARN_UNUSED_RESULT; 00328 00329 //------------------------------------------------------------------------ 00340 //------------------------------------------------------------------------ 00341 XRootDStatus Fcntl( const Buffer &arg, 00342 ResponseHandler *handler, 00343 uint16_t timeout = 0 ) 00344 XRD_WARN_UNUSED_RESULT; 00345 00346 //------------------------------------------------------------------------ 00355 //------------------------------------------------------------------------ 00356 XRootDStatus Fcntl( const Buffer &arg, 00357 Buffer *&response, 00358 uint16_t timeout = 0 ) 00359 XRD_WARN_UNUSED_RESULT; 00360 00361 //------------------------------------------------------------------------ 00370 //------------------------------------------------------------------------ 00371 XRootDStatus Visa( ResponseHandler *handler, 00372 uint16_t timeout = 0 ) 00373 XRD_WARN_UNUSED_RESULT; 00374 00375 //------------------------------------------------------------------------ 00382 //------------------------------------------------------------------------ 00383 XRootDStatus Visa( Buffer *&visa, 00384 uint16_t timeout = 0 ) 00385 XRD_WARN_UNUSED_RESULT; 00386 00387 //------------------------------------------------------------------------ 00389 //------------------------------------------------------------------------ 00390 bool IsOpen() const; 00391 00392 //------------------------------------------------------------------------ 00399 //------------------------------------------------------------------------ 00400 bool SetProperty( const std::string &name, const std::string &value ); 00401 00402 //------------------------------------------------------------------------ 00410 //------------------------------------------------------------------------ 00411 bool GetProperty( const std::string &name, std::string &value ) const; 00412 00413 private: 00414 FileStateHandler *pStateHandler; 00415 FilePlugIn *pPlugIn; 00416 bool pEnablePlugIns; 00417 }; 00418 } 00419 00420 #endif // __XRD_CL_FILE_HH__