blob: 08fc50487436ee29143c215de8e765bde33f9595 [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>
8
Saqib Khan5d532672017-08-09 10:44:50 -05009namespace phosphor
10{
11namespace software
12{
13namespace updater
14{
15
16namespace fs = std::experimental::filesystem;
Adriana Kobylakec4eec32019-11-13 14:28:35 -060017using VersionPurpose =
18 sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
Saqib Khan5d532672017-08-09 10:44:50 -050019
Adriana Kobylak687e75e2019-11-07 11:23:25 -060020/** @brief Serialization function - stores priority information to file
Saqib Khan5d532672017-08-09 10:44:50 -050021 * @param[in] versionId - The version for which to store information.
22 * @param[in] priority - RedundancyPriority value for that version.
23 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060024void storePriority(const std::string& versionId, uint8_t priority);
Saqib Khan5d532672017-08-09 10:44:50 -050025
Adriana Kobylakec4eec32019-11-13 14:28:35 -060026/** @brief Serialization function - stores purpose information to file
27 * @param[in] versionId - The version for which to store information.
28 * @param[in] purpose - VersionPurpose value for that version.
29 **/
30void storePurpose(const std::string& versionId, VersionPurpose purpose);
31
Adriana Kobylak687e75e2019-11-07 11:23:25 -060032/** @brief Serialization function - restores priority information from file
Saqib Khan5d532672017-08-09 10:44:50 -050033 * @param[in] versionId - The version for which to retrieve information.
34 * @param[in] priority - RedundancyPriority reference for that version.
Saqib Khan1eef62d2017-08-10 15:29:34 -050035 * @return true if restore was successful, false if not
Saqib Khan5d532672017-08-09 10:44:50 -050036 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060037bool restorePriority(const std::string& versionId, uint8_t& priority);
Saqib Khan5d532672017-08-09 10:44:50 -050038
Adriana Kobylakec4eec32019-11-13 14:28:35 -060039/** @brief Serialization function - restores purpose information from file
40 * @param[in] versionId - The version for which to retrieve information.
41 * @param[in] purpose - VersionPurpose reference for that version.
42 * @return true if restore was successful, false if not
43 **/
44bool restorePurpose(const std::string& versionId, VersionPurpose& purpose);
45
Adriana Kobylak687e75e2019-11-07 11:23:25 -060046/** @brief Removes the serial directory for a given version.
Saqib Khan5d532672017-08-09 10:44:50 -050047 * @param[in] versionId - The version for which to remove a file, if it exists.
48 **/
Adriana Kobylak687e75e2019-11-07 11:23:25 -060049void removePersistDataDirectory(const std::string& versionId);
Saqib Khan5d532672017-08-09 10:44:50 -050050
Gunnar Millsfa34e022018-09-04 10:05:45 -050051} // namespace updater
Saqib Khan5d532672017-08-09 10:44:50 -050052} // namespace software
Gunnar Millsfa34e022018-09-04 10:05:45 -050053} // namespace phosphor