xref: /openbmc/phosphor-dbus-monitor/src/resolve_errors.hpp (revision c5fe26a60b7a5f1c3c1a08d9cf2da71467356798)
156fd833dSMatt Spinler #pragma once
256fd833dSMatt Spinler #include "callback.hpp"
356fd833dSMatt Spinler 
4ae4c95c6SAndrew Geissler #include <string>
5ae4c95c6SAndrew Geissler 
656fd833dSMatt Spinler namespace phosphor
756fd833dSMatt Spinler {
856fd833dSMatt Spinler namespace dbus
956fd833dSMatt Spinler {
1056fd833dSMatt Spinler namespace monitoring
1156fd833dSMatt Spinler {
1256fd833dSMatt Spinler 
1356fd833dSMatt Spinler /**
1456fd833dSMatt Spinler  * @class ResolveCallout
1556fd833dSMatt Spinler  * @brief Resolves error logs with the associated callout
1656fd833dSMatt Spinler  *
1756fd833dSMatt Spinler  * Resolves a log by setting its Resolved property
1856fd833dSMatt Spinler  * to true.
1956fd833dSMatt Spinler  */
2056fd833dSMatt Spinler class ResolveCallout : public Callback
2156fd833dSMatt Spinler {
2256fd833dSMatt Spinler   public:
2356fd833dSMatt Spinler     ResolveCallout() = delete;
2456fd833dSMatt Spinler     ~ResolveCallout() = default;
2556fd833dSMatt Spinler     ResolveCallout(const ResolveCallout&) = delete;
2656fd833dSMatt Spinler     ResolveCallout& operator=(const ResolveCallout&) = delete;
2756fd833dSMatt Spinler     ResolveCallout(ResolveCallout&&) = default;
2856fd833dSMatt Spinler     ResolveCallout& operator=(ResolveCallout&&) = default;
2956fd833dSMatt Spinler 
3056fd833dSMatt Spinler     /**
3156fd833dSMatt Spinler      * @brief constructor
3256fd833dSMatt Spinler      *
3356fd833dSMatt Spinler      * @param[in] callout - The callout whose errors need to be resolved.
3456fd833dSMatt Spinler      *                      Normally an inventory path.
3556fd833dSMatt Spinler      */
ResolveCallout(const std::string & callout)36*c5fe26a6SPatrick Williams     explicit ResolveCallout(const std::string& callout) : callout(callout) {}
3756fd833dSMatt Spinler 
3856fd833dSMatt Spinler     /**
3956fd833dSMatt Spinler      * @brief Callback interface to resolve errors
4056fd833dSMatt Spinler      *
4156fd833dSMatt Spinler      * Resolves all error log entries that are associated
4256fd833dSMatt Spinler      * with the callout.
4356fd833dSMatt Spinler      */
44a45e086dSRatan Gupta     void operator()(Context ctx) override;
4556fd833dSMatt Spinler 
4656fd833dSMatt Spinler   private:
4756fd833dSMatt Spinler     /**
4856fd833dSMatt Spinler      * @brief Resolves a single error log entry
4956fd833dSMatt Spinler      *
5056fd833dSMatt Spinler      * param[in] entry - the object path of the error log entry
5156fd833dSMatt Spinler      */
5256fd833dSMatt Spinler     void resolve(const std::string& entry);
5356fd833dSMatt Spinler 
5456fd833dSMatt Spinler     /**
5556fd833dSMatt Spinler      * @brief The object path of the callout, typically an inventory path
5656fd833dSMatt Spinler      */
5756fd833dSMatt Spinler     std::string callout;
5856fd833dSMatt Spinler };
5956fd833dSMatt Spinler 
6056fd833dSMatt Spinler } // namespace monitoring
6156fd833dSMatt Spinler } // namespace dbus
6256fd833dSMatt Spinler } // namespace phosphor
63