blob: 42a057b3e25b5ca812d4a48b035350840d102113 [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
Gunnar Millsb0ce9962018-09-07 13:39:10 -05007#include <experimental/filesystem>
Andrew Geissler9155b712020-05-16 13:04:44 -05008#include <string>
Gunnar Millsb0ce9962018-09-07 13:39:10 -05009
Saqib Khan5d532672017-08-09 10:44:50 -050010namespace phosphor
11{
12namespace software
13{
14namespace updater
15{
16
17namespace fs = std::experimental::filesystem;
Adriana Kobylakec4eec32019-11-13 14:28:35 -060018using VersionPurpose =
19 sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
Saqib Khan5d532672017-08-09 10:44:50 -050020
Adriana Kobylak687e75e2019-11-07 11:23:25 -060021/** @brief Serialization function - stores priority information to file
Saqib Khan5d532672017-08-09 10:44:50 -050022 * @param[in] versionId - The version for which to store information.
23 * @param[in] priority - RedundancyPriority value for that version.
24 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060025void storePriority(const std::string& versionId, uint8_t priority);
Saqib Khan5d532672017-08-09 10:44:50 -050026
Adriana Kobylakec4eec32019-11-13 14:28:35 -060027/** @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 **/
31void storePurpose(const std::string& versionId, VersionPurpose purpose);
32
Adriana Kobylak687e75e2019-11-07 11:23:25 -060033/** @brief Serialization function - restores priority information from file
Saqib Khan5d532672017-08-09 10:44:50 -050034 * @param[in] versionId - The version for which to retrieve information.
35 * @param[in] priority - RedundancyPriority reference for that version.
Saqib Khan1eef62d2017-08-10 15:29:34 -050036 * @return true if restore was successful, false if not
Saqib Khan5d532672017-08-09 10:44:50 -050037 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060038bool restorePriority(const std::string& versionId, uint8_t& priority);
Saqib Khan5d532672017-08-09 10:44:50 -050039
Adriana Kobylakec4eec32019-11-13 14:28:35 -060040/** @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 **/
45bool restorePurpose(const std::string& versionId, VersionPurpose& purpose);
46
Adriana Kobylak687e75e2019-11-07 11:23:25 -060047/** @brief Removes the serial directory for a given version.
Saqib Khan5d532672017-08-09 10:44:50 -050048 * @param[in] versionId - The version for which to remove a file, if it exists.
49 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060050void removePersistDataDirectory(const std::string& versionId);
Saqib Khan5d532672017-08-09 10:44:50 -050051
Gunnar Millsfa34e022018-09-04 10:05:45 -050052} // namespace updater
Saqib Khan5d532672017-08-09 10:44:50 -050053} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050054} // namespace phosphor