1 #pragma once 2 3 #include "dump_entry.hpp" 4 #include "xyz/openbmc_project/Collection/DeleteAll/server.hpp" 5 6 #include <sdbusplus/bus.hpp> 7 #include <sdbusplus/server/object.hpp> 8 9 namespace phosphor 10 { 11 namespace dump 12 { 13 14 using Iface = sdbusplus::server::object::object< 15 sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll>; 16 17 /** @class Manager 18 * @brief Dump manager base class. 19 * @details A concrete implementation for the 20 * xyz::openbmc_project::Collection::server::DeleteAll. 21 */ 22 class Manager : public Iface 23 { 24 friend class Entry; 25 26 public: 27 Manager() = delete; 28 Manager(const Manager&) = default; 29 Manager& operator=(const Manager&) = delete; 30 Manager(Manager&&) = delete; 31 Manager& operator=(Manager&&) = delete; 32 virtual ~Manager() = default; 33 34 /** @brief Constructor to put object onto bus at a dbus path. 35 * @param[in] bus - Bus to attach to. 36 * @param[in] event - Dump manager sd_event loop. 37 * @param[in] path - Path to attach at. 38 * @param[in] baseEntryPath - Base path of the dump entry. 39 */ 40 Manager(sdbusplus::bus::bus& bus, const char* path, 41 const std::string& baseEntryPath) : 42 Iface(bus, path, true), 43 bus(bus), lastEntryId(0), baseEntryPath(baseEntryPath) 44 { 45 } 46 47 /** @brief Construct dump d-bus objects from their persisted 48 * representations. 49 */ 50 virtual void restore() = 0; 51 52 protected: 53 /** @brief Erase specified entry d-bus object 54 * 55 * @param[in] entryId - unique identifier of the entry 56 */ 57 void erase(uint32_t entryId); 58 59 /** @brief Erase all BMC dump entries and Delete all Dump files 60 * from Permanent location 61 * 62 */ 63 void deleteAll() override; 64 65 /** @brief sdbusplus DBus bus connection. */ 66 sdbusplus::bus::bus& bus; 67 68 /** @brief Dump Entry dbus objects map based on entry id */ 69 std::map<uint32_t, std::unique_ptr<Entry>> entries; 70 71 /** @brief Id of the last Dump entry */ 72 uint32_t lastEntryId; 73 74 /** @bried base object path for the entry object */ 75 std::string baseEntryPath; 76 }; 77 78 } // namespace dump 79 } // namespace phosphor 80