/usr/include/arc/data/DataMover.h is in nordugrid-arc-dev 5.0.5-1ubuntu1.
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 | // -*- indent-tabs-mode: nil -*-
#ifndef __ARC_DATAMOVER_H__
#define __ARC_DATAMOVER_H__
#include <list>
#include <string>
#include <arc/data/FileCache.h>
#include <arc/data/DataPoint.h>
#include <arc/data/DataSpeed.h>
#include <arc/data/DataStatus.h>
namespace Arc {
class Logger;
class URLMap;
/// DataMover provides an interface to transfer data between two DataPoints.
/**
* Its main action is represented by Transfer methods.
* \ingroup data
* \headerfile DataMover.h arc/data/DataMover.h
*/
class DataMover {
private:
bool be_verbose;
bool force_secure;
bool force_passive;
bool force_registration;
bool do_checks;
std::string verbose_prefix;
bool do_retries;
unsigned long long int default_min_speed;
time_t default_min_speed_time;
unsigned long long int default_min_average_speed;
time_t default_max_inactivity_time;
DataSpeed::show_progress_t show_progress;
std::string preferred_pattern;
bool cancelled;
/// For safe destruction of object, Transfer() holds this lock and
/// destructor waits until the lock can be obtained
Glib::Mutex lock_;
static Logger logger;
public:
/// Callback function which can be passed to Transfer().
/**
* \param mover this DataMover instance
* @param status result of the transfer
* @param arg arguments passed in 'arg' parameter of Transfer()
*/
typedef void (*callback)(DataMover* mover, DataStatus status, void* arg);
/// Constructor. Sets all transfer parameters to default values.
DataMover();
/// Destructor cancels transfer if active and waits for cancellation to finish.
~DataMover();
/// Initiates transfer from 'source' to 'destination'.
/**
* An optional callback can be provided, in which case this method starts
* a separate thread for the transfer and returns immediately. The callback
* is called after the transfer finishes.
* \param source source DataPoint to read from.
* \param destination destination DataPoint to write to.
* \param cache controls caching of downloaded files (if destination
* url is "file://"). If caching is not needed default constructor
* FileCache() can be used.
* \param map URL mapping/conversion table (for 'source' URL). If URL
* mapping is not needed the default constructor URLMap() can be used.
* \param cb if not NULL, transfer is done in separate thread and 'cb'
* is called after transfer completes/fails.
* \param arg passed to 'cb'.
* \param prefix if 'verbose' is activated this information will be
* printed before each line representing current transfer status.
* \return DataStatus object with transfer result
*/
DataStatus Transfer(DataPoint& source, DataPoint& destination,
FileCache& cache, const URLMap& map,
callback cb = NULL, void *arg = NULL,
const char *prefix = NULL);
/// Initiates transfer from 'source' to 'destination'.
/**
* An optional callback can be provided, in which case this method starts
* a separate thread for the transfer and returns immediately. The callback
* is called after the transfer finishes.
* \param source source DataPoint to read from.
* \param destination destination DataPoint to write to.
* \param cache controls caching of downloaded files (if destination
* url is "file://"). If caching is not needed default constructor
* FileCache() can be used.
* \param map URL mapping/conversion table (for 'source' URL). If URL
* mapping is not needed the default constructor URLMap() can be used.
* \param min_speed minimal allowed current speed.
* \param min_speed_time time for which speed should be less than
* 'min_speed' before transfer fails.
* \param min_average_speed minimal allowed average speed.
* \param max_inactivity_time time for which should be no activity
* before transfer fails.
* \param cb if not NULL, transfer is done in separate thread and 'cb'
* is called after transfer completes/fails.
* \param arg passed to 'cb'.
* \param prefix if 'verbose' is activated this information will be
* printed before each line representing current transfer status.
* \return DataStatus object with transfer result
*/
DataStatus Transfer(DataPoint& source, DataPoint& destination,
FileCache& cache, const URLMap& map,
unsigned long long int min_speed,
time_t min_speed_time,
unsigned long long int min_average_speed,
time_t max_inactivity_time,
callback cb = NULL, void *arg = NULL,
const char *prefix = NULL);
/// Delete the file at url.
/**
* This method differs from DataPoint::Remove() in that for index services,
* it deletes all replicas in addition to removing the index entry.
* @param url file to delete
* @param errcont if true then replica information will be deleted from an
* index service even if deleting the physical replica fails
* @return DataStatus object with result of deletion
*/
DataStatus Delete(DataPoint& url, bool errcont = false);
/// Cancel transfer, cleaning up any data written or registered.
void Cancel();
/// Returns whether printing information about transfer status is activated.
bool verbose();
/// Set output of transfer status information during transfer.
void verbose(bool);
/// Set output of transfer status information during transfer.
/**
* \param prefix use this string if 'prefix' in DataMover::Transfer is NULL.
*/
void verbose(const std::string& prefix);
/// Returns whether transfer will be retried in case of failure.
bool retry();
/// Set if transfer will be retried in case of failure.
void retry(bool);
/// Set if high level of security (encryption) will be used during transfer if available.
void secure(bool);
/// Set if passive transfer should be used for FTP-like transfers.
void passive(bool);
/// Set if file should be transferred and registered even if such LFN is already registered and source is not one of registered locations.
void force_to_meta(bool);
/// Returns true if extra checks are made before transfer starts.
bool checks();
/// Set if extra checks are made before transfer starts.
/**
* If turned on, extra checks are done before commencing the transfer, such
* as checking the existence of the source file and verifying consistency
* of metadata between index service and physical replica.
*/
void checks(bool v);
/// Set minimal allowed transfer speed (default is 0) to 'min_speed'.
/**
* If speed drops below for time longer than 'min_speed_time', error
* is raised. For more information see description of DataSpeed class.
* \param min_speed minimum transfer rate in bytes/second
* \param min_speed_time time in seconds over which min_speed is measured
*/
void set_default_min_speed(unsigned long long int min_speed,
time_t min_speed_time) {
default_min_speed = min_speed;
default_min_speed_time = min_speed_time;
}
/// Set minimal allowed average transfer speed.
/**
* Default is 0 averaged over whole time of transfer. For more information
* see description of DataSpeed class.
* \param min_average_speed minimum average transfer rate over the whole
* transfer in bytes/second
*/
void set_default_min_average_speed(unsigned long long int min_average_speed) {
default_min_average_speed = min_average_speed;
}
/// Set maximal allowed time for no data transfer.
/**
* For more information see description of DataSpeed class.
* \param max_inactivity_time maximum time in seconds which is allowed
* without any data transfer
*/
void set_default_max_inactivity_time(time_t max_inactivity_time) {
default_max_inactivity_time = max_inactivity_time;
}
/// Set function which is called every second during the transfer
void set_progress_indicator(DataSpeed::show_progress_t func = NULL) {
show_progress = func;
}
/// Set a preferred pattern for ordering of replicas.
/**
* This pattern will be used in the case of an index service URL with
* multiple physical replicas and allows sorting of those replicas in order
* of preference. It consists of one or more patterns separated by a pipe
* character (|) listed in order of preference. If the dollar character ($)
* is used at the end of a pattern, the pattern will be matched to the end
* of the hostname of the replica. Example: "srm://myhost.org|.uk$|.ch$"
* \param pattern pattern on which to order replicas
*/
void set_preferred_pattern(const std::string& pattern) {
preferred_pattern = pattern;
}
};
} // namespace Arc
#endif // __ARC_DATAMOVER_H__
|