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_COPY_PROCESS_HH__ 00026 #define __XRD_CL_COPY_PROCESS_HH__ 00027 00028 #include "XrdCl/XrdClURL.hh" 00029 #include "XrdCl/XrdClXRootDResponses.hh" 00030 #include "XrdCl/XrdClPropertyList.hh" 00031 #include <stdint.h> 00032 #include <vector> 00033 00034 namespace XrdCl 00035 { 00036 class CopyJob; 00037 00038 //---------------------------------------------------------------------------- 00040 //---------------------------------------------------------------------------- 00041 class CopyProgressHandler 00042 { 00043 public: 00044 virtual ~CopyProgressHandler() {} 00045 00046 //------------------------------------------------------------------------ 00053 //------------------------------------------------------------------------ 00054 virtual void BeginJob( uint16_t jobNum, 00055 uint16_t jobTotal, 00056 const URL *source, 00057 const URL *destination ) 00058 { 00059 (void)jobNum; (void)jobTotal; (void)source; (void)destination; 00060 }; 00061 00062 //------------------------------------------------------------------------ 00066 //------------------------------------------------------------------------ 00067 virtual void EndJob( uint16_t jobNum, 00068 const PropertyList *result ) 00069 { 00070 (void)jobNum; (void)result; 00071 }; 00072 00073 //------------------------------------------------------------------------ 00079 //------------------------------------------------------------------------ 00080 virtual void JobProgress( uint16_t jobNum, 00081 uint64_t bytesProcessed, 00082 uint64_t bytesTotal ) 00083 { 00084 (void)jobNum; (void)bytesProcessed; (void)bytesTotal; 00085 }; 00086 00087 //------------------------------------------------------------------------ 00089 //------------------------------------------------------------------------ 00090 virtual bool ShouldCancel( uint16_t jobNum ) 00091 { 00092 (void)jobNum; 00093 return false; 00094 } 00095 }; 00096 00097 //---------------------------------------------------------------------------- 00099 //---------------------------------------------------------------------------- 00100 class CopyProcess 00101 { 00102 public: 00103 //------------------------------------------------------------------------ 00105 //------------------------------------------------------------------------ 00106 CopyProcess() {} 00107 00108 //------------------------------------------------------------------------ 00110 //------------------------------------------------------------------------ 00111 virtual ~CopyProcess(); 00112 00113 //------------------------------------------------------------------------ 00159 //------------------------------------------------------------------------ 00160 XRootDStatus AddJob( const PropertyList &properties, 00161 PropertyList *results ); 00162 00163 //------------------------------------------------------------------------ 00164 // Prepare the copy jobs 00165 //------------------------------------------------------------------------ 00166 XRootDStatus Prepare(); 00167 00168 //------------------------------------------------------------------------ 00170 //------------------------------------------------------------------------ 00171 XRootDStatus Run( CopyProgressHandler *handler ); 00172 00173 private: 00174 void CleanUpJobs(); 00175 std::vector<PropertyList> pJobProperties; 00176 std::vector<PropertyList*> pJobResults; 00177 std::vector<CopyJob*> pJobs; 00178 }; 00179 } 00180 00181 #endif // __XRD_CL_COPY_PROCESS_HH__