/usr/include/arc/data-staging/DTRStatus.h is in nordugrid-arc-dev 4.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | // -*- indent-tabs-mode: nil -*-
#ifndef __ARC_DTRSTATUS_H__
#define __ARC_DTRSTATUS_H__
#include <string>
#include <vector>
namespace DataStaging {
/// Class representing the status of a DTR.
/**
* \ingroup datastaging
* \headerfile DTRStatus.h arc/data-staging/DTRStatus.h
*/
class DTRStatus {
public:
/// Possible state values
enum DTRStatusType {
// ORDER IS IMPORTANT!!
/// Just created
NEW,
/// Check the cache for the file may be already there
CHECK_CACHE,
/// Checking the cache
CHECKING_CACHE,
/// Cache file is locked, waiting for its release
CACHE_WAIT,
/// Cache check completed
CACHE_CHECKED,
/// Resolve a meta-protocol
RESOLVE,
/// Resolving replicas
RESOLVING,
/// Replica resolution completed
RESOLVED,
/// Query a replica
QUERY_REPLICA,
/// Replica is being queried
QUERYING_REPLICA,
/// Replica was queried
REPLICA_QUERIED,
/// The destination should be deleted
PRE_CLEAN,
/// Deleting the destination
PRE_CLEANING,
/// The destination file has been deleted
PRE_CLEANED,
/// Prepare or stage the source and/or destination
STAGE_PREPARE,
/// Making a staging or preparing request
STAGING_PREPARING,
/// Wait for the status of the staging/preparing request
STAGING_PREPARING_WAIT,
/// Staging/preparing request completed
STAGED_PREPARED,
/// Transfer ready and can be started
TRANSFER,
/// Transfer is going
TRANSFERRING,
/// Transfer is on-going but scheduled for cancellation
TRANSFERRING_CANCEL,
/// Transfer completed
TRANSFERRED,
/// Transfer finished, release requests on the storage
RELEASE_REQUEST,
/// Releasing staging/preparing request
RELEASING_REQUEST,
/// Release of staging/preparing request completed
REQUEST_RELEASED,
/// Register a new replica of the destination
REGISTER_REPLICA,
/// Registering a replica in an index service
REGISTERING_REPLICA,
/// Replica registration completed
REPLICA_REGISTERED,
/// Destination is cacheable, process cache
PROCESS_CACHE,
/// Releasing locks and copying/linking cache files to the session dir
PROCESSING_CACHE,
/// Cache processing completed
CACHE_PROCESSED,
/// Everything completed successfully
DONE,
/// Cancellation request fulfilled successfully
CANCELLED,
/// Cancellation request fulfilled but DTR also completed transfer successfully
CANCELLED_FINISHED,
/// Error occured
ERROR,
/// "Stateless" DTR
NULL_STATE
};
/// Make new DTRStatus with given status and optional description.
DTRStatus(const DTRStatusType& status, std::string desc="")
: status(status), desc(desc) {}
/// Make new DTRStatus with default NEW status
DTRStatus()
: status(NEW), desc ("") {}
/// Returns true if this status is the same as the given DTRStatusType
bool operator==(const DTRStatusType& s) const {
return status == s;
}
/// Returns true if this status is the same as the given DTRStatus
bool operator==(const DTRStatus& s) const {
return status == s.status;
}
/// Returns true if this status is not the same as the given DTRStatusType
bool operator!=(const DTRStatusType& s) const {
return status != s;
}
/// Returns true if this status is not the same as the given DTRStatus
bool operator!=(const DTRStatus& s) const {
return status != s.status;
}
/// Make a new DTRStatus with the same status as the given DTRStatusType
DTRStatus& operator=(const DTRStatusType& s) {
status = s;
return *this;
}
/// Returns a string representation of the current state
std::string str() const;
/// Set the detailed description of the current state
void SetDesc(const std::string& d) {
desc = d;
}
/// Get the detailed description of the current state
std::string GetDesc() const {
return desc;
}
/// Get the DTRStatusType of the current state
DTRStatusType GetStatus() const {
return status;
}
// The actions in the following two vectors must match
/// Vector of states with a to be processed action, eg CHECK_CACHE
static const std::vector<DTRStatus::DTRStatusType> ToProcessStates;
/// Vector of states with a processing action, eg CHECKING_CACHE
static const std::vector<DTRStatus::DTRStatusType> ProcessingStates;
/// Vector of states where a DTR is staged - used to limit the number of staged files
static const std::vector<DTRStatus::DTRStatusType> StagedStates;
private:
/// status code
DTRStatusType status;
/// description set by the owner process
std::string desc;
}; // DTRStatus
/// A class to represent error states reported by various components.
/**
* \ingroup datastaging
* \headerfile DTRStatus.h arc/data-staging/DTRStatus.h
*/
class DTRErrorStatus {
public:
/// A list of error types
enum DTRErrorStatusType {
/// No error
NONE_ERROR,
/// Internal error in Data Staging logic
INTERNAL_LOGIC_ERROR,
/// Internal processing error, like losing contact with external process
INTERNAL_PROCESS_ERROR,
/// Attempt to replicate a file to itself
SELF_REPLICATION_ERROR,
/// Permanent error with cache
CACHE_ERROR,
/// Temporary error with remote service
TEMPORARY_REMOTE_ERROR,
/// Permanent error with remote service
PERMANENT_REMOTE_ERROR,
/// Error with local file
LOCAL_FILE_ERROR,
/// Transfer rate was too slow
TRANSFER_SPEED_ERROR,
/// Waited for too long to become staging
STAGING_TIMEOUT_ERROR
};
/// Describes where the error occurred
enum DTRErrorLocation {
/// No error
NO_ERROR_LOCATION,
/// Error with source
ERROR_SOURCE,
/// Error with destination
ERROR_DESTINATION,
/// Error during transfer not directly related to source or destination
ERROR_TRANSFER,
/// Error occurred in an unknown location
ERROR_UNKNOWN
};
/// Create a new DTRErrorStatus with given error states
/**
* @param status Type of error
* @param error_state DTR state in which the error occurred
* @param location Location of error (at source, destination or during transfer)
* @param desc Text description of error
*/
DTRErrorStatus(DTRErrorStatusType status,
DTRStatus::DTRStatusType error_state,
DTRErrorLocation location,
const std::string& desc = ""):
error_status(status),
last_error_state(error_state),
error_location(location),
desc(desc) {};
/// Create a new DTRErrorStatus with default none/null error states
DTRErrorStatus() :
error_status(NONE_ERROR),
last_error_state(DTRStatus::NULL_STATE),
error_location(NO_ERROR_LOCATION),
desc("") {};
/// Returns the error type
DTRErrorStatusType GetErrorStatus() const {
return error_status;
}
/// Returns the state in which the error occurred
DTRStatus::DTRStatusType GetLastErrorState() const {
return last_error_state.GetStatus();
}
/// Returns the location at which the error occurred
DTRErrorLocation GetErrorLocation() const {
return error_location;
}
/// Returns the error description
std::string GetDesc() const {
return desc;
}
/// Returns true if this error status is the same as the given DTRErrorStatusType
bool operator==(const DTRErrorStatusType& s) const {
return error_status == s;
}
/// Returns true if this error status is the same as the given DTRErrorStatus
bool operator==(const DTRErrorStatus& s) const {
return error_status == s.error_status;
}
/// Returns true if this error status is not the same as the given DTRErrorStatusType
bool operator!=(const DTRErrorStatusType& s) const {
return error_status != s;
}
/// Returns true if this error status is not the same as the given DTRErrorStatus
bool operator!=(const DTRErrorStatus& s) const {
return error_status != s.error_status;
}
/// Make a new DTRErrorStatus with the same error status as the given DTRErrorStatusType
DTRErrorStatus& operator=(const DTRErrorStatusType& s) {
error_status = s;
return *this;
}
private:
/// error state
DTRErrorStatusType error_status;
/// state that error occurred in
DTRStatus last_error_state;
/// place where the error occurred
DTRErrorLocation error_location;
/// description of error
std::string desc;
};
} // namespace DataStaging
#endif /*__ARC_DTRSTATUS_H_*/
|