summaryrefslogtreecommitdiffstats
path: root/log_manager.hpp
diff options
context:
space:
mode:
authorNagaraju Goruganti <ngorugan@in.ibm.com>2017-08-30 07:56:12 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-09-13 10:37:03 +0000
commit05aae8bc28cd81cdfea29eaa3cdb89b817b03faf (patch)
treef0e0836410a0c27f177241e54493df2444b5b858 /log_manager.hpp
parentdb18ebe01d588a128aebbd7b1bb8767cfb46b1e9 (diff)
downloadphosphor-logging-05aae8bc28cd81cdfea29eaa3cdb89b817b03faf.tar.gz
phosphor-logging-05aae8bc28cd81cdfea29eaa3cdb89b817b03faf.zip
Add implementation for delete all error log entries in one shot
Resolves openbmc/openbmc#1561. Change-Id: Iac5aaee1bdf9b87ccce9bf8801468ac5a8f9be6c Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'log_manager.hpp')
-rw-r--r--log_manager.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/log_manager.hpp b/log_manager.hpp
index f366684..af176f9 100644
--- a/log_manager.hpp
+++ b/log_manager.hpp
@@ -4,6 +4,7 @@
#include <phosphor-logging/log.hpp>
#include "elog_entry.hpp"
#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
+#include "xyz/openbmc_project/Collection/DeleteAll/server.hpp"
namespace phosphor
{
@@ -13,6 +14,9 @@ namespace logging
extern const std::map<std::string,std::vector<std::string>> g_errMetaMap;
extern const std::map<std::string,level> g_errLevelMap;
+using DeleteAllIface = sdbusplus::server::object::object <
+ sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll >;
+
namespace details
{
@@ -24,6 +28,9 @@ using ManagerIface =
} // namespace details
+namespace internal
+{
+
/** @class Manager
* @brief OpenBMC logging manager implementation.
* @details A concrete implementation for the
@@ -73,6 +80,20 @@ class Manager : public details::ServerObject<details::ManagerIface>
*/
void restore();
+ /** @brief Erase all error log entries
+ *
+ */
+ void eraseAll()
+ {
+ auto iter = entries.begin();
+ while (iter != entries.end())
+ {
+ auto entry = iter->first;
+ ++iter;
+ erase(entry);
+ }
+ }
+
private:
/** @brief Call metadata handler(s), if any. Handlers may create
* associations.
@@ -104,5 +125,46 @@ class Manager : public details::ServerObject<details::ManagerIface>
bool capped;
};
+} //namespace internal
+
+/** @class Manager
+ * @brief Implementation for delete all error log entries.
+ * @details A concrete implementation for the
+ * xyz.openbmc_project.Collection.DeleteAll
+ */
+class Manager : public DeleteAllIface
+{
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
+ virtual ~Manager() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * Defer signal registration (pass true for deferSignal to the
+ * base class) until after the properties are set.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] path - Path to attach at.
+ * @param[in] manager - Reference to internal manager object.
+ */
+ Manager(sdbusplus::bus::bus& bus,
+ const std::string& path,
+ internal::Manager& manager) :
+ DeleteAllIface(bus, path.c_str(), true),
+ manager(manager) {};
+
+ /** @brief Delete all d-bus objects.
+ */
+ void deleteAll()
+ {
+ manager.eraseAll();
+ }
+ private:
+ /** @brief This is a reference to manager object */
+ internal::Manager& manager;
+};
+
} // namespace logging
} // namespace phosphor
OpenPOWER on IntegriCloud