Represents a single data transfer from one url to another. More...
#include <filetransfer.h>
Signals | |
void | onProgress (FileTransfer *fileTransfer, unsigned long long bytesTransferred, unsigned long long bytesTotal) |
Signal for updating transfer status. | |
void | onCompleted (FileTransfer *fileTransfer, bool success, QString error) |
Public Member Functions | |
FileTransfer (const std::string &source_str, const std::string &destination_str, Arc::UserConfig &usercfg) | |
Create a file transfer object. | |
TTransferState | transferState () |
Return the current transfer state. | |
bool | execute () |
Start the actual file transfer. | |
void | wait () |
Wait for the file transfer to complete. | |
Arc::DataStatus | status () |
Return the ARC transfer status. | |
void | completed (Arc::DataStatus res, std::string error) |
Routine called by the ARC callbacks to indicate a failed/completed file transfer. | |
void | cancel () |
Cancel the transfer. | |
bool | isCompleted () |
Returns true if transfer is completed. | |
QString | id () |
Return current transfer id. | |
QString | sourceUrl () |
Return source URL. | |
QString | destUrl () |
Return destination URL. | |
void | updateTransferStatus (unsigned long transferred, unsigned long totalSize) |
Updated the current transfer statistics. | |
void | getTransferStatus (unsigned long &transferred, unsigned long &totalSize) |
Return current transfer statistics. |
Represents a single data transfer from one url to another.
FileTransfer::FileTransfer | ( | const std::string & | source_str, | |
const std::string & | destination_str, | |||
Arc::UserConfig & | usercfg | |||
) |
Create a file transfer object.
Creates a file transfer object used for handling a file transfer using the ARC API:s. The transfer object is by default idle and will not start any transfers until the execute method is called.
source_str | is the source URL of a file to be transferred. | |
destination_str | is the destination URL of the file to transferred. | |
usercfg | is the current ARC configuration object. |
void FileTransfer::cancel | ( | ) |
Cancel the transfer.
Currently only destroys the ARC data mover object. Graceful cancellation is currently not supported due to restrictions in the ARC API.
void FileTransfer::completed | ( | Arc::DataStatus | res, | |
std::string | error | |||
) |
Routine called by the ARC callbacks to indicate a failed/completed file transfer.
This routine should not be called directly. It is public so that the static callback can access the routine.
void FileTransfer::onProgress | ( | FileTransfer * | fileTransfer, | |
unsigned long long | bytesTransferred, | |||
unsigned long long | bytesTotal | |||
) | [signal] |
Signal for updating transfer status.
This signal is called whenever the ARC callback is called to convey the current transfer statistics on the ongoing file transfer.
fileTransfer | file transfer object that initiated the signal. | |
bytesTransferred | currently transfers bytes | |
bytesTotal | total of bytes to be transferred. |
void FileTransfer::updateTransferStatus | ( | unsigned long | transferred, | |
unsigned long | totalSize | |||
) |
Updated the current transfer statistics.
This routine should not be called directly. It is public so that the static callback can accces the routine.