1 #pragma once
2 
3 #include "config.h"
4 
5 #include "elog_entry.hpp"
6 #include "paths.hpp"
7 
8 #include <filesystem>
9 #include <string>
10 #include <vector>
11 
12 namespace phosphor
13 {
14 namespace logging
15 {
16 
17 namespace fs = std::filesystem;
18 
19 /** @brief Serialize and persist error d-bus object
20  *  @param[in] a - const reference to error entry.
21  *  @param[in] dir - pathname of directory where the serialized error will
22  *                   be placed.
23  *  @return fs::path - pathname of persisted error file
24  */
25 fs::path serialize(const Entry& e,
26                    const fs::path& dir = fs::path(paths::error()));
27 
28 /** @brief Deserialze a persisted error into a d-bus object
29  *  @param[in] path - pathname of persisted error file
30  *  @param[in] e - reference to error object which is the target of
31  *             deserialization.
32  *  @return bool - true if the deserialization was successful, false otherwise.
33  */
34 bool deserialize(const fs::path& path, Entry& e);
35 
36 /** @brief Return the path to serialize a log entry to
37  *  @param[in] id - log entry ID
38  *  @param[in] dir - pathname of directory where the serialized error will
39  *                   be placed.
40  *  @return fs::path - pathname of persisted error file
41  */
42 fs::path getEntrySerializePath(uint32_t id,
43                                const fs::path& dir = fs::path(paths::error()));
44 
45 } // namespace logging
46 } // namespace phosphor
47