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
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
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
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.
-
virtual int main() override
Main method.
- Returns:
0 on success, non-zero otherwise