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