summaryrefslogtreecommitdiff
path: root/src/components/resumption/include/resumption/last_state_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/resumption/include/resumption/last_state_impl.h')
-rw-r--r--src/components/resumption/include/resumption/last_state_impl.h43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/components/resumption/include/resumption/last_state_impl.h b/src/components/resumption/include/resumption/last_state_impl.h
index 2da3147930..5eb4050d2d 100644
--- a/src/components/resumption/include/resumption/last_state_impl.h
+++ b/src/components/resumption/include/resumption/last_state_impl.h
@@ -33,7 +33,10 @@
#ifndef SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_IMPL_H_
#define SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_IMPL_H_
+#include <string>
+
#include "resumption/last_state.h"
+#include "utils/lock.h"
#include "utils/macro.h"
namespace resumption {
@@ -49,31 +52,53 @@ class LastStateImpl : public LastState {
*/
LastStateImpl(const std::string& app_storage_folder,
const std::string& app_info_storage);
-
/**
* @brief Destructor
*/
~LastStateImpl();
+ DEPRECATED
+ void SaveStateToFileSystem();
+
/**
* @brief Saving dictionary to filesystem
*/
- void SaveStateToFileSystem() OVERRIDE;
+ void SaveToFileSystem() OVERRIDE;
/**
- * @brief Get reference to dictionary
+ * @brief Remove dictionary from filesystem
*/
- Json::Value& get_dictionary() OVERRIDE;
+ void RemoveFromFileSystem() OVERRIDE;
- private:
- const std::string app_storage_folder_;
- const std::string app_info_storage_;
- Json::Value dictionary_;
+ /**
+ * @brief Get the dictionary
+ * @return A copy of the dictionary instance
+ */
+ Json::Value dictionary() const OVERRIDE;
/**
+ * @brief Get the dictionary
+ * @return Reference to the dictionary
+ */
+ DEPRECATED Json::Value& get_dictionary();
+
+ /**
+ * @brief Resets internal dictionary
+ * @param dictionary New dictionary json value to be set
+ */
+ void set_dictionary(const Json::Value& dictionary) OVERRIDE;
+
+ private:
+ /**
* @brief Load dictionary from filesystem
*/
- void LoadStateFromFileSystem();
+ void LoadFromFileSystem();
+
+ Json::Value dictionary_;
+ mutable sync_primitives::Lock dictionary_lock_;
+
+ std::string app_storage_folder_;
+ std::string app_info_storage_;
DISALLOW_COPY_AND_ASSIGN(LastStateImpl);
};