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