00001
00002
00003 #ifndef __ARC_DATAMOVER_H__
00004 #define __ARC_DATAMOVER_H__
00005
00006 #include <list>
00007 #include <string>
00008
00009 #include <arc/data/FileCache.h>
00010 #include <arc/data/DataPoint.h>
00011 #include <arc/data/DataSpeed.h>
00012 #include <arc/data/DataStatus.h>
00013
00014 namespace Arc {
00015
00016 class Logger;
00017 class URLMap;
00018
00020
00021 class DataMover {
00022 private:
00023 bool be_verbose;
00024 bool force_secure;
00025 bool force_passive;
00026 bool force_registration;
00027 bool do_checks;
00028 std::string verbose_prefix;
00029 bool do_retries;
00030 unsigned long long int default_min_speed;
00031 time_t default_min_speed_time;
00032 unsigned long long int default_min_average_speed;
00033 time_t default_max_inactivity_time;
00034 DataSpeed::show_progress_t show_progress;
00035 std::string preferred_pattern;
00036 static Logger logger;
00037 public:
00038 typedef void (*callback)(DataMover*, DataStatus, void*);
00040 DataMover();
00042 ~DataMover();
00055 DataStatus Transfer(DataPoint& source, DataPoint& destination,
00056 FileCache& cache, const URLMap& map,
00057 callback cb = NULL, void *arg = NULL,
00058 const char *prefix = NULL);
00066 DataStatus Transfer(DataPoint& source, DataPoint& destination,
00067 FileCache& cache, const URLMap& map,
00068 unsigned long long int min_speed,
00069 time_t min_speed_time,
00070 unsigned long long int min_average_speed,
00071 time_t max_inactivity_time,
00072 callback cb = NULL, void *arg = NULL,
00073 const char *prefix = NULL);
00075 DataStatus Delete(DataPoint& url, bool errcont = false);
00077 bool verbose();
00079 void verbose(bool);
00083 void verbose(const std::string& prefix);
00085 bool retry();
00087 void retry(bool);
00090 void secure(bool);
00092 void passive(bool);
00095 void force_to_meta(bool);
00098 bool checks();
00102 void checks(bool v);
00106 void set_default_min_speed(unsigned long long int min_speed,
00107 time_t min_speed_time) {
00108 default_min_speed = min_speed;
00109 default_min_speed_time = min_speed_time;
00110 }
00114 void set_default_min_average_speed(unsigned long long int
00115 min_average_speed) {
00116 default_min_average_speed = min_average_speed;
00117 }
00120 void set_default_max_inactivity_time(time_t max_inactivity_time) {
00121 default_max_inactivity_time = max_inactivity_time;
00122 }
00124 void set_progress_indicator(DataSpeed::show_progress_t func = NULL) {
00125 show_progress = func;
00126 }
00128 void set_preferred_pattern(const std::string& pattern) {
00129 preferred_pattern = pattern;
00130 }
00131 };
00132
00133 }
00134
00135 #endif // __ARC_DATAMOVER_H__