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 | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame^] | 20 | const std::string& install_path, |
| 21 | const std::string& kernel_install_path) |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 22 | : is_full_update(is_full), |
| 23 | download_url(url), |
| 24 | download_hash(hash), |
Andrew de los Reyes | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame^] | 25 | install_path(install_path), |
| 26 | kernel_install_path(kernel_install_path) {} |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 27 | InstallPlan() : is_full_update(false) {} |
| 28 | |
| 29 | bool is_full_update; |
| 30 | std::string download_url; // url to download from |
| 31 | std::string download_hash; // hash of the data at the url |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 32 | std::string install_path; // path to install device |
Andrew de los Reyes | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame^] | 33 | std::string kernel_install_path; // path to kernel install device |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 34 | |
| 35 | bool operator==(const InstallPlan& that) const { |
| 36 | return (is_full_update == that.is_full_update) && |
| 37 | (download_url == that.download_url) && |
| 38 | (download_hash == that.download_hash) && |
Andrew de los Reyes | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame^] | 39 | (install_path == that.install_path) && |
| 40 | (kernel_install_path == that.kernel_install_path); |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 41 | } |
| 42 | bool operator!=(const InstallPlan& that) const { |
| 43 | return !((*this) == that); |
| 44 | } |
| 45 | void Dump() const { |
| 46 | LOG(INFO) << "InstallPlan: " |
| 47 | << (is_full_update ? "full_update" : "delta_update") |
| 48 | << ", url: " << download_url << ", hash: " << download_hash |
Andrew de los Reyes | f918517 | 2010-05-03 11:07:05 -0700 | [diff] [blame^] | 49 | << ", install_path: " << install_path |
| 50 | << ", kernel_install_path: " << kernel_install_path; |
adlr@google.com | 3defe6a | 2009-12-04 20:57:17 +0000 | [diff] [blame] | 51 | } |
| 52 | }; |
| 53 | |
| 54 | } // namespace chromeos_update_engine |
| 55 | |
| 56 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |