Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 5 | #include "version.hpp" |
| 6 | |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 7 | #include <experimental/filesystem> |
Andrew Geissler | 9155b71 | 2020-05-16 13:04:44 -0500 | [diff] [blame] | 8 | #include <string> |
Gunnar Mills | b0ce996 | 2018-09-07 13:39:10 -0500 | [diff] [blame] | 9 | |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 10 | namespace phosphor |
| 11 | { |
| 12 | namespace software |
| 13 | { |
| 14 | namespace updater |
| 15 | { |
| 16 | |
| 17 | namespace fs = std::experimental::filesystem; |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 18 | using VersionPurpose = |
| 19 | sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose; |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 20 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 21 | /** @brief Serialization function - stores priority information to file |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 22 | * @param[in] versionId - The version for which to store information. |
| 23 | * @param[in] priority - RedundancyPriority value for that version. |
| 24 | **/ |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 25 | void storePriority(const std::string& versionId, uint8_t priority); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 26 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 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 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 33 | /** @brief Serialization function - restores priority information from file |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 34 | * @param[in] versionId - The version for which to retrieve information. |
| 35 | * @param[in] priority - RedundancyPriority reference for that version. |
Saqib Khan | 1eef62d | 2017-08-10 15:29:34 -0500 | [diff] [blame] | 36 | * @return true if restore was successful, false if not |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 37 | **/ |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 38 | bool restorePriority(const std::string& versionId, uint8_t& priority); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 39 | |
Adriana Kobylak | ec4eec3 | 2019-11-13 14:28:35 -0600 | [diff] [blame] | 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 | |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 47 | /** @brief Removes the serial directory for a given version. |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 48 | * @param[in] versionId - The version for which to remove a file, if it exists. |
| 49 | **/ |
Adriana Kobylak | 687e75e | 2019-11-07 11:23:25 -0600 | [diff] [blame] | 50 | void removePersistDataDirectory(const std::string& versionId); |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 51 | |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 52 | } // namespace updater |
Saqib Khan | 5d53267 | 2017-08-09 10:44:50 -0500 | [diff] [blame] | 53 | } // namespace software |
Gunnar Mills | fa34e02 | 2018-09-04 10:05:45 -0500 | [diff] [blame] | 54 | } // namespace phosphor |