blob: aada2bf5d9164045ededfa7cf48a3915579d6d39 [file] [log] [blame]
Saqib Khan5d532672017-08-09 10:44:50 -05001#pragma once
2
Saqib Khan5d532672017-08-09 10:44:50 -05003#include "config.h"
4
Adriana Kobylakec4eec32019-11-13 14:28:35 -06005#include "version.hpp"
6
Andrew Geissler9155b712020-05-16 13:04:44 -05007#include <string>
Gunnar Millsb0ce9962018-09-07 13:39:10 -05008
Saqib Khan5d532672017-08-09 10:44:50 -05009namespace phosphor
10{
11namespace software
12{
13namespace updater
14{
15
Adriana Kobylakec4eec32019-11-13 14:28:35 -060016using VersionPurpose =
17 sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
Saqib Khan5d532672017-08-09 10:44:50 -050018
Adriana Kobylak687e75e2019-11-07 11:23:25 -060019/** @brief Serialization function - stores priority information to file
Saqib Khan5d532672017-08-09 10:44:50 -050020 * @param[in] versionId - The version for which to store information.
21 * @param[in] priority - RedundancyPriority value for that version.
22 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060023void storePriority(const std::string& versionId, uint8_t priority);
Saqib Khan5d532672017-08-09 10:44:50 -050024
Adriana Kobylakec4eec32019-11-13 14:28:35 -060025/** @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 **/
29void storePurpose(const std::string& versionId, VersionPurpose purpose);
30
Adriana Kobylak687e75e2019-11-07 11:23:25 -060031/** @brief Serialization function - restores priority information from file
Saqib Khan5d532672017-08-09 10:44:50 -050032 * @param[in] versionId - The version for which to retrieve information.
33 * @param[in] priority - RedundancyPriority reference for that version.
Saqib Khan1eef62d2017-08-10 15:29:34 -050034 * @return true if restore was successful, false if not
Saqib Khan5d532672017-08-09 10:44:50 -050035 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060036bool restorePriority(const std::string& versionId, uint8_t& priority);
Saqib Khan5d532672017-08-09 10:44:50 -050037
Adriana Kobylakec4eec32019-11-13 14:28:35 -060038/** @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 **/
43bool restorePurpose(const std::string& versionId, VersionPurpose& purpose);
44
Adriana Kobylak687e75e2019-11-07 11:23:25 -060045/** @brief Removes the serial directory for a given version.
Saqib Khan5d532672017-08-09 10:44:50 -050046 * @param[in] versionId - The version for which to remove a file, if it exists.
47 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060048void removePersistDataDirectory(const std::string& versionId);
Saqib Khan5d532672017-08-09 10:44:50 -050049
Gunnar Millsfa34e022018-09-04 10:05:45 -050050} // namespace updater
Saqib Khan5d532672017-08-09 10:44:50 -050051} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050052} // namespace phosphor