AU: Optimize checkpointing a bit and decide on new update vs. resume.
BUG=7390
TEST=unit tests, gmerged on device
Change-Id: Ibed6082fe697e6b28b03fb1cc39d700826bf2bfe
Review URL: http://codereview.chromium.org/3541016
diff --git a/install_plan.h b/install_plan.h
index 19fee8a..8dc42aa 100644
--- a/install_plan.h
+++ b/install_plan.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,20 +15,23 @@
struct InstallPlan {
InstallPlan(bool is_full,
+ bool is_resume,
const std::string& url,
uint64_t size,
const std::string& hash,
const std::string& install_path,
const std::string& kernel_install_path)
: is_full_update(is_full),
+ is_resume(is_resume),
download_url(url),
size(size),
download_hash(hash),
install_path(install_path),
kernel_install_path(kernel_install_path) {}
- InstallPlan() : is_full_update(false) {}
+ InstallPlan() : is_full_update(false), is_resume(false), size(0) {}
bool is_full_update;
+ bool is_resume;
std::string download_url; // url to download from
uint64_t size; // size of the download url's data
std::string download_hash; // hash of the data at the url
@@ -37,11 +40,12 @@
bool operator==(const InstallPlan& that) const {
return (is_full_update == that.is_full_update) &&
- (download_url == that.download_url) &&
- (size == that.size) &&
- (download_hash == that.download_hash) &&
- (install_path == that.install_path) &&
- (kernel_install_path == that.kernel_install_path);
+ (is_resume == that.is_resume) &&
+ (download_url == that.download_url) &&
+ (size == that.size) &&
+ (download_hash == that.download_hash) &&
+ (install_path == that.install_path) &&
+ (kernel_install_path == that.kernel_install_path);
}
bool operator!=(const InstallPlan& that) const {
return !((*this) == that);
@@ -49,6 +53,7 @@
void Dump() const {
LOG(INFO) << "InstallPlan: "
<< (is_full_update ? "full_update" : "delta_update")
+ << (is_resume ? ", resume" : ", new_update")
<< ", url: " << download_url
<< ", size: " << size
<< ", hash: " << download_hash