ARC SDK
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
DataStaging::DataDeliveryComm Class Referenceabstract

This class provides an abstract interface for the Delivery layer. More...

#include <arc/data-staging/DataDeliveryComm.h>

Inheritance diagram for DataStaging::DataDeliveryComm:
DataStaging::DataDeliveryLocalComm DataStaging::DataDeliveryRemoteComm

Data Structures

struct  Status
 Plain C struct to pass information from executing process back to main thread. More...
 

Public Types

enum  CommStatusType {
  CommInit, CommNoError, CommTimeout, CommClosed,
  CommExited, CommFailed
}
 Communication status with transfer. More...
 

Public Member Functions

virtual ~DataDeliveryComm ()
 Destroy object. This stops any ongoing transfer and cleans up resources. More...
 
Status GetStatus () const
 Obtain status of transfer. More...
 
std::string GetError () const
 Get explanation of error. More...
 
virtual operator bool () const =0
 Returns true if transfer is currently active. More...
 
virtual bool operator! () const =0
 Returns true if transfer is currently not active. More...
 

Static Public Member Functions

static DataDeliveryCommCreateInstance (DTR_ptr dtr, const TransferParameters &params)
 Factory method to get DataDeliveryComm instance. More...
 
static bool CheckComm (DTR_ptr dtr, std::vector< std::string > &allowed_dirs, std::string &load_avg)
 Check the delivery method is available. Calls CheckComm of the appropriate subclass. More...
 

Protected Member Functions

virtual void PullStatus ()=0
 Check for new state and fill state accordingly. More...
 
 DataDeliveryComm (DTR_ptr dtr, const TransferParameters &params)
 Start transfer with parameters taken from DTR and supplied transfer limits. More...
 

Protected Attributes

Status status_
 Current status of transfer. More...
 
Status status_buf_
 Latest status of transfer is read into this buffer. More...
 
unsigned int status_pos_
 Reading position of Status buffer. More...
 
Glib::Mutex lock_
 Lock to protect access to status. More...
 
DataDeliveryCommHandlerhandler_
 Pointer to singleton handler of all DataDeliveryComm objects. More...
 
TransferParameters transfer_params
 Transfer limits. More...
 
Arc::Time start_
 Time transfer was started. More...
 
DTRLogger logger_
 Logger object. Pointer to DTR's Logger. More...
 

Friends

class DataDeliveryCommHandler
 

Detailed Description

This class provides an abstract interface for the Delivery layer.

Different implementations provide different ways of providing Delivery functionality. DataDeliveryLocalComm launches a local process to perform the transfer and DataDeliveryRemoteComm contacts a remote service which performs the transfer. The implementation is chosen depending on what is set in the DTR, which the Scheduler should set based on various factors.

CreateInstance() should be used to get a pointer to the instantiated object. This also starts the transfer. Deleting this object stops the transfer and cleans up any used resources. A singleton instance of DataDeliveryCommHandler regularly polls all active transfers using PullStatus() and fills the Status object with current information, which can be obtained through GetStatus().

Member Enumeration Documentation

◆ CommStatusType

Communication status with transfer.

Enumerator
CommInit 

Initializing/starting transfer, rest of information not valid.

CommNoError 

Communication going on smoothly.

CommTimeout 

Communication experienced timeout.

CommClosed 

Communication channel was closed.

CommExited 

Transfer exited. Mostly same as CommClosed but exit detected before pipe closed.

CommFailed 

Transfer failed. If we have CommFailed and no error code reported that normally means segfault or external kill.

Constructor & Destructor Documentation

◆ DataDeliveryComm()

DataStaging::DataDeliveryComm::DataDeliveryComm ( DTR_ptr  dtr,
const TransferParameters params 
)
protected

Start transfer with parameters taken from DTR and supplied transfer limits.

Constructor should not be used directly, CreateInstance() should be used instead.

◆ ~DataDeliveryComm()

virtual DataStaging::DataDeliveryComm::~DataDeliveryComm ( )
inlinevirtual

Destroy object. This stops any ongoing transfer and cleans up resources.

Member Function Documentation

◆ CheckComm()

static bool DataStaging::DataDeliveryComm::CheckComm ( DTR_ptr  dtr,
std::vector< std::string > &  allowed_dirs,
std::string &  load_avg 
)
static

Check the delivery method is available. Calls CheckComm of the appropriate subclass.

Parameters
dtrDTR from which credentials are used
allowed_dirsfilled with list of dirs that this comm is allowed to read/write
load_avgfilled with the load average reported by the service
Returns
true if selected delivery method is available

◆ CreateInstance()

static DataDeliveryComm* DataStaging::DataDeliveryComm::CreateInstance ( DTR_ptr  dtr,
const TransferParameters params 
)
static

Factory method to get DataDeliveryComm instance.

◆ GetError()

std::string DataStaging::DataDeliveryComm::GetError ( ) const
inline

Get explanation of error.

◆ GetStatus()

Status DataStaging::DataDeliveryComm::GetStatus ( ) const

Obtain status of transfer.

◆ operator bool()

virtual DataStaging::DataDeliveryComm::operator bool ( ) const
pure virtual

Returns true if transfer is currently active.

Implemented in DataStaging::DataDeliveryRemoteComm, and DataStaging::DataDeliveryLocalComm.

◆ operator!()

virtual bool DataStaging::DataDeliveryComm::operator! ( ) const
pure virtual

Returns true if transfer is currently not active.

Implemented in DataStaging::DataDeliveryRemoteComm, and DataStaging::DataDeliveryLocalComm.

◆ PullStatus()

virtual void DataStaging::DataDeliveryComm::PullStatus ( )
protectedpure virtual

Check for new state and fill state accordingly.

This method is periodically called by the comm handler to obtain status info. It detects communication and delivery failures and delivery termination.

Implemented in DataStaging::DataDeliveryRemoteComm, and DataStaging::DataDeliveryLocalComm.

Field Documentation

◆ handler_

DataDeliveryCommHandler* DataStaging::DataDeliveryComm::handler_
protected

Pointer to singleton handler of all DataDeliveryComm objects.

◆ lock_

Glib::Mutex DataStaging::DataDeliveryComm::lock_
protected

Lock to protect access to status.

◆ logger_

DTRLogger DataStaging::DataDeliveryComm::logger_
protected

Logger object. Pointer to DTR's Logger.

◆ start_

Arc::Time DataStaging::DataDeliveryComm::start_
protected

Time transfer was started.

◆ status_

Status DataStaging::DataDeliveryComm::status_
protected

Current status of transfer.

◆ status_buf_

Status DataStaging::DataDeliveryComm::status_buf_
protected

Latest status of transfer is read into this buffer.

◆ status_pos_

unsigned int DataStaging::DataDeliveryComm::status_pos_
protected

Reading position of Status buffer.

◆ transfer_params

TransferParameters DataStaging::DataDeliveryComm::transfer_params
protected

Transfer limits.


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