1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#pragma once
#include "data_interface.hpp"
#include "log_manager.hpp"
#include "paths.hpp"
#include "registry.hpp"
#include "repository.hpp"
namespace openpower
{
namespace pels
{
/**
* @brief PEL manager object
*/
class Manager
{
public:
Manager() = delete;
~Manager() = default;
Manager(const Manager&) = default;
Manager& operator=(const Manager&) = default;
Manager(Manager&&) = default;
Manager& operator=(Manager&&) = default;
/**
* @brief constructor
*
* @param[in] logManager - internal::Manager object
*/
explicit Manager(phosphor::logging::internal::Manager& logManager,
std::unique_ptr<DataInterfaceBase>&& dataIface) :
_logManager(logManager),
_repo(getPELRepoPath()),
_registry(getMessageRegistryPath() / message::registryFileName),
_dataIface(std::move(dataIface))
{
}
/**
* @brief Creates a PEL based on the OpenBMC event log contents. If
* a PEL was passed in via the RAWPEL specifier in the
* additionalData parameter, use that instead.
*
* @param[in] message - the event log message property
* @param[in] obmcLogID - the corresponding OpenBMC event log id
* @param[in] timestamp - the Timestamp property
* @param[in] severity - the event log severity
* @param[in] additionalData - the AdditionalData property
* @param[in] associations - the Associations property
*/
void create(const std::string& message, uint32_t obmcLogID,
uint64_t timestamp, phosphor::logging::Entry::Level severity,
const std::vector<std::string>& additionalData,
const std::vector<std::string>& associations);
/**
* @brief Erase a PEL based on its OpenBMC event log ID
*
* @param[in] obmcLogID - the corresponding OpenBMC event log id
*/
void erase(uint32_t obmcLogID);
/** @brief Says if an OpenBMC event log may not be manually deleted at this
* time because its corresponding PEL cannot be.
*
* There are PEL retention policies that can prohibit the manual deletion
* of PELs (and therefore OpenBMC event logs).
*
* @param[in] obmcLogID - the OpenBMC event log ID
* @return bool - true if prohibited
*/
bool isDeleteProhibited(uint32_t obmcLogID);
private:
/**
* @brief Adds a received raw PEL to the PEL repository
*
* @param[in] rawPelPath - The path to the file that contains the
* raw PEL.
* @param[in] obmcLogID - the corresponding OpenBMC event log id
*/
void addRawPEL(const std::string& rawPelPath, uint32_t obmcLogID);
/**
* @brief Creates a PEL based on the OpenBMC event log contents.
*
* @param[in] message - The event log message property
* @param[in] obmcLogID - the corresponding OpenBMC event log id
* @param[in] timestamp - The timestamp property
* @param[in] severity - The event log severity
* @param[in] additionalData - The AdditionalData property
* @param[in] associations - The associations property
*/
void createPEL(const std::string& message, uint32_t obmcLogID,
uint64_t timestamp, phosphor::logging::Entry::Level severity,
const std::vector<std::string>& additionalData,
const std::vector<std::string>& associations);
/**
* @brief Reference to phosphor-logging's Manager class
*/
phosphor::logging::internal::Manager& _logManager;
/**
* @brief The PEL repository object
*/
Repository _repo;
/**
* @brief The PEL message registry object
*/
message::Registry _registry;
/**
* @brief The API the PEL sections use to gather data
*/
std::unique_ptr<DataInterfaceBase> _dataIface;
};
} // namespace pels
} // namespace openpower
|