|
mcloud
1.0.0
MCloud API library for cmcc cloud service
|
Task is an abstract class that defines common interfaces for upload and download task. More...
#include <task.h>
Inheritance diagram for mcloud::api::Task:
Collaboration diagram for mcloud::api::Task:Public Types | |
| enum | Status { Status::Unstart, Status::Running, Status::Canceled, Status::Paused, Status::Broken, Status::Complete } |
| The Status enum indicates current status of this task. More... | |
| typedef std::function< void(float)> | ProgressHandler |
| typedef std::function< void(Status)> | StatusHandler |
| typedef std::function< size_t(void *dest, size_t buf_size)> | Buffer_Callback |
Public Member Functions | |
| virtual | ~Task ()=default |
| virtual const std::string & | task_id () const =0 |
| Returns an unique id of task. More... | |
| virtual const std::string & | content_id () const =0 |
| Returns an unique id of cloud content on mcloud. More... | |
| virtual const std::string & | content_name () const =0 |
| Returns a display name of cloud content on mcloud. More... | |
| virtual const std::string & | file_path () const =0 |
| Returns cloud content local storage file path. More... | |
| virtual const std::string & | error_string () const =0 |
| Contains the error string if an error occurs during task running. More... | |
| virtual const std::string & | task_url () const =0 |
| Returns a item url assigned by mcloud. More... | |
| virtual Task::Status | status () const =0 |
| Returns current download or upload item sync-up status. More... | |
| virtual Task::ProgressHandler & | progress_changed ()=0 |
| Handler for download or upload progress of a task. More... | |
| virtual Task::StatusHandler & | status_changed ()=0 |
| Handler for download or upload progress of a task. More... | |
| virtual void | cancel ()=0 |
| Cancels the task. More... | |
Task is an abstract class that defines common interfaces for upload and download task.
| typedef std::function<size_t(void *dest, size_t buf_size)> mcloud::api::Task::Buffer_Callback |
| typedef std::function<void(float)> mcloud::api::Task::ProgressHandler |
| typedef std::function<void(Status)> mcloud::api::Task::StatusHandler |
|
strong |
The Status enum indicates current status of this task.
| Enumerator | |
|---|---|
| Unstart | Task is in queue and sync manager does not run this task yet. |
| Running | Task is being processed by sync manager. |
| Canceled | Task is in canceled status, it is caused by the call from Client::cancel_sync(). |
| Paused | Task is in paused status, it is caused by the call from Client::pause_sync(). |
| Broken | Task is broken when sync manager failed to download/upload a task after several times trying. |
| Complete | Task is completed. |
|
virtualdefault |
|
pure virtual |
Cancels the task.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns an unique id of cloud content on mcloud.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns a display name of cloud content on mcloud.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Contains the error string if an error occurs during task running.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns cloud content local storage file path.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Handler for download or upload progress of a task.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns current download or upload item sync-up status.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Handler for download or upload progress of a task.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns an unique id of task.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.
|
pure virtual |
Returns a item url assigned by mcloud.
Implemented in mcloud::api::UploadTask, and mcloud::api::DownloadTask.