Back to index

nordugrid-arc-nox  1.1.0~rc6
DataMover.h
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
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 
00023   class DataMover {
00024   private:
00025     bool be_verbose;
00026     bool force_secure;
00027     bool force_passive;
00028     bool force_registration;
00029     bool do_checks;
00030     std::string verbose_prefix;
00031     bool do_retries;
00032     unsigned long long int default_min_speed;
00033     time_t default_min_speed_time;
00034     unsigned long long int default_min_average_speed;
00035     time_t default_max_inactivity_time;
00036     DataSpeed::show_progress_t show_progress;
00037     static Logger logger;
00038   public:
00039     typedef void (*callback)(DataMover*, DataStatus, void*);
00041     DataMover();
00043     ~DataMover();
00056     DataStatus Transfer(DataPoint& source, DataPoint& destination,
00057                         FileCache& cache, const URLMap& map,
00058                         callback cb = NULL, void *arg = NULL,
00059                         const char *prefix = NULL);
00067     DataStatus Transfer(DataPoint& source, DataPoint& destination,
00068                         FileCache& cache, const URLMap& map,
00069                         unsigned long long int min_speed,
00070                         time_t min_speed_time,
00071                         unsigned long long int min_average_speed,
00072                         time_t max_inactivity_time,
00073                         callback cb = NULL, void *arg = NULL,
00074                         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     }
00123     void set_progress_indicator(DataSpeed::show_progress_t func = NULL) {
00124       show_progress = func;
00125     }
00126   };
00127 
00128 } // namespace Arc
00129 
00130 #endif // __ARC_DATAMOVER_H__