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, simgrid::s4u::Mailbox *src_mailbox, std::shared_ptr<FileLocation> dst_location, simgrid::s4u::Mailbox *answer_mailbox_if_read, simgrid::s4u::Mailbox *answer_mailbox_if_write, simgrid::s4u::Mailbox *answer_mailbox_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_mailbox – the a source mailbox to receive data from

  • dst_location – a location to write data to

  • answer_mailbox_if_read – the 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_write – the 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_copy – the 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_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, simgrid::s4u::Mailbox *dst_mailbox, simgrid::s4u::Mailbox *answer_mailbox_if_read, simgrid::s4u::Mailbox *answer_mailbox_if_write, simgrid::s4u::Mailbox *answer_mailbox_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_mailbox – a mailbox to send data to

  • answer_mailbox_if_read – the 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_write – the 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_copy – the 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_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, simgrid::s4u::Mailbox *answer_mailbox_if_read, simgrid::s4u::Mailbox *answer_mailbox_if_write, simgrid::s4u::Mailbox *answer_mailbox_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_mailbox_if_read – the mailbox 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_mailbox_if_write – the mailbox 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_mailbox_if_copy – the mailbox 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