ARC SDK
|
DataMover provides an interface to transfer data between two DataPoints. More...
#include <arc/data/DataMover.h>
Public Types | |
typedef void(* | callback )(DataMover *mover, DataStatus status, void *arg) |
Callback function which can be passed to Transfer(). More... | |
Public Member Functions | |
DataMover () | |
Constructor. Sets all transfer parameters to default values. More... | |
~DataMover () | |
Destructor cancels transfer if active and waits for cancellation to finish. More... | |
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'. More... | |
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) |
Initiates transfer from 'source' to 'destination'. More... | |
DataStatus | Delete (DataPoint &url, bool errcont=false) |
Delete the file at url. More... | |
void | Cancel () |
Cancel transfer, cleaning up any data written or registered. More... | |
bool | verbose () |
Returns whether printing information about transfer status is activated. More... | |
void | verbose (bool) |
Set output of transfer status information during transfer. More... | |
void | verbose (const std::string &prefix) |
Set output of transfer status information during transfer. More... | |
bool | retry () |
Returns whether transfer will be retried in case of failure. More... | |
void | retry (bool) |
Set if transfer will be retried in case of failure. More... | |
void | secure (bool) |
Set if high level of security (encryption) will be used during transfer if available. More... | |
void | passive (bool) |
Set if passive transfer should be used for FTP-like transfers. More... | |
void | force_to_meta (bool) |
Set if file should be transferred and registered even if such LFN is already registered and source is not one of registered locations. More... | |
bool | checks () |
Returns true if extra checks are made before transfer starts. More... | |
void | checks (bool v) |
Set if extra checks are made before transfer starts. More... | |
void | set_default_min_speed (unsigned long long int min_speed, time_t min_speed_time) |
Set minimal allowed transfer speed (default is 0) to 'min_speed'. More... | |
void | set_default_min_average_speed (unsigned long long int min_average_speed) |
Set minimal allowed average transfer speed. More... | |
void | set_default_max_inactivity_time (time_t max_inactivity_time) |
Set maximal allowed time for no data transfer. More... | |
void | set_progress_indicator (DataSpeed::show_progress_t func=NULL) |
Set function which is called every second during the transfer. More... | |
void | set_preferred_pattern (const std::string &pattern) |
Set a preferred pattern for ordering of replicas. More... | |
DataMover provides an interface to transfer data between two DataPoints.
Its main action is represented by Transfer methods.
typedef void(* Arc::DataMover::callback)(DataMover *mover, DataStatus status, void *arg) |
Callback function which can be passed to Transfer().
mover | this DataMover instance |
status | result of the transfer |
arg | arguments passed in 'arg' parameter of Transfer() |
Arc::DataMover::DataMover | ( | ) |
Constructor. Sets all transfer parameters to default values.
Arc::DataMover::~DataMover | ( | ) |
Destructor cancels transfer if active and waits for cancellation to finish.
void Arc::DataMover::Cancel | ( | ) |
Cancel transfer, cleaning up any data written or registered.
bool Arc::DataMover::checks | ( | ) |
Returns true if extra checks are made before transfer starts.
void Arc::DataMover::checks | ( | bool | v | ) |
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.
DataStatus Arc::DataMover::Delete | ( | DataPoint & | url, |
bool | errcont = false |
||
) |
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.
url | file to delete |
errcont | if true then replica information will be deleted from an index service even if deleting the physical replica fails |
void Arc::DataMover::force_to_meta | ( | 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 Arc::DataMover::passive | ( | bool | ) |
Set if passive transfer should be used for FTP-like transfers.
bool Arc::DataMover::retry | ( | ) |
Returns whether transfer will be retried in case of failure.
void Arc::DataMover::retry | ( | bool | ) |
Set if transfer will be retried in case of failure.
void Arc::DataMover::secure | ( | bool | ) |
Set if high level of security (encryption) will be used during transfer if available.
|
inline |
Set maximal allowed time for no data transfer.
For more information see description of DataSpeed class.
max_inactivity_time | maximum time in seconds which is allowed without any data transfer |
|
inline |
Set minimal allowed average transfer speed.
Default is 0 averaged over whole time of transfer. For more information see description of DataSpeed class.
min_average_speed | minimum average transfer rate over the whole transfer in bytes/second |
|
inline |
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.
min_speed | minimum transfer rate in bytes/second |
min_speed_time | time in seconds over which min_speed is measured |
|
inline |
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$"
pattern | pattern on which to order replicas |
|
inline |
Set function which is called every second during the transfer.
DataStatus Arc::DataMover::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.
source | source DataPoint to read from. |
destination | destination DataPoint to write to. |
cache | controls caching of downloaded files (if destination url is "file://"). If caching is not needed default constructor FileCache() can be used. |
map | URL mapping/conversion table (for 'source' URL). If URL mapping is not needed the default constructor URLMap() can be used. |
cb | if not NULL, transfer is done in separate thread and 'cb' is called after transfer completes/fails. |
arg | passed to 'cb'. |
prefix | if 'verbose' is activated this information will be printed before each line representing current transfer status. |
DataStatus Arc::DataMover::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 |
||
) |
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.
source | source DataPoint to read from. |
destination | destination DataPoint to write to. |
cache | controls caching of downloaded files (if destination url is "file://"). If caching is not needed default constructor FileCache() can be used. |
map | URL mapping/conversion table (for 'source' URL). If URL mapping is not needed the default constructor URLMap() can be used. |
min_speed | minimal allowed current speed. |
min_speed_time | time for which speed should be less than 'min_speed' before transfer fails. |
min_average_speed | minimal allowed average speed. |
max_inactivity_time | time for which should be no activity before transfer fails. |
cb | if not NULL, transfer is done in separate thread and 'cb' is called after transfer completes/fails. |
arg | passed to 'cb'. |
prefix | if 'verbose' is activated this information will be printed before each line representing current transfer status. |
bool Arc::DataMover::verbose | ( | ) |
Returns whether printing information about transfer status is activated.
void Arc::DataMover::verbose | ( | bool | ) |
Set output of transfer status information during transfer.
void Arc::DataMover::verbose | ( | const std::string & | prefix | ) |
Set output of transfer status information during transfer.
prefix | use this string if 'prefix' in DataMover::Transfer is NULL. |