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),
checkSumPrint
(false)
74
{}
75
76
URL
source
;
77
URL
target
;
78
uint16_t
sourceLimit
;
79
80
bool
force
;
81
bool
posc
;
82
83
bool
coerce
;
84
85
bool
thirdParty
;
86
87
bool
thirdPartyFallBack
;
88
89
90
bool
checkSumPrint
;
91
92
std::string
checkSumType
;
93
std::string
checkSumPreset
;
94
95
std::string
sourceCheckSum
;
96
97
std::string
targetCheckSum
;
98
99
XRootDStatus
status
;
100
101
std::vector<URL>
sources
;
102
103
URL
realTarget
;
104
};
105
106
//----------------------------------------------------------------------------
108
//----------------------------------------------------------------------------
109
class
CopyJob
110
{
111
public
:
112
//------------------------------------------------------------------------
114
//------------------------------------------------------------------------
115
CopyJob
(
JobDescriptor
*jobDesc ):
116
pJob
( jobDesc ) {}
117
118
//------------------------------------------------------------------------
120
//------------------------------------------------------------------------
121
virtual
~CopyJob
()
122
{
123
}
124
125
//------------------------------------------------------------------------
130
//------------------------------------------------------------------------
131
virtual
XRootDStatus
Run
(
CopyProgressHandler
*progress = 0 ) = 0;
132
133
//------------------------------------------------------------------------
135
//------------------------------------------------------------------------
136
JobDescriptor
*
GetDescriptor
()
const
137
{
138
return
pJob
;
139
}
140
141
protected
:
142
JobDescriptor
*
pJob
;
143
};
144
145
//----------------------------------------------------------------------------
147
//----------------------------------------------------------------------------
148
class
CopyProcess
149
{
150
public
:
151
//------------------------------------------------------------------------
153
//------------------------------------------------------------------------
154
CopyProcess
() {}
155
156
//------------------------------------------------------------------------
158
//------------------------------------------------------------------------
159
virtual
~CopyProcess
();
160
161
//------------------------------------------------------------------------
164
//------------------------------------------------------------------------
165
void
AddJob
(
JobDescriptor
*job )
166
{
167
pJobDescs
.push_back( job );
168
}
169
170
//------------------------------------------------------------------------
171
// Prepare the copy jobs
172
//------------------------------------------------------------------------
173
XRootDStatus
Prepare
();
174
175
//------------------------------------------------------------------------
177
//------------------------------------------------------------------------
178
XRootDStatus
Run
(
CopyProgressHandler
*handler );
179
180
private
:
181
void
CleanUpJobs
();
182
std::list<JobDescriptor*>
pJobDescs
;
183
std::list<CopyJob*>
pJobs
;
184
};
185
}
186
187
#endif // __XRD_CL_COPY_PROCESS_HH__
Generated by
1.8.3.1