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 | |
| 34 | private: |
| 35 | /** @brief Persistent map of Version dbus objects and their |
| 36 | * version id */ |
| 37 | std::map<std::string, std::unique_ptr<Version>> versions; |
| 38 | |
| 39 | /** @brief Persistent sdbusplus DBus bus connection. */ |
| 40 | sdbusplus::bus::bus& bus; |
| 41 | |
| 42 | /** |
| 43 | * @brief Untar the tarball. |
| 44 | * |
| 45 | * @param[in] tarballFilePath - Tarball path. |
| 46 | * @param[in] extractDirPath - Dir path to extract tarball ball to. |
| 47 | * @param[out] result - 0 if successful. |
| 48 | */ |
| 49 | static int unTar(const std::string& tarballFilePath, |
| 50 | const std::string& extractDirPath); |
Gunnar Mills | 3027bba | 2017-04-27 15:49:03 -0500 | [diff] [blame] | 51 | }; |
Gunnar Mills | 19e4ce5 | 2017-04-27 11:24:19 -0500 | [diff] [blame] | 52 | |
Gunnar Mills | e91d321 | 2017-04-19 15:42:47 -0500 | [diff] [blame] | 53 | } // namespace manager |
| 54 | } // namespace software |
| 55 | } // namespace phosphor |