Replace is_full_update boolean with a payload_state enum.
The "is_full_update" flag in the InstallPlan is required to decide
whether we should run a FilesystemVerification step before start
downloading the payload (for delta payloads) or not (for full payloads).
This step is done before start downloading the payload and not after
downloading the metadata to avoid long delays in the connection which
would then drop and require a retry.
Since the not so recent inclusion of the source_data_hash field in the
delta operations, the source data is verified on each operation, so the
install plan field and the pre-download FilesystemVerification is not
needed anymore.
To help deprecate this process, which is not included in the non-Brillo
version, this patch changes the is_full_update field to a payload_state
enum with a third "unknown" state that will be changed to delta or full
once the payload metadata is parsed.
Bug: 25631949
TEST=unittests updated.
TEST=Pushed a delta update to edison-eng and a non-Brillo target.
Change-Id: I17d8bf58990d8465bb8487adc66601f1c1dfca6d
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index a2a1b7b..572ff41 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -27,29 +27,21 @@
namespace chromeos_update_engine {
-InstallPlan::InstallPlan(bool is_resume,
- bool is_full_update,
- const string& url,
- uint64_t payload_size,
- const string& payload_hash,
- uint64_t metadata_size,
- const string& metadata_signature,
- const string& public_key_rsa)
- : is_resume(is_resume),
- is_full_update(is_full_update),
- download_url(url),
- payload_size(payload_size),
- payload_hash(payload_hash),
- metadata_size(metadata_size),
- metadata_signature(metadata_signature),
- hash_checks_mandatory(false),
- powerwash_required(false),
- public_key_rsa(public_key_rsa) {}
-
+string InstallPayloadTypeToString(InstallPayloadType type) {
+ switch (type) {
+ case InstallPayloadType::kUnknown:
+ return "unknown";
+ case InstallPayloadType::kFull:
+ return "full";
+ case InstallPayloadType::kDelta:
+ return "delta";
+ }
+ return "invalid type";
+}
bool InstallPlan::operator==(const InstallPlan& that) const {
return ((is_resume == that.is_resume) &&
- (is_full_update == that.is_full_update) &&
+ (payload_type == that.payload_type) &&
(download_url == that.download_url) &&
(payload_size == that.payload_size) &&
(payload_hash == that.payload_hash) &&
@@ -74,7 +66,7 @@
LOG(INFO) << "InstallPlan: "
<< (is_resume ? "resume" : "new_update")
- << ", payload type: " << (is_full_update ? "full" : "delta")
+ << ", payload type: " << InstallPayloadTypeToString(payload_type)
<< ", source_slot: " << BootControlInterface::SlotName(source_slot)
<< ", target_slot: " << BootControlInterface::SlotName(target_slot)
<< ", url: " << download_url
@@ -85,8 +77,7 @@
<< partitions_str
<< ", hash_checks_mandatory: " << utils::ToString(
hash_checks_mandatory)
- << ", powerwash_required: " << utils::ToString(
- powerwash_required);
+ << ", powerwash_required: " << utils::ToString(powerwash_required);
}
bool InstallPlan::LoadPartitionsFromSlots(BootControlInterface* boot_control) {