summaryrefslogtreecommitdiff
path: root/server/include/api_module_downloader.h
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-10 00:15:07 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2015-09-10 00:15:07 +0300
commitccffc685c412183b56f822438da5cc8a575d757e (patch)
tree4ff9b3abb4ac1d94941ff5aa5aee9ee4cbe74a3e /server/include/api_module_downloader.h
parentb5af51e358073145cdf66470cc890d98547a6dac (diff)
client-qt:
handle disconnect basic downloads model (still draft with unimplemented basic features like dynamic columns count, dynamic columns will be implemented next) basic handler for download list (in theory it's already working now, but untested) basic modules info handler (just store data in memory for now, all basic features still unimplemented, download info ui templates generation will be implemented next here) basic core info handler (just store data in memory for now, core settings and core info ui will be implemented next here.) server: api: added client metadata manipulation api for downloader modules added metadata map to download structure in downloader modules curl_downloader: implemented new api's
Diffstat (limited to 'server/include/api_module_downloader.h')
-rw-r--r--server/include/api_module_downloader.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h
index dbe0d14..dc31811 100644
--- a/server/include/api_module_downloader.h
+++ b/server/include/api_module_downloader.h
@@ -76,16 +76,18 @@ struct download_content_entry_s { //here is basic content entry description, thi
struct download_s {
- int id;
- std::string name; //id generated via download_add or via session restore and it's unique for current session and current dowloader
+ int id; //id generated via download_add or via session restore and it's unique for current session and current dowloader
+ std::string name;
int64_t size, downloaded, download_speed; //download size and size of downloaded data, also download speed all vars in bytes
std::map<int, std::string> info_map; //any additional info provided by downloader module can be stored here
std::list<download_content_entry_s> content; //download content can be set for download, structure described above
+ std::map<std::string, std::string> metadata;
};
class module_downloader : public module_base
{
public:
+ //basic actions
virtual int add_download(std::map<int, std::string> params) = 0; //add download, this function must return unique for current session and current downloader download id
virtual bool stop_download(int download_id) = 0; //stop download by id received via add_download, return true on success, false otherwise
virtual bool start_download(int download_id) = 0; //start download by id received via add_download, return true on success, false otherwise
@@ -93,6 +95,14 @@ public:
virtual bool execute_action_on_download(int download_id, int action_id) = 0; //execute module defined action on download, by id received via add_download
virtual std::list<download_s> get_downloads(std::map<int, std::string> params = std::map<int, std::string>()) = 0; //this function must return list of downloads, additional options may be passed via params map
virtual download_s get_download(int download_id, std::map<int, std::string> params = std::map<int, std::string>()) = 0; //same as above, except this one is for single download, not a complete list
+ //metadata manipulation (api for client specified metadata, unused by server itself, for example labels should be implemented using this api)
+ virtual bool metadata_set(int download_id, std::map<std::string, std::string> metadata) = 0; //replace download metadata with provided one
+ virtual bool metadata_update(int download_id, std::map<std::string, std::string> metadata) = 0; //updated matching metadata entries, create non existent
+ virtual bool metadata_drop(int download_id, std::string var = std::string()) = 0; //remove all metadata if no variable specified, otherwise delete specified variable
+ virtual std::map<std::string, std::string> metadata_get(int download_id) = 0; //get download metadata
+ virtual std::string metadata_get(int download_id, std::string var) = 0; //get value of specified metadata variable
+
+
protected:
downloader_module_info info;
};