diff options
| author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-08-28 21:21:02 +0300 |
|---|---|---|
| committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2015-08-28 21:21:02 +0300 |
| commit | 6f3f670abe3d2d78a13cd3862e3a587dd4fe4e85 (patch) | |
| tree | 0d681fd23bf2e70e385d053aee1e54dbe08668b1 /server/modules | |
| parent | ba8247eaf522e8a129b7fbbf09a6fab010746e3a (diff) | |
protocol:
typo fix
added description to setting_info
server:
api:
using structure with setting info instead of hust string for just value (a bit of necessary complication)
renamed few structs to avoid collision with protobuf ones
defined few module variables in api itself (a bit of simplification for module developer)
modules:
adapted to api changes
Diffstat (limited to 'server/modules')
| -rw-r--r-- | server/modules/downloaders/curl/main.cpp | 8 | ||||
| -rw-r--r-- | server/modules/downloaders/curl/main.h | 8 | ||||
| -rw-r--r-- | server/modules/metadata/flat_files/main.cpp | 8 | ||||
| -rw-r--r-- | server/modules/metadata/flat_files/main.h | 8 |
4 files changed, 14 insertions, 18 deletions
diff --git a/server/modules/downloaders/curl/main.cpp b/server/modules/downloaders/curl/main.cpp index 66f89b4..23c4591 100644 --- a/server/modules/downloaders/curl/main.cpp +++ b/server/modules/downloaders/curl/main.cpp @@ -57,21 +57,21 @@ void downloader::load(core_api *a) module_download_ui_element_info_s e; e.id = 0; e.name = "Url"; - e.type = MODULE_UI_ELEMENT_TYPE_e::UI_STR; + e.type = MODULE_UI_ELEMENT_TYPE_e::UI_STR_; info.download_creation_ui.push_back(e); e.id = 1; e.name = "Download path"; - e.type = MODULE_UI_ELEMENT_TYPE_e::UI_STR; + e.type = MODULE_UI_ELEMENT_TYPE_e::UI_STR_; info.download_creation_ui.push_back(e); info.on_modules_loaded = boost::bind(&downloader::on_modules_loaded, this); //optional definition of function which is called after all modules loaded } -const module_info &downloader::get_module_info() +const module_info_base &downloader::get_module_info() { return info; } -void downloader::set_module_settings(const std::map<std::string, std::string> &settings) +void downloader::set_module_settings(const std::map<std::string, setting_s> &settings) { this->settings = settings; } diff --git a/server/modules/downloaders/curl/main.h b/server/modules/downloaders/curl/main.h index aff5cb3..d97e72e 100644 --- a/server/modules/downloaders/curl/main.h +++ b/server/modules/downloaders/curl/main.h @@ -37,8 +37,8 @@ public: //core module api downloader(); void load(core_api *a); - const module_info &get_module_info(); - void set_module_settings(const std::map<std::string, std::string> &settings); //will called with settings stored in config + const module_info_base &get_module_info(); + void set_module_settings(const std::map<std::string, setting_s> &settings); //will called with settings stored in config ~downloader(); //downloader module api int add_download(std::map<int, std::string> params); //add download, this function must return unique for current session and current downloader download id @@ -50,9 +50,7 @@ public: download_s get_download_info(int download_id, std::map<int, std::string> params = std::map<int, std::string>()); //same as above, except this one is for single download, not a complete list private: void on_modules_loaded(); - downloader_module_info info; - core_api *api = nullptr; - std::map<std::string, std::string> settings; //settings name, val +// downloader_module_info info; std::map<int, my_download> downloads; //map of id, download }; diff --git a/server/modules/metadata/flat_files/main.cpp b/server/modules/metadata/flat_files/main.cpp index f1583c5..d0e1040 100644 --- a/server/modules/metadata/flat_files/main.cpp +++ b/server/modules/metadata/flat_files/main.cpp @@ -78,23 +78,23 @@ void storage_impl::load(core_api *a) info.name = "flat_files_metadata"; info.description = "this module provide metadata storage in flat files"; info.version = "0.0.0.1draft"; - info.default_settings["data_path"] = "~/.local/share/udm/metadata"; + info.default_settings["data_path"].value = "~/.local/share/udm/metadata"; info.on_modules_loaded = boost::bind(&storage_impl::on_modules_loaded, this); //optional definition of function which is called after all modules loaded //std::cout<<"flat_files metadata module succesfully loaded\n"; //working fine } -const module_info &storage_impl::get_module_info() +const module_info_base &storage_impl::get_module_info() { return info; } -void storage_impl::set_module_settings(const std::map<std::string, std::string> &settings) +void storage_impl::set_module_settings(const std::map<std::string, setting_s> &settings) { this->settings = settings; - parsed_data_path = replace_home_var(this->settings["data_path"]); + parsed_data_path = replace_home_var(this->settings["data_path"].value); } diff --git a/server/modules/metadata/flat_files/main.h b/server/modules/metadata/flat_files/main.h index 0798674..b315d62 100644 --- a/server/modules/metadata/flat_files/main.h +++ b/server/modules/metadata/flat_files/main.h @@ -32,8 +32,8 @@ class storage_impl: public module_metadata_storage storage_impl(); //module base void load(core_api *a); - const module_info &get_module_info(); - void set_module_settings(const std::map<std::string, std::string> &settings); + const module_info_base &get_module_info(); + void set_module_settings(const std::map<std::string, setting_s> &settings); //metadata module bool set(const std::string &module_name, const std::string &setting_name, const std::vector<char> &data); bool get(const std::string &module_name, const std::string &setting_name, std::vector<char> &data); @@ -41,9 +41,7 @@ class storage_impl: public module_metadata_storage private: void on_modules_loaded(); - module_info info; - core_api *api = nullptr; - std::map<std::string, std::string> settings; + module_info_base info; std::string parsed_data_path; }; |
