xref: /openbmc/phosphor-debug-collector/faultlog_dump_entry.hpp (revision f39157c877c13886631ed623dba8dcc65751abc4)
1 #pragma once
2 
3 #include "dump_entry.hpp"
4 
5 #include <sdbusplus/bus.hpp>
6 #include <sdbusplus/server/object.hpp>
7 #include <xyz/openbmc_project/Object/Delete/server.hpp>
8 #include <xyz/openbmc_project/Time/EpochTime/server.hpp>
9 
10 #include <filesystem>
11 
12 namespace phosphor
13 {
14 namespace dump
15 {
16 namespace faultlog
17 {
18 template <typename T>
19 using ServerObject = typename sdbusplus::server::object_t<T>;
20 
21 using EntryIfaces = sdbusplus::server::object_t<>;
22 
23 class Manager;
24 
25 /** @class Entry
26  *  @brief OpenBMC Fault Log Dump Entry implementation.
27  */
28 class Entry : virtual public EntryIfaces, virtual public phosphor::dump::Entry
29 {
30   public:
31     Entry() = delete;
32     Entry(const Entry&) = delete;
33     Entry& operator=(const Entry&) = delete;
34     Entry(Entry&&) = delete;
35     Entry& operator=(Entry&&) = delete;
36     ~Entry() = default;
37 
38     /** @brief Constructor for the Dump Entry Object
39      *  @param[in] bus - Bus to attach to.
40      *  @param[in] objPath - Object path to attach to
41      *  @param[in] dumpId - Dump id.
42      *  @param[in] timeStamp - Dump creation timestamp
43      *             in microseconds since the epoch.
44      *  @param[in] fileSize - Dump file size in bytes.
45      *  @param[in] file - Full path of dump file.
46      *  @param[in] status - status of the dump.
47      *  @param[in] originatorId - Id of the originator of the dump
48      *  @param[in] originatorType - Originator type
49      *  @param[in] parent - The dump entry's parent.
50      */
51     Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId,
52           uint64_t timeStamp, uint64_t fileSize,
53           const std::filesystem::path& file,
54           phosphor::dump::OperationStatus status, std::string originatorId,
55           originatorTypes originatorType, phosphor::dump::Manager& parent) :
56         EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
57         phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
58                               status, originatorId, originatorType, parent),
59         file(file)
60     {
61         // Emit deferred signal.
62         this->phosphor::dump::faultlog::EntryIfaces::emit_object_added();
63     }
64 
65     /** @brief Delete this d-bus object.
66      */
67     void delete_() override;
68 
69   private:
70     /** @Dump file path */
71     std::filesystem::path file;
72 };
73 
74 } // namespace faultlog
75 } // namespace dump
76 } // namespace phosphor
77