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 //------------------------------------------------------------------------ 00067 //------------------------------------------------------------------------ 00068 virtual void EndJob( uint16_t jobNum, 00069 const PropertyList *result ) 00070 { 00071 (void)jobNum; (void)result; 00072 }; 00073 00074 //------------------------------------------------------------------------ 00081 //------------------------------------------------------------------------ 00082 virtual void JobProgress( uint16_t jobNum, 00083 uint64_t bytesProcessed, 00084 uint64_t bytesTotal ) 00085 { 00086 (void)jobNum; (void)bytesProcessed; (void)bytesTotal; 00087 }; 00088 00089 //------------------------------------------------------------------------ 00091 //------------------------------------------------------------------------ 00092 virtual bool ShouldCancel( uint16_t jobNum ) 00093 { 00094 (void)jobNum; 00095 return false; 00096 } 00097 }; 00098 00099 //---------------------------------------------------------------------------- 00101 //---------------------------------------------------------------------------- 00102 class CopyProcess 00103 { 00104 public: 00105 //------------------------------------------------------------------------ 00107 //------------------------------------------------------------------------ 00108 CopyProcess() {} 00109 00110 //------------------------------------------------------------------------ 00112 //------------------------------------------------------------------------ 00113 virtual ~CopyProcess(); 00114 00115 //------------------------------------------------------------------------ 00161 //------------------------------------------------------------------------ 00162 XRootDStatus AddJob( const PropertyList &properties, 00163 PropertyList *results ); 00164 00165 //------------------------------------------------------------------------ 00166 // Prepare the copy jobs 00167 //------------------------------------------------------------------------ 00168 XRootDStatus Prepare(); 00169 00170 //------------------------------------------------------------------------ 00172 //------------------------------------------------------------------------ 00173 XRootDStatus Run( CopyProgressHandler *handler ); 00174 00175 private: 00176 void CleanUpJobs(); 00177 std::vector<PropertyList> pJobProperties; 00178 std::vector<PropertyList*> pJobResults; 00179 std::vector<CopyJob*> pJobs; 00180 }; 00181 } 00182 00183 #endif // __XRD_CL_COPY_PROCESS_HH__