172654f10SDeepak Kodihalli #pragma once 272654f10SDeepak Kodihalli 3f18bf836SPatrick Venture #include "config.h" 4f18bf836SPatrick Venture 5f18bf836SPatrick Venture #include "elog_entry.hpp" 6*fa2d962bSPatrick Williams #include "paths.hpp" 7f18bf836SPatrick Venture 8331c4857SPatrick Williams #include <filesystem> 972654f10SDeepak Kodihalli #include <string> 1072654f10SDeepak Kodihalli #include <vector> 1172654f10SDeepak Kodihalli 1272654f10SDeepak Kodihalli namespace phosphor 1372654f10SDeepak Kodihalli { 1472654f10SDeepak Kodihalli namespace logging 1572654f10SDeepak Kodihalli { 1672654f10SDeepak Kodihalli 17331c4857SPatrick Williams namespace fs = std::filesystem; 1872654f10SDeepak Kodihalli 1972654f10SDeepak Kodihalli /** @brief Serialize and persist error d-bus object 2072654f10SDeepak Kodihalli * @param[in] a - const reference to error entry. 2172654f10SDeepak Kodihalli * @param[in] dir - pathname of directory where the serialized error will 2272654f10SDeepak Kodihalli * be placed. 2372654f10SDeepak Kodihalli * @return fs::path - pathname of persisted error file 2472654f10SDeepak Kodihalli */ 2572654f10SDeepak Kodihalli fs::path serialize(const Entry& e, 26*fa2d962bSPatrick Williams const fs::path& dir = fs::path(paths::error())); 2772654f10SDeepak Kodihalli 2872654f10SDeepak Kodihalli /** @brief Deserialze a persisted error into a d-bus object 2972654f10SDeepak Kodihalli * @param[in] path - pathname of persisted error file 3072654f10SDeepak Kodihalli * @param[in] e - reference to error object which is the target of 3172654f10SDeepak Kodihalli * deserialization. 3272654f10SDeepak Kodihalli * @return bool - true if the deserialization was successful, false otherwise. 3372654f10SDeepak Kodihalli */ 3472654f10SDeepak Kodihalli bool deserialize(const fs::path& path, Entry& e); 3572654f10SDeepak Kodihalli 36fb978da4SMatt Spinler /** @brief Return the path to serialize a log entry to 37fb978da4SMatt Spinler * @param[in] id - log entry ID 38fb978da4SMatt Spinler * @param[in] dir - pathname of directory where the serialized error will 39fb978da4SMatt Spinler * be placed. 40fb978da4SMatt Spinler * @return fs::path - pathname of persisted error file 41fb978da4SMatt Spinler */ 42*fa2d962bSPatrick Williams fs::path getEntrySerializePath(uint32_t id, 43*fa2d962bSPatrick Williams const fs::path& dir = fs::path(paths::error())); 44fb978da4SMatt Spinler 4572654f10SDeepak Kodihalli } // namespace logging 4672654f10SDeepak Kodihalli } // namespace phosphor 47