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 //------------------------------------------------------------------------ 00048 //------------------------------------------------------------------------ 00049 File( bool enablePlugIns = true ); 00050 00051 //------------------------------------------------------------------------ 00053 //------------------------------------------------------------------------ 00054 virtual ~File(); 00055 00056 //------------------------------------------------------------------------ 00066 //------------------------------------------------------------------------ 00067 XRootDStatus Open( const std::string &url, 00068 OpenFlags::Flags flags, 00069 Access::Mode mode, 00070 ResponseHandler *handler, 00071 uint16_t timeout = 0 ) 00072 XRD_WARN_UNUSED_RESULT; 00073 00074 //------------------------------------------------------------------------ 00083 //------------------------------------------------------------------------ 00084 XRootDStatus Open( const std::string &url, 00085 OpenFlags::Flags flags, 00086 Access::Mode mode = Access::None, 00087 uint16_t timeout = 0 ) 00088 XRD_WARN_UNUSED_RESULT; 00089 00090 //------------------------------------------------------------------------ 00097 //------------------------------------------------------------------------ 00098 XRootDStatus Close( ResponseHandler *handler, 00099 uint16_t timeout = 0 ) 00100 XRD_WARN_UNUSED_RESULT; 00101 00102 //------------------------------------------------------------------------ 00108 //------------------------------------------------------------------------ 00109 XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00110 00111 //------------------------------------------------------------------------ 00121 //------------------------------------------------------------------------ 00122 XRootDStatus Stat( bool force, 00123 ResponseHandler *handler, 00124 uint16_t timeout = 0 ) 00125 XRD_WARN_UNUSED_RESULT; 00126 00127 //------------------------------------------------------------------------ 00135 //------------------------------------------------------------------------ 00136 XRootDStatus Stat( bool force, 00137 StatInfo *&response, 00138 uint16_t timeout = 0 ) 00139 XRD_WARN_UNUSED_RESULT; 00140 00141 00142 //------------------------------------------------------------------------ 00155 //------------------------------------------------------------------------ 00156 XRootDStatus Read( uint64_t offset, 00157 uint32_t size, 00158 void *buffer, 00159 ResponseHandler *handler, 00160 uint16_t timeout = 0 ) 00161 XRD_WARN_UNUSED_RESULT; 00162 00163 //------------------------------------------------------------------------ 00173 //------------------------------------------------------------------------ 00174 XRootDStatus Read( uint64_t offset, 00175 uint32_t size, 00176 void *buffer, 00177 uint32_t &bytesRead, 00178 uint16_t timeout = 0 ) 00179 XRD_WARN_UNUSED_RESULT; 00180 00181 //------------------------------------------------------------------------ 00194 //------------------------------------------------------------------------ 00195 XRootDStatus Write( uint64_t offset, 00196 uint32_t size, 00197 const void *buffer, 00198 ResponseHandler *handler, 00199 uint16_t timeout = 0 ) 00200 XRD_WARN_UNUSED_RESULT; 00201 00202 //------------------------------------------------------------------------ 00215 //------------------------------------------------------------------------ 00216 XRootDStatus Write( uint64_t offset, 00217 uint32_t size, 00218 const void *buffer, 00219 uint16_t timeout = 0 ) 00220 XRD_WARN_UNUSED_RESULT; 00221 00222 //------------------------------------------------------------------------ 00229 //------------------------------------------------------------------------ 00230 XRootDStatus Sync( ResponseHandler *handler, 00231 uint16_t timeout = 0 ) 00232 XRD_WARN_UNUSED_RESULT; 00233 00234 00235 //------------------------------------------------------------------------ 00241 //------------------------------------------------------------------------ 00242 XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 00243 00244 //------------------------------------------------------------------------ 00252 //------------------------------------------------------------------------ 00253 XRootDStatus Truncate( uint64_t size, 00254 ResponseHandler *handler, 00255 uint16_t timeout = 0 ) 00256 XRD_WARN_UNUSED_RESULT; 00257 00258 00259 //------------------------------------------------------------------------ 00266 //------------------------------------------------------------------------ 00267 XRootDStatus Truncate( uint64_t size, 00268 uint16_t timeout = 0 ) 00269 XRD_WARN_UNUSED_RESULT; 00270 00271 //------------------------------------------------------------------------ 00287 //------------------------------------------------------------------------ 00288 XRootDStatus VectorRead( const ChunkList &chunks, 00289 void *buffer, 00290 ResponseHandler *handler, 00291 uint16_t timeout = 0 ) 00292 XRD_WARN_UNUSED_RESULT; 00293 00294 //------------------------------------------------------------------------ 00310 //------------------------------------------------------------------------ 00311 XRootDStatus VectorRead( const ChunkList &chunks, 00312 void *buffer, 00313 VectorReadInfo *&vReadInfo, 00314 uint16_t timeout = 0 ) 00315 XRD_WARN_UNUSED_RESULT; 00316 00317 //------------------------------------------------------------------------ 00328 //------------------------------------------------------------------------ 00329 XRootDStatus Fcntl( const Buffer &arg, 00330 ResponseHandler *handler, 00331 uint16_t timeout = 0 ) 00332 XRD_WARN_UNUSED_RESULT; 00333 00334 //------------------------------------------------------------------------ 00343 //------------------------------------------------------------------------ 00344 XRootDStatus Fcntl( const Buffer &arg, 00345 Buffer *&response, 00346 uint16_t timeout = 0 ) 00347 XRD_WARN_UNUSED_RESULT; 00348 00349 //------------------------------------------------------------------------ 00358 //------------------------------------------------------------------------ 00359 XRootDStatus Visa( ResponseHandler *handler, 00360 uint16_t timeout = 0 ) 00361 XRD_WARN_UNUSED_RESULT; 00362 00363 //------------------------------------------------------------------------ 00370 //------------------------------------------------------------------------ 00371 XRootDStatus Visa( Buffer *&visa, 00372 uint16_t timeout = 0 ) 00373 XRD_WARN_UNUSED_RESULT; 00374 00375 //------------------------------------------------------------------------ 00377 //------------------------------------------------------------------------ 00378 bool IsOpen() const; 00379 00380 //------------------------------------------------------------------------ 00387 //------------------------------------------------------------------------ 00388 bool SetProperty( const std::string &name, const std::string &value ); 00389 00390 //------------------------------------------------------------------------ 00398 //------------------------------------------------------------------------ 00399 bool GetProperty( const std::string &name, std::string &value ) const; 00400 00401 private: 00402 FileStateHandler *pStateHandler; 00403 FilePlugIn *pPlugIn; 00404 bool pEnablePlugIns; 00405 }; 00406 } 00407 00408 #endif // __XRD_CL_FILE_HH__