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.h b/payload_consumer/install_plan.h
index e69462d..d2f15fa 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -30,17 +30,15 @@
// parts of the update system about the install that should happen.
namespace chromeos_update_engine {
-struct InstallPlan {
- InstallPlan(bool is_resume,
- bool is_full_update,
- const std::string& url,
- uint64_t payload_size,
- const std::string& payload_hash,
- uint64_t metadata_size,
- const std::string& metadata_signature,
- const std::string& public_key_rsa);
+enum class InstallPayloadType {
+ kUnknown,
+ kFull,
+ kDelta,
+};
- // Default constructor.
+std::string InstallPayloadTypeToString(InstallPayloadType type);
+
+struct InstallPlan {
InstallPlan() = default;
bool operator==(const InstallPlan& that) const;
@@ -54,7 +52,7 @@
bool LoadPartitionsFromSlots(BootControlInterface* boot_control);
bool is_resume{false};
- bool is_full_update{false};
+ InstallPayloadType payload_type{InstallPayloadType::kUnknown};
std::string download_url; // url to download from
std::string version; // version we are installing.