blob: 47299ca4a8ba0280603dfefb006d67da56db382e [file] [log] [blame]
Claire Weinan919f71c2022-03-01 19:02:07 -08001#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
12namespace phosphor
13{
14namespace dump
15{
16namespace faultlog
17{
18template <typename T>
Patrick Williams9b18bf22022-07-22 19:26:55 -050019using ServerObject = typename sdbusplus::server::object_t<T>;
Claire Weinan919f71c2022-03-01 19:02:07 -080020
Patrick Williams9b18bf22022-07-22 19:26:55 -050021using EntryIfaces = sdbusplus::server::object_t<>;
Claire Weinan919f71c2022-03-01 19:02:07 -080022
23class Manager;
24
25/** @class Entry
26 * @brief OpenBMC Fault Log Dump Entry implementation.
27 */
28class 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] parent - The dump entry's parent.
48 */
Patrick Williams9b18bf22022-07-22 19:26:55 -050049 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t dumpId,
Claire Weinan919f71c2022-03-01 19:02:07 -080050 uint64_t timeStamp, uint64_t fileSize,
51 const std::filesystem::path& file,
52 phosphor::dump::OperationStatus status,
53 phosphor::dump::Manager& parent) :
54 EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
55 phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
56 status, parent),
57 file(file)
58 {
59 // Emit deferred signal.
60 this->phosphor::dump::faultlog::EntryIfaces::emit_object_added();
61 }
62
63 /** @brief Delete this d-bus object.
64 */
65 void delete_() override;
66
67 private:
68 /** @Dump file path */
69 std::filesystem::path file;
70};
71
72} // namespace faultlog
73} // namespace dump
74} // namespace phosphor