Add comments into weave::provider::ConfigStore
Removes OnSettingsChanged which had to be removed by CL:1200
BUG:24267885
Change-Id: I790d7e158927a0e2fbcd34e820075a213a759187
Reviewed-on: https://weave-review.googlesource.com/1204
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/libweave/examples/ubuntu/file_config_store.h b/libweave/examples/ubuntu/file_config_store.h
index 2014f86..aa1d4fe 100644
--- a/libweave/examples/ubuntu/file_config_store.h
+++ b/libweave/examples/ubuntu/file_config_store.h
@@ -21,7 +21,6 @@
bool LoadDefaults(Settings* settings) override;
std::string LoadSettings() override;
void SaveSettings(const std::string& settings) override;
- void OnSettingsChanged(const Settings& settings) override;
std::string LoadBaseCommandDefs() override;
std::map<std::string, std::string> LoadCommandDefs() override;
std::string LoadBaseStateDefs() override;
diff --git a/libweave/include/weave/provider/config_store.h b/libweave/include/weave/provider/config_store.h
index 85cae42..d073ca7 100644
--- a/libweave/include/weave/provider/config_store.h
+++ b/libweave/include/weave/provider/config_store.h
@@ -18,20 +18,34 @@
namespace weave {
namespace provider {
+// Interface with methods to read/write libweave settings, device state and
+// commands definitions.
class ConfigStore {
public:
+ // Returns default settings. This settings used for a new device or after
+ // a factory reset.
virtual bool LoadDefaults(Settings* settings) = 0;
+
+ // Returns settings saved by SaveSettings during last run of libWeave.
+ // Implementation should return data as-is without parsing or modifications.
virtual std::string LoadSettings() = 0;
+
+ // Saves settings. Implementation should save data as-is without parsing or
+ // modifications. Data stored in settings can be sensitive, so it's highly
+ // recommended to protect data, e.g. using encryption.
virtual void SaveSettings(const std::string& settings) = 0;
- virtual void OnSettingsChanged(const Settings& settings) = 0;
virtual std::string LoadBaseCommandDefs() = 0;
- virtual std::map<std::string, std::string> LoadCommandDefs() = 0;
-
virtual std::string LoadBaseStateDefs() = 0;
virtual std::string LoadBaseStateDefaults() = 0;
+ // Returns command definitions as JSON.
+ virtual std::map<std::string, std::string> LoadCommandDefs() = 0;
+
+ // Returns device state definitions as JSON.
virtual std::map<std::string, std::string> LoadStateDefs() = 0;
+
+ // Returns device state defaults as JSON.
virtual std::vector<std::string> LoadStateDefaults() = 0;
protected: