blob: 8fc4d14050c149cdbde65e6154530a0902e8b6bc [file] [log] [blame]
Jayanth Othayoth24964822017-09-04 22:07:06 -05001#pragma once
2
Jayanth Othayothcb65ffc2018-10-16 08:29:32 -05003#include "config.h"
Jayanth Othayoth24964822017-09-04 22:07:06 -05004
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -05005#include <filesystem>
Chirag Sharma50427252020-08-11 12:11:38 -05006#include <set>
Jayanth Othayoth24964822017-09-04 22:07:06 -05007
8namespace phosphor
9{
10namespace dump
11{
12namespace elog
13{
Chirag Sharma50427252020-08-11 12:11:38 -050014using EId = uint32_t;
15using ElogList = std::set<EId>;
Jayanth Othayoth24964822017-09-04 22:07:06 -050016
Jayanth Othayoth24964822017-09-04 22:07:06 -050017/** @brief Serialize and persist list of ids.
18 * @param[in] list - elog id list.
19 * @param[in] dir - pathname of file where the serialized elog id's will
20 * be placed.
21 */
22void serialize(const ElogList& list,
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050023 const std::filesystem::path& dir =
24 std::filesystem::path(ELOG_ID_PERSIST_PATH));
Jayanth Othayoth24964822017-09-04 22:07:06 -050025
26/** @brief Deserialze a persisted list of ids into list
27 * @param[in] path - pathname of persisted error file
28 * @param[out] list - elog id list
29 * @return bool - true if the deserialization was successful, false otherwise.
30 */
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050031bool deserialize(const std::filesystem::path& path, ElogList& list);
Jayanth Othayoth24964822017-09-04 22:07:06 -050032
33} // namespace elog
34} // namespace dump
35} // namespace phosphor