wrench::FileTransferThread Class Reference

A helper class that implements the concept of a communication thread that performs a file transfer. More...

#include <FileTransferThread.h>

Inheritance diagram for wrench::FileTransferThread:
wrench::Service

Public Member Functions

 FileTransferThread (std::string hostname, std::shared_ptr< StorageService > parent, WorkflowFile *file, std::string src_mailbox, std::shared_ptr< FileLocation > dst_location, std::string answer_mailbox_if_read, std::string answer_mailbox_if_write, std::string answer_mailbox_if_copy, unsigned long buffer_size, SimulationTimestampFileCopyStart *start_timestamp=nullptr)
 Constructor. More...
 
 FileTransferThread (std::string hostname, std::shared_ptr< StorageService > parent, WorkflowFile *file, std::shared_ptr< FileLocation > src_location, std::string dst_mailbox, std::string answer_mailbox_if_read, std::string answer_mailbox_if_write, std::string answer_mailbox_if_copy, unsigned long buffer_size, SimulationTimestampFileCopyStart *start_timestamp=nullptr)
 Constructor. More...
 
 FileTransferThread (std::string hostname, std::shared_ptr< StorageService > parent, WorkflowFile *file, std::shared_ptr< FileLocation > src_location, std::shared_ptr< FileLocation > dsg_location, std::string answer_mailbox_if_read, std::string answer_mailbox_if_write, std::string answer_mailbox_if_copy, unsigned long buffer_size, SimulationTimestampFileCopyStart *start_timestamp=nullptr)
 Constructor. More...
 
void cleanup (bool has_returned_from_main, int return_value) override
 Cleanup method. More...
 
int main () override
 Main method. More...
 
- Public Member Functions inherited from wrench::Service
void assertServiceIsUp ()
 Throws an exception if the service is not up. More...
 
std::string getHostname ()
 Get the name of the host on which the service is / will be running. More...
 
double getNetworkTimeoutValue ()
 Returns the service's network timeout value. More...
 
bool getPropertyValueAsBoolean (std::string)
 Get a property of the Service as a boolean. More...
 
double getPropertyValueAsDouble (std::string)
 Get a property of the Service as a double. More...
 
std::string getPropertyValueAsString (std::string)
 Get a property of the Service as a string. More...
 
unsigned long getPropertyValueAsUnsignedLong (std::string)
 Get a property of the Service as an unsigned long. More...
 
bool isUp ()
 Returns true if the service is UP, false otherwise. More...
 
void resume ()
 Resume the service. More...
 
void setNetworkTimeoutValue (double value)
 Sets the service's network timeout value. More...
 
void start (std::shared_ptr< Service > this_service, bool daemonize, bool auto_restart)
 Start the service. More...
 
virtual void stop ()
 Synchronously stop the service (does nothing if the service is already stopped) More...
 
void suspend ()
 Suspend the service.
 

Detailed Description

A helper class that implements the concept of a communication thread that performs a file transfer.

Constructor & Destructor Documentation

◆ FileTransferThread() [1/3]

wrench::FileTransferThread::FileTransferThread ( std::string  hostname,
std::shared_ptr< StorageService parent,
WorkflowFile file,
std::string  src_mailbox,
std::shared_ptr< FileLocation dst_location,
std::string  answer_mailbox_if_read,
std::string  answer_mailbox_if_write,
std::string  answer_mailbox_if_copy,
unsigned long  buffer_size,
SimulationTimestampFileCopyStart start_timestamp = nullptr 
)

Constructor.

Parameters
hostnamehost on which to run
parentthe parent storage service
filethe file corresponding to the connection
src_mailboxthe a source mailbox to receive data from
dst_locationa location to write data to
answer_mailbox_if_readthe mailbox to send an answer to in case this was a file read ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_writethe mailbox to send an answer to in case this was a file write ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_copythe mailbox to send an answer to in case this was a file copy ("" if none). This will simply be reported to the parent service, who may use it as needed
buffer_sizethe buffer size to use
start_timestampif this is a file copy, a start timestamp associated with it

◆ FileTransferThread() [2/3]

wrench::FileTransferThread::FileTransferThread ( std::string  hostname,
std::shared_ptr< StorageService parent,
WorkflowFile file,
std::shared_ptr< FileLocation src_location,
std::string  dst_mailbox,
std::string  answer_mailbox_if_read,
std::string  answer_mailbox_if_write,
std::string  answer_mailbox_if_copy,
unsigned long  buffer_size,
SimulationTimestampFileCopyStart start_timestamp = nullptr 
)

Constructor.

Parameters
hostnamehost on which to run
parentthe parent storage service
filethe file corresponding to the connection
src_locationa location to read data from
dst_mailboxa mailbox to send data to
answer_mailbox_if_readthe mailbox to send an answer to in case this was a file read ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_writethe mailbox to send an answer to in case this was a file write ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_copythe mailbox to send an answer to in case this was a file copy ("" if none). This will simply be reported to the parent service, who may use it as needed
buffer_sizethe buffer size to use
start_timestampif this is a file copy, a start timestamp associated with it

◆ FileTransferThread() [3/3]

wrench::FileTransferThread::FileTransferThread ( std::string  hostname,
std::shared_ptr< StorageService parent,
WorkflowFile file,
std::shared_ptr< FileLocation src_location,
std::shared_ptr< FileLocation dst_location,
std::string  answer_mailbox_if_read,
std::string  answer_mailbox_if_write,
std::string  answer_mailbox_if_copy,
unsigned long  buffer_size,
SimulationTimestampFileCopyStart start_timestamp = nullptr 
)

Constructor.

Parameters
hostnamehost on which to run
parentthe parent storage service
filethe file corresponding to the connection
src_locationa location to read data from
dst_locationa location to send data to
answer_mailbox_if_readthe mailbox to send an answer to in case this was a file read ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_writethe mailbox to send an answer to in case this was a file write ("" if none). This will simply be reported to the parent service, who may use it as needed
answer_mailbox_if_copythe mailbox to send an answer to in case this was a file copy ("" if none). This will simply be reported to the parent service, who may use it as needed
buffer_sizethe buffer size to use
start_timestampif this is a file copy, a start timestamp associated with it

Member Function Documentation

◆ cleanup()

void wrench::FileTransferThread::cleanup ( bool  has_returned_from_main,
int  return_value 
)
override

Cleanup method.

Parameters
has_returned_from_mainwhether main() returned
return_valuethe return value (if main() returned)

◆ main()

int wrench::FileTransferThread::main ( )
override

Main method.

Returns
0 on success, non-zero otherwise

Sending a local file to the network

Receiving a file from the network

Copying a file local file

Downloading a file from another storage service


The documentation for this class was generated from the following files:
  • /home/wrench/wrench/include/wrench/services/storage/storage_helpers/FileTransferThread.h
  • /home/wrench/wrench/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp