blob: 9a2d9845df047455197abe448f07e756f87d7bdb [file] [log] [blame]
Deepak Kodihalli72654f12017-06-12 04:33:29 -05001#pragma once
2
Patrick Venturef18bf832018-10-26 18:14:00 -07003#include "config.h"
4
5#include "elog_entry.hpp"
6
Patrick Williams331c4852021-04-16 15:38:59 -05007#include <filesystem>
Deepak Kodihalli72654f12017-06-12 04:33:29 -05008#include <string>
9#include <vector>
Deepak Kodihalli72654f12017-06-12 04:33:29 -050010
11namespace phosphor
12{
13namespace logging
14{
15
Patrick Williams331c4852021-04-16 15:38:59 -050016namespace fs = std::filesystem;
Deepak Kodihalli72654f12017-06-12 04:33:29 -050017
Deepak Kodihalli72654f12017-06-12 04:33:29 -050018/** @brief Serialize and persist error d-bus object
19 * @param[in] a - const reference to error entry.
20 * @param[in] dir - pathname of directory where the serialized error will
21 * be placed.
22 * @return fs::path - pathname of persisted error file
23 */
24fs::path serialize(const Entry& e,
25 const fs::path& dir = fs::path(ERRLOG_PERSIST_PATH));
26
27/** @brief Deserialze a persisted error into a d-bus object
28 * @param[in] path - pathname of persisted error file
29 * @param[in] e - reference to error object which is the target of
30 * deserialization.
31 * @return bool - true if the deserialization was successful, false otherwise.
32 */
33bool deserialize(const fs::path& path, Entry& e);
34
35} // namespace logging
36} // namespace phosphor