Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <tuple> |
| 3 | #include <systemd/sd-bus.h> |
| 4 | #include <sdbusplus/server.hpp> |
| 5 | |
| 6 | namespace sdbusplus |
| 7 | { |
| 8 | namespace xyz |
| 9 | { |
| 10 | namespace openbmc_project |
| 11 | { |
| 12 | namespace Logging |
| 13 | { |
| 14 | namespace Internal |
| 15 | { |
| 16 | namespace server |
| 17 | { |
| 18 | |
| 19 | class Manager |
| 20 | { |
| 21 | public: |
| 22 | /* Define all of the basic class operations: |
| 23 | * Not allowed: |
| 24 | * - Default constructor to avoid nullptrs. |
| 25 | * - Copy operations due to internal unique_ptr. |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 26 | * - Move operations due to 'this' being registered as the |
| 27 | * 'context' with sdbus. |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 28 | * Allowed: |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 29 | * - Destructor. |
| 30 | */ |
| 31 | Manager() = delete; |
| 32 | Manager(const Manager&) = delete; |
| 33 | Manager& operator=(const Manager&) = delete; |
Adriana Kobylak | f477fe2 | 2017-01-06 11:56:41 -0600 | [diff] [blame] | 34 | Manager(Manager&&) = delete; |
| 35 | Manager& operator=(Manager&&) = delete; |
Adriana Kobylak | 8f7941e | 2016-11-14 14:46:23 -0600 | [diff] [blame] | 36 | virtual ~Manager() = default; |
| 37 | |
| 38 | /** @brief Constructor to put object onto bus at a dbus path. |
| 39 | * @param[in] bus - Bus to attach to. |
| 40 | * @param[in] path - Path to attach at. |
| 41 | */ |
| 42 | Manager(bus::bus& bus, const char* path); |
| 43 | |
| 44 | |
| 45 | |
| 46 | /** @brief Implementation for Commit |
| 47 | * Write the requested error/event entry with its associated metadata fields to flash. |
| 48 | * |
| 49 | * @param[in] transactionId - The unique identifier of the journal entry(ies) to be committed. |
| 50 | * @param[in] errMsg - The error exception message associated with the error event log to be committed. |
| 51 | */ |
| 52 | virtual void commit( |
| 53 | uint64_t transactionId, |
| 54 | std::string errMsg) = 0; |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | private: |
| 60 | |
| 61 | /** @brief sd-bus callback for Commit |
| 62 | */ |
| 63 | static int _callback_Commit( |
| 64 | sd_bus_message*, void*, sd_bus_error*); |
| 65 | |
| 66 | |
| 67 | static constexpr auto _interface = "xyz.openbmc_project.Logging.Internal.Manager"; |
| 68 | static const vtable::vtable_t _vtable[]; |
| 69 | sdbusplus::server::interface::interface |
| 70 | _xyz_openbmc_project_Logging_Internal_Manager_interface; |
| 71 | |
| 72 | |
| 73 | }; |
| 74 | |
| 75 | |
| 76 | } // namespace server |
| 77 | } // namespace Internal |
| 78 | } // namespace Logging |
| 79 | } // namespace openbmc_project |
| 80 | } // namespace xyz |
| 81 | } // namespace sdbusplus |
| 82 | |