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(const std::string &hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, sg_size_t num_bytes_to_transfer, S4U_CommPort *src_commport, std::shared_ptr<FileLocation> dst_location, std::shared_ptr<simgrid::fsmod::File> dst_opened_file, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, sg_size_t 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

  • dst_opened_file – an open file to write 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(const std::string &hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, sg_size_t num_bytes_to_transfer, std::shared_ptr<FileLocation> src_location, std::shared_ptr<simgrid::fsmod::File> src_opened_file, S4U_CommPort *dst_commport, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, sg_size_t 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

  • src_opened_file – a open file to read 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(const std::string &hostname, std::shared_ptr<StorageService> parent, std::shared_ptr<DataFile> file, sg_size_t num_bytes_to_transfer, std::shared_ptr<FileLocation> src_location, std::shared_ptr<simgrid::fsmod::File> src_opened_file, std::shared_ptr<FileLocation> dsg_location, std::shared_ptr<simgrid::fsmod::File> dst_opened_file, S4U_CommPort *answer_commport_if_read, S4U_CommPort *answer_commport_if_write, S4U_CommPort *answer_commport_if_copy, sg_size_t 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

  • src_opened_file – a open file to read from

  • dst_location – a location to send data to

  • dst_opened_file – a open file to write 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