| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 // InstallPlan is a simple struct that contains relevant info for many | 11 // InstallPlan is a simple struct that contains relevant info for many |
| 12 // parts of the update system about the install that should happen. | 12 // parts of the update system about the install that should happen. |
| 13 | 13 |
| 14 namespace chromeos_update_engine { | 14 namespace chromeos_update_engine { |
| 15 | 15 |
| 16 struct InstallPlan { | 16 struct InstallPlan { |
| 17 InstallPlan(bool is_full, | 17 InstallPlan(bool is_full, |
| 18 bool is_resume, |
| 18 const std::string& url, | 19 const std::string& url, |
| 19 uint64_t size, | 20 uint64_t size, |
| 20 const std::string& hash, | 21 const std::string& hash, |
| 21 const std::string& install_path, | 22 const std::string& install_path, |
| 22 const std::string& kernel_install_path) | 23 const std::string& kernel_install_path) |
| 23 : is_full_update(is_full), | 24 : is_full_update(is_full), |
| 25 is_resume(is_resume), |
| 24 download_url(url), | 26 download_url(url), |
| 25 size(size), | 27 size(size), |
| 26 download_hash(hash), | 28 download_hash(hash), |
| 27 install_path(install_path), | 29 install_path(install_path), |
| 28 kernel_install_path(kernel_install_path) {} | 30 kernel_install_path(kernel_install_path) {} |
| 29 InstallPlan() : is_full_update(false) {} | 31 InstallPlan() : is_full_update(false), is_resume(false), size(0) {} |
| 30 | 32 |
| 31 bool is_full_update; | 33 bool is_full_update; |
| 34 bool is_resume; |
| 32 std::string download_url; // url to download from | 35 std::string download_url; // url to download from |
| 33 uint64_t size; // size of the download url's data | 36 uint64_t size; // size of the download url's data |
| 34 std::string download_hash; // hash of the data at the url | 37 std::string download_hash; // hash of the data at the url |
| 35 std::string install_path; // path to install device | 38 std::string install_path; // path to install device |
| 36 std::string kernel_install_path; // path to kernel install device | 39 std::string kernel_install_path; // path to kernel install device |
| 37 | 40 |
| 38 bool operator==(const InstallPlan& that) const { | 41 bool operator==(const InstallPlan& that) const { |
| 39 return (is_full_update == that.is_full_update) && | 42 return (is_full_update == that.is_full_update) && |
| 40 (download_url == that.download_url) && | 43 (is_resume == that.is_resume) && |
| 41 (size == that.size) && | 44 (download_url == that.download_url) && |
| 42 (download_hash == that.download_hash) && | 45 (size == that.size) && |
| 43 (install_path == that.install_path) && | 46 (download_hash == that.download_hash) && |
| 44 (kernel_install_path == that.kernel_install_path); | 47 (install_path == that.install_path) && |
| 48 (kernel_install_path == that.kernel_install_path); |
| 45 } | 49 } |
| 46 bool operator!=(const InstallPlan& that) const { | 50 bool operator!=(const InstallPlan& that) const { |
| 47 return !((*this) == that); | 51 return !((*this) == that); |
| 48 } | 52 } |
| 49 void Dump() const { | 53 void Dump() const { |
| 50 LOG(INFO) << "InstallPlan: " | 54 LOG(INFO) << "InstallPlan: " |
| 51 << (is_full_update ? "full_update" : "delta_update") | 55 << (is_full_update ? "full_update" : "delta_update") |
| 56 << (is_resume ? ", resume" : ", new_update") |
| 52 << ", url: " << download_url | 57 << ", url: " << download_url |
| 53 << ", size: " << size | 58 << ", size: " << size |
| 54 << ", hash: " << download_hash | 59 << ", hash: " << download_hash |
| 55 << ", install_path: " << install_path | 60 << ", install_path: " << install_path |
| 56 << ", kernel_install_path: " << kernel_install_path; | 61 << ", kernel_install_path: " << kernel_install_path; |
| 57 } | 62 } |
| 58 }; | 63 }; |
| 59 | 64 |
| 60 } // namespace chromeos_update_engine | 65 } // namespace chromeos_update_engine |
| 61 | 66 |
| 62 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ | 67 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_INSTALL_PLAN_H__ |
| OLD | NEW |