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