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