adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
| 7 | |
| 8 | #include <string> |
| 9 | #include "chromeos/obsolete_logging.h" |
| 10 | |
| 11 | // InstallPlan is a simple struct that contains relevant info for many |
| 12 | // parts of the update system about the install that should happen. |
| 13 | |
| 14 | namespace chromeos_update_engine { |
| 15 | |
| 16 | struct InstallPlan { |
| 17 | InstallPlan(bool is_full, |
| 18 | const std::string& url, |
| 19 | const std::string& hash, |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 20 | const std::string& install_path) |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 21 | : is_full_update(is_full), |
| 22 | download_url(url), |
| 23 | download_hash(hash), |
Andrew de los Reyes | 1e338b8 | 2010-01-22 14:57:27 -0800 | [diff] [blame] | 24 | install_path(install_path) {} |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 25 | InstallPlan() : is_full_update(false) {} |
| 26 | |
| 27 | bool is_full_update; |
| 28 | std::string download_url; // url to download from |
| 29 | std::string download_hash; // hash of the data at the url |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 30 | std::string install_path; // path to install device |
| 31 | |
| 32 | bool operator==(const InstallPlan& that) const { |
| 33 | return (is_full_update == that.is_full_update) && |
| 34 | (download_url == that.download_url) && |
| 35 | (download_hash == that.download_hash) && |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 36 | (install_path == that.install_path); |
| 37 | } |
| 38 | bool operator!=(const InstallPlan& that) const { |
| 39 | return !((*this) == that); |
| 40 | } |
| 41 | void Dump() const { |
| 42 | LOG(INFO) << "InstallPlan: " |
| 43 | << (is_full_update ? "full_update" : "delta_update") |
| 44 | << ", url: " << download_url << ", hash: " << download_hash |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 45 | << ", install_path: " << install_path; |
| 46 | } |
| 47 | }; |
| 48 | |
| 49 | } // namespace chromeos_update_engine |
| 50 | |
| 51 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |