summaryrefslogtreecommitdiffstats
path: root/host_state_serialize.hpp
blob: 0bc76847ede70c409fb07420653386812b459f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <string>
#include <vector>
#include <experimental/filesystem>
#include "host_state_manager.hpp"
#include "config.h"

namespace phosphor
{
namespace state
{
namespace manager
{

namespace fs = std::experimental::filesystem;

/** @brief Serialize and persist requested host state
 *  @param[in] host - const reference to host state.
 *  @param[in] dir - pathname of file where the serialized host state will
 *                   be placed.
 *  @return fs::path - pathname of persisted requested host state.
 */
fs::path serialize(const Host& host,
                   const fs::path& dir = fs::path(HOST_STATE_PERSIST_PATH));

/** @brief Deserialze a persisted requested host state.
 *  @param[in] path - pathname of persisted host state file
 *  @param[in] host - reference to host state object which is the target of
 *             deserialization.
 *  @return bool - true if the deserialization was successful, false otherwise.
 */
bool deserialize(const fs::path& path, Host& host);

} // namespace manager
} // namespace state
} // namespace phosphor
OpenPOWER on IntegriCloud