Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | f18bf83 | 2018-10-26 18:14:00 -0700 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
| 5 | #include "elog_entry.hpp" |
| 6 | |
Patrick Williams | 331c485 | 2021-04-16 15:38:59 -0500 | [diff] [blame] | 7 | #include <filesystem> |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 8 | #include <string> |
| 9 | #include <vector> |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 10 | |
| 11 | namespace phosphor |
| 12 | { |
| 13 | namespace logging |
| 14 | { |
| 15 | |
Patrick Williams | 331c485 | 2021-04-16 15:38:59 -0500 | [diff] [blame] | 16 | namespace fs = std::filesystem; |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 17 | |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 18 | /** @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 | */ |
| 24 | fs::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 | */ |
| 33 | bool deserialize(const fs::path& path, Entry& e); |
| 34 | |
Matt Spinler | fb978da | 2022-01-21 08:42:24 -0600 | [diff] [blame] | 35 | /** @brief Return the path to serialize a log entry to |
| 36 | * @param[in] id - log entry ID |
| 37 | * @param[in] dir - pathname of directory where the serialized error will |
| 38 | * be placed. |
| 39 | * @return fs::path - pathname of persisted error file |
| 40 | */ |
Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 41 | fs::path getEntrySerializePath( |
| 42 | uint32_t id, const fs::path& dir = fs::path(ERRLOG_PERSIST_PATH)); |
Matt Spinler | fb978da | 2022-01-21 08:42:24 -0600 | [diff] [blame] | 43 | |
Deepak Kodihalli | 72654f1 | 2017-06-12 04:33:29 -0500 | [diff] [blame] | 44 | } // namespace logging |
| 45 | } // namespace phosphor |