summaryrefslogtreecommitdiffstats
path: root/src/resolve_errors.hpp
blob: c58dc7da360170371ac9b391d4c47a6581d26b55 (plain)
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
#pragma once
#include "callback.hpp"

namespace phosphor
{
namespace dbus
{
namespace monitoring
{

/**
 * @class ResolveCallout
 * @brief Resolves error logs with the associated callout
 *
 * Resolves a log by setting its Resolved property
 * to true.
 */
class ResolveCallout : public Callback
{
  public:
    ResolveCallout() = delete;
    ~ResolveCallout() = default;
    ResolveCallout(const ResolveCallout&) = delete;
    ResolveCallout& operator=(const ResolveCallout&) = delete;
    ResolveCallout(ResolveCallout&&) = default;
    ResolveCallout& operator=(ResolveCallout&&) = default;

    /**
     * @brief constructor
     *
     * @param[in] callout - The callout whose errors need to be resolved.
     *                      Normally an inventory path.
     */
    explicit ResolveCallout(const std::string& callout) : callout(callout)
    {
    }

    /**
     * @brief Callback interface to resolve errors
     *
     * Resolves all error log entries that are associated
     * with the callout.
     */
    void operator()(Context ctx) override;

  private:
    /**
     * @brief Resolves a single error log entry
     *
     * param[in] entry - the object path of the error log entry
     */
    void resolve(const std::string& entry);

    /**
     * @brief The object path of the callout, typically an inventory path
     */
    std::string callout;
};

} // namespace monitoring
} // namespace dbus
} // namespace phosphor
OpenPOWER on IntegriCloud