Implement Notify method
This commit implements notify method for notifying the
creation of a new dump.
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: Ieb4fa29965b3a93b3dafa2251f354c44ca12db46
diff --git a/dump_manager.cpp b/dump_manager.cpp
index accd0da..a42fce2 100644
--- a/dump_manager.cpp
+++ b/dump_manager.cpp
@@ -4,6 +4,7 @@
#include "bmc_dump_entry.hpp"
#include "dump_internal.hpp"
+#include "system_dump_entry.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
#include "xyz/openbmc_project/Dump/Create/error.hpp"
@@ -240,5 +241,21 @@
return size;
}
+void Manager::notify(NewDump::DumpType dumpType, uint32_t dumpId, uint64_t size)
+{
+ // Get the timestamp
+ auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+ // Get the id
+ auto id = lastEntryId + 1;
+ auto idString = std::to_string(id);
+ auto objPath = fs::path(OBJ_ENTRY) / idString;
+ entries.insert(std::make_pair(
+ id, std::make_unique<system::Entry>(bus, objPath.c_str(), id, ms, size,
+ dumpId, *this)));
+ lastEntryId++;
+}
+
} // namespace dump
} // namespace phosphor