blob: 4ad0ced2596c804898c0a0f26b74ab6b539960f3 [file] [log] [blame]
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06001#pragma once
2
Adriana Kobylakf477fe22017-01-06 11:56:41 -06003#include <sdbusplus/bus.hpp>
Adriana Kobylakdf995fa2017-01-08 15:14:02 -06004#include "elog_entry.hpp"
Adriana Kobylak8f7941e2016-11-14 14:46:23 -06005#include "xyz/openbmc_project/Logging/Internal/Manager/server.hpp"
6
7namespace phosphor
8{
9namespace logging
10{
11namespace details
12{
13
14template <typename T>
15using ServerObject = typename sdbusplus::server::object::object<T>;
16
17using ManagerIface =
18 sdbusplus::xyz::openbmc_project::Logging::Internal::server::Manager;
19
20} // namespace details
21
22/** @class Manager
23 * @brief OpenBMC logging manager implementation.
24 * @details A concrete implementation for the
25 * xyz.openbmc_project.Logging.Internal.Manager DBus API.
26 */
Adriana Kobylakf477fe22017-01-06 11:56:41 -060027class Manager : public details::ServerObject<details::ManagerIface>
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060028{
29 public:
30 Manager() = delete;
31 Manager(const Manager&) = delete;
32 Manager& operator=(const Manager&) = delete;
Adriana Kobylakf477fe22017-01-06 11:56:41 -060033 Manager(Manager&&) = delete;
34 Manager& operator=(Manager&&) = delete;
35 virtual ~Manager() = default;
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060036
Adriana Kobylakf477fe22017-01-06 11:56:41 -060037 /** @brief Constructor to put object onto bus at a dbus path.
38 * @param[in] bus - Bus to attach to.
39 * @param[in] path - Path to attach at.
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060040 */
Adriana Kobylakf477fe22017-01-06 11:56:41 -060041 Manager(sdbusplus::bus::bus& bus, const char* path) :
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060042 details::ServerObject<details::ManagerIface>(bus, path),
43 busLog(bus) {};
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060044
45 /*
46 * @fn commit()
47 * @brief sd_bus Commit method implementation callback.
48 * @details Create an error/event log based on transaction id and
49 * error message.
50 * @param[in] transactionId - Unique identifier of the journal entries
51 * to be committed.
52 * @param[in] errMsg - The error exception message associated with the
53 * error log to be committed.
54 */
55 void commit(uint64_t transactionId, std::string errMsg) override;
Adriana Kobylakdf995fa2017-01-08 15:14:02 -060056
57
58 private:
59 /** @brief Persistent sdbusplus DBus bus connection. */
60 sdbusplus::bus::bus& busLog;
61
62 /** @brief Persistent map of Entry dbus objects and their ID */
63 std::map<uint32_t, std::unique_ptr<Entry>> entries;
Adriana Kobylak8f7941e2016-11-14 14:46:23 -060064};
65
66} // namespace logging
67} // namespace phosphor