1 #pragma once
2 
3 #include "config.h"
4 
5 #include "version.hpp"
6 
7 #include <experimental/filesystem>
8 #include <string>
9 
10 namespace phosphor
11 {
12 namespace software
13 {
14 namespace updater
15 {
16 
17 namespace fs = std::experimental::filesystem;
18 using VersionPurpose =
19     sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
20 
21 /** @brief Serialization function - stores priority information to file
22  *  @param[in] versionId - The version for which to store information.
23  *  @param[in] priority - RedundancyPriority value for that version.
24  **/
25 void storePriority(const std::string& versionId, uint8_t priority);
26 
27 /** @brief Serialization function - stores purpose information to file
28  *  @param[in] versionId - The version for which to store information.
29  *  @param[in] purpose - VersionPurpose value for that version.
30  **/
31 void storePurpose(const std::string& versionId, VersionPurpose purpose);
32 
33 /** @brief Serialization function - restores priority information from file
34  *  @param[in] versionId - The version for which to retrieve information.
35  *  @param[in] priority - RedundancyPriority reference for that version.
36  *  @return true if restore was successful, false if not
37  **/
38 bool restorePriority(const std::string& versionId, uint8_t& priority);
39 
40 /** @brief Serialization function - restores purpose information from file
41  *  @param[in] versionId - The version for which to retrieve information.
42  *  @param[in] purpose - VersionPurpose reference for that version.
43  *  @return true if restore was successful, false if not
44  **/
45 bool restorePurpose(const std::string& versionId, VersionPurpose& purpose);
46 
47 /** @brief Removes the serial directory for a given version.
48  *  @param[in] versionId - The version for which to remove a file, if it exists.
49  **/
50 void removePersistDataDirectory(const std::string& versionId);
51 
52 } // namespace updater
53 } // namespace software
54 } // namespace phosphor
55