xref: /openbmc/phosphor-dbus-monitor/src/resolve_errors.hpp (revision a45e086dc57f51efb882bf864e78fe678238deea)
1 #pragma once
2 #include "callback.hpp"
3 
4 namespace phosphor
5 {
6 namespace dbus
7 {
8 namespace monitoring
9 {
10 
11 /**
12  * @class ResolveCallout
13  * @brief Resolves error logs with the associated callout
14  *
15  * Resolves a log by setting its Resolved property
16  * to true.
17  */
18 class ResolveCallout : public Callback
19 {
20     public:
21 
22         ResolveCallout() = delete;
23         ~ResolveCallout() = default;
24         ResolveCallout(const ResolveCallout&) = delete;
25         ResolveCallout& operator=(const ResolveCallout&) = delete;
26         ResolveCallout(ResolveCallout&&) = default;
27         ResolveCallout& operator=(ResolveCallout&&) = default;
28 
29         /**
30          * @brief constructor
31          *
32          * @param[in] callout - The callout whose errors need to be resolved.
33          *                      Normally an inventory path.
34          */
35         explicit ResolveCallout(const std::string& callout) :
36                 callout(callout) {}
37 
38         /**
39          * @brief Callback interface to resolve errors
40          *
41          * Resolves all error log entries that are associated
42          * with the callout.
43          */
44         void operator()(Context ctx) override;
45 
46     private:
47 
48         /**
49          * @brief Resolves a single error log entry
50          *
51          * param[in] entry - the object path of the error log entry
52          */
53         void resolve(const std::string& entry);
54 
55         /**
56          * @brief The object path of the callout, typically an inventory path
57          */
58         std::string callout;
59 };
60 
61 
62 } // namespace monitoring
63 } // namespace dbus
64 } // namespace phosphor
65