Data Transfer Request. More...
#include <DTR.h>
Public Member Functions | |
DTR () | |
DTR (const std::string &source, const std::string &destination, const Arc::UserConfig &usercfg, const std::string &jobid, const uid_t &uid, DTRLogger log) | |
~DTR () | |
operator bool () const | |
bool | operator! () const |
void | registerCallback (DTRCallback *cb, StagingProcesses owner) |
std::list< DTRCallback * > | get_callbacks (const std::map< StagingProcesses, std::list< DTRCallback * > > &proc_callback, StagingProcesses owner) |
void | reset () |
void | set_id (const std::string &id) |
std::string | get_id () const |
std::string | get_short_id () const |
Arc::DataHandle & | get_source () |
Arc::DataHandle & | get_destination () |
std::string | get_source_str () const |
std::string | get_destination_str () const |
const Arc::UserConfig & | get_usercfg () const |
void | set_timeout (time_t value) |
Arc::Time | get_timeout () const |
void | set_process_time (const Arc::Period &process_time) |
Arc::Time | get_process_time () const |
Arc::Time | get_creation_time () const |
Arc::Time | get_modification_time () const |
std::string | get_parent_job_id () const |
void | set_priority (int pri) |
int | get_priority () const |
void | set_rfc_proxy (bool rfc) |
bool | is_rfc_proxy () const |
void | set_transfer_share (const std::string &share_name) |
std::string | get_transfer_share () const |
void | set_sub_share (const std::string &share) |
std::string | get_sub_share () const |
void | set_tries_left (unsigned int tries) |
unsigned int | get_tries_left () const |
unsigned int | get_initial_tries () const |
void | decrease_tries_left () |
void | set_status (DTRStatus stat) |
DTRStatus | get_status () |
void | set_error_status (DTRErrorStatus::DTRErrorStatusType error_stat, DTRErrorStatus::DTRErrorLocation error_loc, const std::string &desc="") |
void | reset_error_status () |
DTRErrorStatus | get_error_status () |
void | set_bytes_transferred (unsigned long long int bytes) |
unsigned long long int | get_bytes_transferred () const |
void | set_cancel_request () |
bool | cancel_requested () const |
void | set_delivery_endpoint (const Arc::URL &endpoint) |
const Arc::URL & | get_delivery_endpoint () const |
void | add_problematic_delivery_service (const Arc::URL &endpoint) |
const std::vector< Arc::URL > & | get_problematic_delivery_services () const |
void | host_cert_for_remote_delivery (bool host) |
bool | host_cert_for_remote_delivery () const |
void | set_cache_file (const std::string &filename) |
std::string | get_cache_file () const |
void | set_cache_parameters (const DTRCacheParameters ¶m) |
const DTRCacheParameters & | get_cache_parameters () const |
void | set_cache_state (CacheState state) |
CacheState | get_cache_state () const |
void | set_mapped_source (const std::string &file="") |
std::string | get_mapped_source () const |
StagingProcesses | get_owner () const |
Arc::User | get_local_user () const |
void | set_replication (bool rep) |
bool | is_replication () const |
void | set_force_registration (bool force) |
bool | is_force_registration () const |
void | set_bulk_start (bool value) |
bool | get_bulk_start () const |
void | set_bulk_end (bool value) |
bool | get_bulk_end () const |
bool | bulk_possible () |
const DTRLogger & | get_logger () const |
void | connect_logger () |
void | disconnect_logger () |
bool | suspend () |
bool | error () const |
bool | is_destined_for_pre_processor () const |
bool | is_destined_for_post_processor () const |
bool | is_destined_for_delivery () const |
bool | came_from_pre_processor () const |
bool | came_from_post_processor () const |
bool | came_from_delivery () const |
bool | came_from_generator () const |
bool | is_in_final_state () const |
Static Public Member Functions | |
static void | push (DTR_ptr dtr, StagingProcesses new_owner) |
Static Public Attributes | |
static const Arc::URL | LOCAL_DELIVERY |
Data Transfer Request.
DTR stands for Data Transfer Request and a DTR describes a data transfer between two endpoints, a source and a destination. There are several parameters and options relating to the transfer contained in a DTR. The normal workflow is for a Generator to create a DTR and send it to the Scheduler for processing using dtr.push(SCHEDULER). If the Generator is a subclass of DTRCallback, when the Scheduler has finished with the DTR the receiveDTR() callback method is called.
DTRs should always be used through the ThreadedPointer DTR_ptr. This ensures proper memory management when passing DTRs among various threads. To enforce this policy the copy constructor and assignment operator are private.
registerCallback(this,DataStaging::GENERATOR) can be used to activate the callback. The following simple Generator code sample illustrates how to use DTRs:
class MyGenerator : public DTRCallback { public: void receiveDTR(DTR_ptr dtr); void run(); private: Arc::SimpleCondition cond; }; void MyGenerator::receiveDTR(DTR_ptr dtr) { // DTR received back, so notify waiting condition std::cout << "Received DTR " << dtr->get_id() << std::endl; cond.signal(); } void MyGenerator::run() { // start Scheduler thread Scheduler scheduler; scheduler.start(); // create a DTR DTR_ptr dtr(new DTR(source, destination,...)); // register this callback dtr->registerCallback(this,DataStaging::GENERATOR); // this line must be here in order to pass the DTR to the Scheduler dtr->registerCallback(&scheduler,DataStaging::SCHEDULER); // push the DTR to the Scheduler DataStaging::DTR::push(dtr, DataStaging::SCHEDULER); // wait until callback is called cond.wait(); // DTR is finished, so stop Scheduler scheduler.stop(); }
A lock protects member variables that are likely to be accessed and modified by multiple threads.
DataStaging::DTR::DTR | ( | const std::string & | source, | |
const std::string & | destination, | |||
const Arc::UserConfig & | usercfg, | |||
const std::string & | jobid, | |||
const uid_t & | uid, | |||
DTRLogger | log | |||
) |
Normal constructor.
Construct a new DTR.
source | Endpoint from which to read data | |
destination | Endpoint to which to write data | |
usercfg | Provides some user configuration information | |
jobid | ID of the job associated with this data transfer | |
uid | UID to use when accessing local file system if source or destination is a local file. If this is different to the current uid then the current uid must have sufficient privileges to change uid. | |
log | ThreadedPointer containing log object. If NULL the root logger is used. |
void DataStaging::DTR::add_problematic_delivery_service | ( | const Arc::URL & | endpoint | ) | [inline] |
Add problematic endpoint. Should only be those endpoints where there is a problem with the service itself and not the transfer.
void DataStaging::DTR::registerCallback | ( | DTRCallback * | cb, | |
StagingProcesses | owner | |||
) |
Register callback objects to be used during DTR processing.
Objects deriving from DTRCallback can be registered with this method. The callback method of these objects will then be called when the DTR is passed to the specified owner. Protected by lock.
void DataStaging::DTR::reset | ( | ) |
void DataStaging::DTR::set_error_status | ( | DTRErrorStatus::DTRErrorStatusType | error_stat, | |
DTRErrorStatus::DTRErrorLocation | error_loc, | |||
const std::string & | desc = "" | |||
) |
Set the error status.
The DTRErrorStatus last error state field is set to the current status of the DTR. Protected by lock.