Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 1 | #pragma once |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 2 | #include "version.hpp" |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 3 | |
| 4 | namespace phosphor |
| 5 | { |
| 6 | namespace software |
| 7 | { |
| 8 | namespace manager |
| 9 | { |
| 10 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 11 | /** @class Manager |
| 12 | * @brief Contains a map of Version dbus objects. |
| 13 | * @details The software image manager class that contains the Version dbus |
| 14 | * objects and their version ids. |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 15 | */ |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 16 | class Manager |
| 17 | { |
| 18 | public: |
| 19 | /** @brief Constructs Manager Class |
| 20 | * |
| 21 | * @param[in] bus - The Dbus bus object |
| 22 | */ |
Saqib Khan | ba23988 | 2017-05-26 08:41:54 -0500 | [diff] [blame] | 23 | Manager(sdbusplus::bus::bus& bus) : bus(bus){}; |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 24 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 25 | /** |
| 26 | * @brief Verify and untar the tarball. Verify the manifest file. |
| 27 | * Create and populate the version and filepath interfaces. |
| 28 | * |
| 29 | * @param[in] tarballFilePath - Tarball path. |
| 30 | * @param[out] result - 0 if successful. |
| 31 | */ |
| 32 | int processImage(const std::string& tarballFilePath); |
| 33 | |
Leonel Gonzalez | 50d559c | 2017-07-07 14:38:25 -0500 | [diff] [blame] | 34 | /** |
| 35 | * @brief Erase specified entry d-bus object |
| 36 | * and deletes the image file. |
| 37 | * |
| 38 | * @param[in] entryId - unique identifier of the entry |
| 39 | */ |
| 40 | void erase(std::string entryId); |
| 41 | |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 42 | private: |
| 43 | /** @brief Persistent map of Version dbus objects and their |
| 44 | * version id */ |
| 45 | std::map<std::string, std::unique_ptr<Version>> versions; |
| 46 | |
| 47 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 48 | sdbusplus::bus::bus& bus; |
| 49 | |
| 50 | /** |
| 51 | * @brief Untar the tarball. |
| 52 | * |
| 53 | * @param[in] tarballFilePath - Tarball path. |
| 54 | * @param[in] extractDirPath - Dir path to extract tarball ball to. |
| 55 | * @param[out] result - 0 if successful. |
| 56 | */ |
| 57 | static int unTar(const std::string& tarballFilePath, |
| 58 | const std::string& extractDirPath); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 59 | }; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 60 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 61 | } // namespace manager |
| 62 | } // namespace software |
| 63 | } // namespace phosphor |