xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
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
"
23
#include "
XrdCl/XrdClXRootDResponses.hh
"
24
#include <stdint.h>
25
26
namespace
XrdCl
27
{
28
//----------------------------------------------------------------------------
30
//----------------------------------------------------------------------------
31
class
CopyProgressHandler
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
//----------------------------------------------------------------------------
70
struct
JobDescriptor
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
77
URL
source
;
78
URL
target
;
79
uint16_t
sourceLimit
;
80
81
bool
force
;
82
bool
posc
;
83
84
bool
coerce
;
85
86
bool
thirdParty
;
87
88
bool
thirdPartyFallBack
;
89
90
91
bool
checkSumPrint
;
92
93
std::string
checkSumType
;
94
std::string
checkSumPreset
;
95
uint32_t
chunkSize
;
96
97
uint8_t
parallelChunks
;
98
99
100
std::string
sourceCheckSum
;
101
102
std::string
targetCheckSum
;
103
104
XRootDStatus
status
;
105
106
std::vector<URL>
sources
;
107
108
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
//------------------------------------------------------------------------
141
JobDescriptor
*
GetDescriptor
()
const
142
{
143
return
pJob
;
144
}
145
146
protected
:
147
JobDescriptor
*
pJob
;
148
};
149
150
//----------------------------------------------------------------------------
152
//----------------------------------------------------------------------------
153
class
CopyProcess
154
{
155
public
:
156
//------------------------------------------------------------------------
158
//------------------------------------------------------------------------
159
CopyProcess
() {}
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
//------------------------------------------------------------------------
178
XRootDStatus
Prepare
();
179
180
//------------------------------------------------------------------------
182
//------------------------------------------------------------------------
183
XRootDStatus
Run
(
CopyProgressHandler
*handler );
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__
Generated by
1.8.3.1