wrench::FileTransferThread

class FileTransferThread : public wrench::Service

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

Public Functions

FileTransferThread(std::string hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, double num_bytes_to_transfer, S4U_CommPort *src_commport, std::shared_ptr<FileLocation> dst_location, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, double buffer_size)

Constructor.

Parameters:
  • hostname – host on which to run

  • parent – the parent storage service

  • file – the file corresponding to the connection

  • num_bytes_to_transfer – number of bytes to transfer

  • src_commport – the a source commport to receive data from

  • dst_location – a location to write data to

  • answer_commport_if_read – the commport 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_commport_if_write – the commport 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_commport_if_copy – the commport 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_size – the buffer size to use

FileTransferThread(std::string hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, double num_bytes_to_transfer, std::shared_ptr<FileLocation> src_location, S4U_CommPort *dst_commport, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, double buffer_size)

Constructor.

Parameters:
  • hostname – host on which to run

  • parent – the parent storage service

  • file – the file corresponding to the connection

  • num_bytes_to_transfer – number of bytes to transfer

  • src_location – a location to read data from

  • dst_commport – a commport to send data to

  • answer_commport_if_read – the commport 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_commport_if_write – the commport 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_commport_if_copy – the commport 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_size – the buffer size to use

FileTransferThread(std::string hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, double num_bytes_to_transfer, std::shared_ptr<FileLocation> src_location, std::shared_ptr<FileLocation> dsg_location, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, double buffer_size)

Constructor.

Parameters:
  • hostname – host on which to run

  • parent – the parent storage service

  • file – the file corresponding to the connection

  • num_bytes_to_transfer – number of bytes to transfer

  • src_location – a location to read data from

  • dst_location – a location to send data to

  • answer_commport_if_read – the commport to send an answer to in case this was a file read (nullptr if none). This will simply be reported to the parent service, who may use it as needed

  • answer_commport_if_write – the commport to send an answer to in case this was a file write (nullptr if none). This will simply be reported to the parent service, who may use it as needed

  • answer_commport_if_copy – the commport to send an answer to in case this was a file copy (nullptr if none). This will simply be reported to the parent service, who may use it as needed

  • buffer_size – the buffer size to use

virtual void cleanup(bool has_returned_from_main, int return_value) override

Cleanup method.

Parameters:
  • has_returned_from_main – whether main() returned

  • return_value – the return value (if main() returned)

virtual int main() override

Main method.

Returns:

0 on success, non-zero otherwise