ARC SDK
DTRStatus.h
1 // -*- indent-tabs-mode: nil -*-
2 
3 #ifndef __ARC_DTRSTATUS_H__
4 #define __ARC_DTRSTATUS_H__
5 
6 #include <string>
7 #include <vector>
8 
9 namespace DataStaging {
10 
12 
16  class DTRStatus {
17 
18  public:
19 
22 
23  // ORDER IS IMPORTANT!!
24 
26  NEW,
27 
30 
33 
36 
39 
42 
45 
48 
51 
54 
57 
60 
63 
66 
69 
72 
75 
78 
81 
84 
87 
90 
93 
96 
99 
102 
105 
108 
111 
114 
117 
120 
123 
126 
129 
132 
133  };
134 
136  DTRStatus(const DTRStatusType& status, std::string desc="")
137  : status(status), desc(desc) {}
140  : status(NEW), desc ("") {}
141 
143  bool operator==(const DTRStatusType& s) const {
144  return status == s;
145  }
147  bool operator==(const DTRStatus& s) const {
148  return status == s.status;
149  }
150 
151 
153  bool operator!=(const DTRStatusType& s) const {
154  return status != s;
155  }
157  bool operator!=(const DTRStatus& s) const {
158  return status != s.status;
159  }
160 
163  status = s;
164  return *this;
165  }
166 
168  std::string str() const;
169 
171  void SetDesc(const std::string& d) {
172  desc = d;
173  }
174 
176  std::string GetDesc() const {
177  return desc;
178  }
179 
182  return status;
183  }
184 
185  // The actions in the following two vectors must match
187  static const std::vector<DTRStatus::DTRStatusType> ToProcessStates;
189  static const std::vector<DTRStatus::DTRStatusType> ProcessingStates;
190 
192  static const std::vector<DTRStatus::DTRStatusType> StagedStates;
193 
194  private:
195 
197  DTRStatusType status;
199  std::string desc;
200 
201  }; // DTRStatus
202 
204 
209 
210  public:
211 
214 
217 
220 
223 
226 
229 
232 
235 
238 
241 
244  };
245 
248 
251 
254 
257 
260 
263  };
264 
266 
273  DTRStatus::DTRStatusType error_state,
274  DTRErrorLocation location,
275  const std::string& desc = ""):
276  error_status(status),
277  last_error_state(error_state),
278  error_location(location),
279  desc(desc) {};
280 
283  error_status(NONE_ERROR),
284  last_error_state(DTRStatus::NULL_STATE),
285  error_location(NO_ERROR_LOCATION),
286  desc("") {};
287 
290  return error_status;
291  }
292 
295  return last_error_state.GetStatus();
296  }
297 
300  return error_location;
301  }
302 
304  std::string GetDesc() const {
305  return desc;
306  }
307 
309  bool operator==(const DTRErrorStatusType& s) const {
310  return error_status == s;
311  }
313  bool operator==(const DTRErrorStatus& s) const {
314  return error_status == s.error_status;
315  }
316 
318  bool operator!=(const DTRErrorStatusType& s) const {
319  return error_status != s;
320  }
322  bool operator!=(const DTRErrorStatus& s) const {
323  return error_status != s.error_status;
324  }
325 
328  error_status = s;
329  return *this;
330  }
331 
332  private:
334  DTRErrorStatusType error_status;
336  DTRStatus last_error_state;
338  DTRErrorLocation error_location;
340  std::string desc;
341 
342  };
343 
344 } // namespace DataStaging
345 
346 #endif /*__ARC_DTRSTATUS_H_*/
static const std::vector< DTRStatus::DTRStatusType > ProcessingStates
Vector of states with a processing action, eg CHECKING_CACHE.
Definition: DTRStatus.h:189
DTRStatusType
Possible state values.
Definition: DTRStatus.h:21
Error occurred in an unknown location.
Definition: DTRStatus.h:262
Replica was queried.
Definition: DTRStatus.h:56
No error.
Definition: DTRStatus.h:216
DTRErrorStatusType GetErrorStatus() const
Returns the error type.
Definition: DTRStatus.h:289
Releasing locks and copying/linking cache files to the session dir.
Definition: DTRStatus.h:113
DTRStatus & operator=(const DTRStatusType &s)
Make a new DTRStatus with the same status as the given DTRStatusType.
Definition: DTRStatus.h:162
Prepare or stage the source and/or destination.
Definition: DTRStatus.h:68
Internal error in Data Staging logic.
Definition: DTRStatus.h:219
Making a staging or preparing request.
Definition: DTRStatus.h:71
Release of staging/preparing request completed.
Definition: DTRStatus.h:98
Cancellation request fulfilled but DTR also completed transfer successfully.
Definition: DTRStatus.h:125
DTRStatus(const DTRStatusType &status, std::string desc="")
Make new DTRStatus with given status and optional description.
Definition: DTRStatus.h:136
Cache file is locked, waiting for its release.
Definition: DTRStatus.h:35
Replica registration completed.
Definition: DTRStatus.h:107
Resolve a meta-protocol.
Definition: DTRStatus.h:41
bool operator==(const DTRStatus &s) const
Returns true if this status is the same as the given DTRStatus.
Definition: DTRStatus.h:147
DTRStatusType GetStatus() const
Get the DTRStatusType of the current state.
Definition: DTRStatus.h:181
static const std::vector< DTRStatus::DTRStatusType > ToProcessStates
Vector of states with a to be processed action, eg CHECK_CACHE.
Definition: DTRStatus.h:187
Staging/preparing request completed.
Definition: DTRStatus.h:77
bool operator==(const DTRStatusType &s) const
Returns true if this status is the same as the given DTRStatusType.
Definition: DTRStatus.h:143
Transfer rate was too slow.
Definition: DTRStatus.h:240
Error with local file.
Definition: DTRStatus.h:237
Permanent error with cache.
Definition: DTRStatus.h:228
bool operator==(const DTRErrorStatus &s) const
Returns true if this error status is the same as the given DTRErrorStatus.
Definition: DTRStatus.h:313
Waited for too long to become staging.
Definition: DTRStatus.h:243
Cache processing completed.
Definition: DTRStatus.h:116
Class representing the status of a DTR.
Definition: DTRStatus.h:16
Just created.
Definition: DTRStatus.h:26
Releasing staging/preparing request.
Definition: DTRStatus.h:95
DTRErrorStatusType
A list of error types.
Definition: DTRStatus.h:213
DataStaging contains all components for data transfer scheduling and execution.
Definition: DataDelivery.h:12
bool operator!=(const DTRErrorStatusType &s) const
Returns true if this error status is not the same as the given DTRErrorStatusType.
Definition: DTRStatus.h:318
"Stateless" DTR
Definition: DTRStatus.h:131
Permanent error with remote service.
Definition: DTRStatus.h:234
bool operator!=(const DTRErrorStatus &s) const
Returns true if this error status is not the same as the given DTRErrorStatus.
Definition: DTRStatus.h:322
Wait for the status of the staging/preparing request.
Definition: DTRStatus.h:74
static const std::vector< DTRStatus::DTRStatusType > StagedStates
Vector of states where a DTR is staged - used to limit the number of staged files.
Definition: DTRStatus.h:192
Temporary error with remote service.
Definition: DTRStatus.h:231
void SetDesc(const std::string &d)
Set the detailed description of the current state.
Definition: DTRStatus.h:171
No error.
Definition: DTRStatus.h:250
std::string GetDesc() const
Returns the error description.
Definition: DTRStatus.h:304
std::string GetDesc() const
Get the detailed description of the current state.
Definition: DTRStatus.h:176
DTRErrorStatus(DTRErrorStatusType status, DTRStatus::DTRStatusType error_state, DTRErrorLocation location, const std::string &desc="")
Create a new DTRErrorStatus with given error states.
Definition: DTRStatus.h:272
Internal processing error, like losing contact with external process.
Definition: DTRStatus.h:222
Destination is cacheable, process cache.
Definition: DTRStatus.h:110
Query a replica.
Definition: DTRStatus.h:50
The destination file has been deleted.
Definition: DTRStatus.h:65
Error with source.
Definition: DTRStatus.h:253
Transfer ready and can be started.
Definition: DTRStatus.h:80
std::string str() const
Returns a string representation of the current state.
The destination should be deleted.
Definition: DTRStatus.h:59
DTRErrorStatus()
Create a new DTRErrorStatus with default none/null error states.
Definition: DTRStatus.h:282
bool operator==(const DTRErrorStatusType &s) const
Returns true if this error status is the same as the given DTRErrorStatusType.
Definition: DTRStatus.h:309
Register a new replica of the destination.
Definition: DTRStatus.h:101
DTRErrorStatus & operator=(const DTRErrorStatusType &s)
Make a new DTRErrorStatus with the same error status as the given DTRErrorStatusType.
Definition: DTRStatus.h:327
Error with destination.
Definition: DTRStatus.h:256
DTRStatus::DTRStatusType GetLastErrorState() const
Returns the state in which the error occurred.
Definition: DTRStatus.h:294
Transfer is on-going but scheduled for cancellation.
Definition: DTRStatus.h:86
Cache check completed.
Definition: DTRStatus.h:38
Check the cache for the file may be already there.
Definition: DTRStatus.h:29
Deleting the destination.
Definition: DTRStatus.h:62
A class to represent error states reported by various components.
Definition: DTRStatus.h:208
bool operator!=(const DTRStatusType &s) const
Returns true if this status is not the same as the given DTRStatusType.
Definition: DTRStatus.h:153
Checking the cache.
Definition: DTRStatus.h:32
Transfer finished, release requests on the storage.
Definition: DTRStatus.h:92
Everything completed successfully.
Definition: DTRStatus.h:119
Registering a replica in an index service.
Definition: DTRStatus.h:104
Replica resolution completed.
Definition: DTRStatus.h:47
bool operator!=(const DTRStatus &s) const
Returns true if this status is not the same as the given DTRStatus.
Definition: DTRStatus.h:157
Attempt to replicate a file to itself.
Definition: DTRStatus.h:225
Cancellation request fulfilled successfully.
Definition: DTRStatus.h:122
Error occured.
Definition: DTRStatus.h:128
DTRErrorLocation
Describes where the error occurred.
Definition: DTRStatus.h:247
Resolving replicas.
Definition: DTRStatus.h:44
Transfer is going.
Definition: DTRStatus.h:83
DTRStatus()
Make new DTRStatus with default NEW status.
Definition: DTRStatus.h:139
Error during transfer not directly related to source or destination.
Definition: DTRStatus.h:259
DTRErrorLocation GetErrorLocation() const
Returns the location at which the error occurred.
Definition: DTRStatus.h:299
Replica is being queried.
Definition: DTRStatus.h:53
Transfer completed.
Definition: DTRStatus.h:89