ARC SDK
Public Types | Public Member Functions
Arc::DataMover Class Reference

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...
 

Detailed Description

DataMover provides an interface to transfer data between two DataPoints.

Its main action is represented by Transfer methods.

Member Typedef Documentation

typedef void(* Arc::DataMover::callback)(DataMover *mover, DataStatus status, void *arg)

Callback function which can be passed to Transfer().

Parameters
moverthis DataMover instance
statusresult of the transfer
argarguments passed in 'arg' parameter of Transfer()

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Parameters
urlfile to delete
errcontif true then replica information will be deleted from an index service even if deleting the physical replica fails
Returns
DataStatus object with result of deletion
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.

void Arc::DataMover::set_default_max_inactivity_time ( time_t  max_inactivity_time)
inline

Set maximal allowed time for no data transfer.

For more information see description of DataSpeed class.

Parameters
max_inactivity_timemaximum time in seconds which is allowed without any data transfer
void Arc::DataMover::set_default_min_average_speed ( unsigned long long int  min_average_speed)
inline

Set minimal allowed average transfer speed.

Default is 0 averaged over whole time of transfer. For more information see description of DataSpeed class.

Parameters
min_average_speedminimum average transfer rate over the whole transfer in bytes/second
void Arc::DataMover::set_default_min_speed ( unsigned long long int  min_speed,
time_t  min_speed_time 
)
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.

Parameters
min_speedminimum transfer rate in bytes/second
min_speed_timetime in seconds over which min_speed is measured
void Arc::DataMover::set_preferred_pattern ( const std::string &  pattern)
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$"

Parameters
patternpattern on which to order replicas
void Arc::DataMover::set_progress_indicator ( DataSpeed::show_progress_t  func = NULL)
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.

Parameters
sourcesource DataPoint to read from.
destinationdestination DataPoint to write to.
cachecontrols caching of downloaded files (if destination url is "file://"). If caching is not needed default constructor FileCache() can be used.
mapURL mapping/conversion table (for 'source' URL). If URL mapping is not needed the default constructor URLMap() can be used.
cbif not NULL, transfer is done in separate thread and 'cb' is called after transfer completes/fails.
argpassed to 'cb'.
prefixif 'verbose' is activated this information will be printed before each line representing current transfer status.
Returns
DataStatus object with transfer result
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.

Parameters
sourcesource DataPoint to read from.
destinationdestination DataPoint to write to.
cachecontrols caching of downloaded files (if destination url is "file://"). If caching is not needed default constructor FileCache() can be used.
mapURL mapping/conversion table (for 'source' URL). If URL mapping is not needed the default constructor URLMap() can be used.
min_speedminimal allowed current speed.
min_speed_timetime for which speed should be less than 'min_speed' before transfer fails.
min_average_speedminimal allowed average speed.
max_inactivity_timetime for which should be no activity before transfer fails.
cbif not NULL, transfer is done in separate thread and 'cb' is called after transfer completes/fails.
argpassed to 'cb'.
prefixif 'verbose' is activated this information will be printed before each line representing current transfer status.
Returns
DataStatus object with transfer result
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.

Parameters
prefixuse this string if 'prefix' in DataMover::Transfer is NULL.

The documentation for this class was generated from the following file: