|
||||
File indexing completed on 2025-01-30 10:27:52
0001 //------------------------------------------------------------------------------ 0002 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) 0003 // Author: Lukasz Janyst <ljanyst@cern.ch> 0004 //------------------------------------------------------------------------------ 0005 // This file is part of the XRootD software suite. 0006 // 0007 // XRootD is free software: you can redistribute it and/or modify 0008 // it under the terms of the GNU Lesser General Public License as published by 0009 // the Free Software Foundation, either version 3 of the License, or 0010 // (at your option) any later version. 0011 // 0012 // XRootD is distributed in the hope that it will be useful, 0013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 // GNU General Public License for more details. 0016 // 0017 // You should have received a copy of the GNU Lesser General Public License 0018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 0019 // 0020 // In applying this licence, CERN does not waive the privileges and immunities 0021 // granted to it by virtue of its status as an Intergovernmental Organization 0022 // or submit itself to any jurisdiction. 0023 //------------------------------------------------------------------------------ 0024 0025 #ifndef __XRD_CL_COPY_PROCESS_HH__ 0026 #define __XRD_CL_COPY_PROCESS_HH__ 0027 0028 #include "XrdCl/XrdClURL.hh" 0029 #include "XrdCl/XrdClXRootDResponses.hh" 0030 #include "XrdCl/XrdClPropertyList.hh" 0031 #include <cstdint> 0032 #include <vector> 0033 0034 namespace XrdCl 0035 { 0036 class CopyJob; 0037 0038 //---------------------------------------------------------------------------- 0039 //! Interface for copy progress notification 0040 //---------------------------------------------------------------------------- 0041 class CopyProgressHandler 0042 { 0043 public: 0044 virtual ~CopyProgressHandler() {} 0045 0046 //------------------------------------------------------------------------ 0047 //! Notify when a new job is about to start 0048 //! 0049 //! @param jobNum the job number of the copy job concerned 0050 //! @param jobTotal total number of jobs being processed 0051 //! @param source the source url of the current job 0052 //! @param destination the destination url of the current job 0053 //------------------------------------------------------------------------ 0054 virtual void BeginJob( uint16_t jobNum, 0055 uint16_t jobTotal, 0056 const URL *source, 0057 const URL *destination ) 0058 { 0059 (void)jobNum; (void)jobTotal; (void)source; (void)destination; 0060 }; 0061 0062 //------------------------------------------------------------------------ 0063 //! Notify when the previous job has finished 0064 //! 0065 //! @param jobNum job number 0066 //! @param result result of the job 0067 //------------------------------------------------------------------------ 0068 virtual void EndJob( uint16_t jobNum, 0069 const PropertyList *result ) 0070 { 0071 (void)jobNum; (void)result; 0072 }; 0073 0074 //------------------------------------------------------------------------ 0075 //! Notify about the progress of the current job 0076 //! 0077 //! @param jobNum job number 0078 //! @param bytesProcessed bytes processed by the current job 0079 //! @param bytesTotal total number of bytes to be processed by the 0080 //! current job 0081 //------------------------------------------------------------------------ 0082 virtual void JobProgress( uint16_t jobNum, 0083 uint64_t bytesProcessed, 0084 uint64_t bytesTotal ) 0085 { 0086 (void)jobNum; (void)bytesProcessed; (void)bytesTotal; 0087 }; 0088 0089 //------------------------------------------------------------------------ 0090 //! Determine whether the job should be canceled 0091 //------------------------------------------------------------------------ 0092 virtual bool ShouldCancel( uint16_t jobNum ) 0093 { 0094 (void)jobNum; 0095 return false; 0096 } 0097 }; 0098 0099 //---------------------------------------------------------------------------- 0100 // Forward declaration of implementation holding CopyProcess' data members 0101 //---------------------------------------------------------------------------- 0102 struct CopyProcessImpl; 0103 0104 //---------------------------------------------------------------------------- 0105 //! Copy the data from one point to another 0106 //---------------------------------------------------------------------------- 0107 class CopyProcess 0108 { 0109 public: 0110 //------------------------------------------------------------------------ 0111 //! Constructor 0112 //------------------------------------------------------------------------ 0113 CopyProcess(); 0114 0115 //------------------------------------------------------------------------ 0116 //! Destructor 0117 //------------------------------------------------------------------------ 0118 virtual ~CopyProcess(); 0119 0120 //------------------------------------------------------------------------ 0121 //! Add job 0122 //! 0123 //! @param properties job configuration parameters 0124 //! @param results placeholder for the results 0125 //! 0126 //! Configuration properties: 0127 //! source [string] - original source URL 0128 //! target [string] - target directory or file 0129 //! sourceLimit [uint16_t] - maximum number sources 0130 //! force [bool] - overwrite target if exists 0131 //! posc [bool] - persistify only on successful close 0132 //! coerce [bool] - ignore locking semantics on destination 0133 //! makeDir [bool] - create path to the file if it doesn't 0134 //! exist 0135 //! thirdParty [string] - "first" try third party copy, if it fails 0136 //! try normal copy; "only" only try third 0137 //! party copy 0138 //! checkSumMode [string] - "none" - no checksumming 0139 //! "end2end" - end to end checksumming 0140 //! "source" - calculate checksum at source 0141 //! "target" - calculate checksum at target 0142 //! checkSumType [string] - type of the checksum to be used 0143 //! checkSumPreset [string] - checksum preset 0144 //! chunkSize [uint32_t] - size of a copy chunks in bytes 0145 //! parallelChunks [uint8_t] - number of chunks that should be requested 0146 //! in parallel 0147 //! initTimeout [uint16_t] - time limit for successfull initialization 0148 //! of the copy job 0149 //! tpcTimeout [uint16_t] - time limit for the actual copy to finish 0150 //! dynamicSource [bool] - support for the case where the size source 0151 //! file may change during reading process 0152 //! 0153 //! Configuration job - this is a job that that is supposed to configure 0154 //! the copy process as a whole instead of adding a copy job: 0155 //! 0156 //! jobType [string] - "configuration" - for configuraion 0157 //! parallel [uint8_t] - nomber of copy jobs to be run in parallel 0158 //! 0159 //! Results: 0160 //! sourceCheckSum [string] - checksum at source, if requested 0161 //! targetCheckSum [string] - checksum at target, if requested 0162 //! size [uint64_t] - file size 0163 //! status [XRootDStatus] - status of the copy operation 0164 //! sources [vector<string>] - all sources used 0165 //! realTarget [string] - the actual disk server target 0166 //------------------------------------------------------------------------ 0167 XRootDStatus AddJob( const PropertyList &properties, 0168 PropertyList *results ); 0169 0170 //------------------------------------------------------------------------ 0171 // Prepare the copy jobs 0172 //------------------------------------------------------------------------ 0173 XRootDStatus Prepare(); 0174 0175 //------------------------------------------------------------------------ 0176 //! Run the copy jobs 0177 //------------------------------------------------------------------------ 0178 XRootDStatus Run( CopyProgressHandler *handler ); 0179 0180 private: 0181 void CleanUpJobs(); 0182 0183 //------------------------------------------------------------------------ 0184 //! Mark the URLs in the property list as ment for TPC 0185 //------------------------------------------------------------------------ 0186 inline static void MarkTPC( PropertyList &properties ) 0187 { 0188 std::string keys[] = { "source", "target" }; 0189 size_t size = sizeof( keys ) / sizeof( std::string ); 0190 for( size_t i = 0; i < size; ++i ) 0191 { 0192 URL url; 0193 properties.Get( keys[i], url ); 0194 URL::ParamsMap params = url.GetParams(); 0195 params["xrdcl.intent"] = "tpc"; 0196 url.SetParams( params ); 0197 properties.Set( keys[i], url.GetURL() ); 0198 } 0199 } 0200 0201 //------------------------------------------------------------------------ 0202 //! Pointer to implementation 0203 //------------------------------------------------------------------------ 0204 CopyProcessImpl *pImpl; 0205 }; 0206 } 0207 0208 #endif // __XRD_CL_COPY_PROCESS_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |