xrootd
XrdClCopyProcess.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // XRootD is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // XRootD is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17 //------------------------------------------------------------------------------
18 
19 #ifndef __XRD_CL_COPY_PROCESS_HH__
20 #define __XRD_CL_COPY_PROCESS_HH__
21 
22 #include "XrdCl/XrdClURL.hh"
24 #include <stdint.h>
25 
26 namespace XrdCl
27 {
28  //----------------------------------------------------------------------------
30  //----------------------------------------------------------------------------
32  {
33  public:
34  virtual ~CopyProgressHandler() {}
35 
36  //------------------------------------------------------------------------
43  //------------------------------------------------------------------------
44  virtual void BeginJob( uint16_t jobNum,
45  uint16_t jobTotal,
46  const URL *source,
47  const URL *destination ) = 0;
48 
49  //------------------------------------------------------------------------
53  //------------------------------------------------------------------------
54  virtual void EndJob( const XRootDStatus &status ) = 0;
55 
56  //------------------------------------------------------------------------
62  //------------------------------------------------------------------------
63  virtual void JobProgress( uint64_t bytesProcessed,
64  uint64_t bytesTotal ) = 0;
65  };
66 
67  //----------------------------------------------------------------------------
69  //----------------------------------------------------------------------------
71  {
72  JobDescriptor(): sourceLimit(1), force(false), posc(false), coerce(false),
73  thirdParty(false), thirdPartyFallBack(true), checkSumPrint(false),
74  chunkSize( 4194304 ), parallelChunks(8)
75  {}
76 
79  uint16_t sourceLimit;
80  bool force;
82  bool posc;
83  bool coerce;
85  bool thirdParty;
87  bool thirdPartyFallBack;
89  bool checkSumPrint;
92  std::string checkSumType;
94  std::string checkSumPreset;
95  uint32_t chunkSize;
96  uint8_t parallelChunks;
98 
100  std::string sourceCheckSum;
101  std::string targetCheckSum;
105  std::vector<URL> sources;
107  URL realTarget;
109  };
110 
111  //----------------------------------------------------------------------------
113  //----------------------------------------------------------------------------
114  class CopyJob
115  {
116  public:
117  //------------------------------------------------------------------------
119  //------------------------------------------------------------------------
120  CopyJob( JobDescriptor *jobDesc ):
121  pJob( jobDesc ) {}
122 
123  //------------------------------------------------------------------------
125  //------------------------------------------------------------------------
126  virtual ~CopyJob()
127  {
128  }
129 
130  //------------------------------------------------------------------------
135  //------------------------------------------------------------------------
136  virtual XRootDStatus Run( CopyProgressHandler *progress = 0 ) = 0;
137 
138  //------------------------------------------------------------------------
140  //------------------------------------------------------------------------
142  {
143  return pJob;
144  }
145 
146  protected:
148  };
149 
150  //----------------------------------------------------------------------------
152  //----------------------------------------------------------------------------
154  {
155  public:
156  //------------------------------------------------------------------------
158  //------------------------------------------------------------------------
160 
161  //------------------------------------------------------------------------
163  //------------------------------------------------------------------------
164  virtual ~CopyProcess();
165 
166  //------------------------------------------------------------------------
169  //------------------------------------------------------------------------
170  void AddJob( JobDescriptor *job )
171  {
172  pJobDescs.push_back( job );
173  }
174 
175  //------------------------------------------------------------------------
176  // Prepare the copy jobs
177  //------------------------------------------------------------------------
179 
180  //------------------------------------------------------------------------
182  //------------------------------------------------------------------------
184 
185  private:
186  void CleanUpJobs();
187  std::list<JobDescriptor*> pJobDescs;
188  std::list<CopyJob*> pJobs;
189  };
190 }
191 
192 #endif // __XRD_CL_COPY_PROCESS_HH__
std::string sourceCheckSum
Definition: XrdClCopyProcess.hh:100
JobDescriptor()
Definition: XrdClCopyProcess.hh:72
std::list< JobDescriptor * > pJobDescs
Definition: XrdClCopyProcess.hh:187
bool thirdParty
Definition: XrdClCopyProcess.hh:86
void AddJob(JobDescriptor *job)
Definition: XrdClCopyProcess.hh:170
URL realTarget
the actual disk server target
Definition: XrdClCopyProcess.hh:108
std::string checkSumType
[in] type of the checksum
Definition: XrdClCopyProcess.hh:93
Interface for copy progress notification.
Definition: XrdClCopyProcess.hh:31
XRootDStatus Prepare()
std::vector< URL > sources
Definition: XrdClCopyProcess.hh:106
bool thirdPartyFallBack
Definition: XrdClCopyProcess.hh:88
XRootDStatus status
Definition: XrdClCopyProcess.hh:104
Job description.
Definition: XrdClCopyProcess.hh:70
virtual ~CopyJob()
Virtual destructor.
Definition: XrdClCopyProcess.hh:126
CopyJob(JobDescriptor *jobDesc)
Constructor.
Definition: XrdClCopyProcess.hh:120
std::string checkSumPreset
[in] checksum preset
Definition: XrdClCopyProcess.hh:94
Copy job.
Definition: XrdClCopyProcess.hh:114
bool posc
Definition: XrdClCopyProcess.hh:82
XRootDStatus Run(CopyProgressHandler *handler)
Run the copy jobs.
Request status.
Definition: XrdClXRootDResponses.hh:208
CopyProcess()
Constructor.
Definition: XrdClCopyProcess.hh:159
bool coerce
Definition: XrdClCopyProcess.hh:84
Copy the data from one point to another.
Definition: XrdClCopyProcess.hh:153
virtual void EndJob(const XRootDStatus &status)=0
virtual ~CopyProcess()
Destructor.
bool force
[in] overwrite target if exists
Definition: XrdClCopyProcess.hh:81
URL source
[in] original source URL
Definition: XrdClCopyProcess.hh:77
virtual void BeginJob(uint16_t jobNum, uint16_t jobTotal, const URL *source, const URL *destination)=0
URL target
[in] target directory or file
Definition: XrdClCopyProcess.hh:78
virtual ~CopyProgressHandler()
Definition: XrdClCopyProcess.hh:34
virtual XRootDStatus Run(CopyProgressHandler *progress=0)=0
uint8_t parallelChunks
Definition: XrdClCopyProcess.hh:97
URL representation.
Definition: XrdClURL.hh:30
std::list< CopyJob * > pJobs
Definition: XrdClCopyProcess.hh:188
virtual void JobProgress(uint64_t bytesProcessed, uint64_t bytesTotal)=0
JobDescriptor * pJob
Definition: XrdClCopyProcess.hh:147
uint32_t chunkSize
Definition: XrdClCopyProcess.hh:95
uint16_t sourceLimit
Definition: XrdClCopyProcess.hh:79
std::string targetCheckSum
Definition: XrdClCopyProcess.hh:102
bool checkSumPrint
Definition: XrdClCopyProcess.hh:91
JobDescriptor * GetDescriptor() const
Get the job descriptor.
Definition: XrdClCopyProcess.hh:141