Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | #include "callback.hpp" |
| 3 | |
Andrew Geissler | ae4c95c | 2020-05-16 13:58:53 -0500 | [diff] [blame] | 4 | #include <string> |
| 5 | |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 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 | { |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 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; |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 29 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 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 | } |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 39 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 40 | /** |
| 41 | * @brief Callback interface to resolve errors |
| 42 | * |
| 43 | * Resolves all error log entries that are associated |
| 44 | * with the callout. |
| 45 | */ |
| 46 | void operator()(Context ctx) override; |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 47 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 48 | private: |
| 49 | /** |
| 50 | * @brief Resolves a single error log entry |
| 51 | * |
| 52 | * param[in] entry - the object path of the error log entry |
| 53 | */ |
| 54 | void resolve(const std::string& entry); |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 55 | |
Brad Bishop | d1eac88 | 2018-03-29 10:34:05 -0400 | [diff] [blame] | 56 | /** |
| 57 | * @brief The object path of the callout, typically an inventory path |
| 58 | */ |
| 59 | std::string callout; |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 60 | }; |
| 61 | |
Matt Spinler | 56fd833 | 2017-10-31 14:00:18 -0500 | [diff] [blame] | 62 | } // namespace monitoring |
| 63 | } // namespace dbus |
| 64 | } // namespace phosphor |