Handle resume of VABC updates by emitting labels
To support resuming an update with Virtual AB Compression, we emit
labels in between operations. After writing all SOURCE_COPY, we
emit label 0. Each time we finished writing an InstallOp, we emit
a label incremented by 1. When resuming, we pass the label to CowWriter.
Test: treehugger
1. update_device.py ota.zip
--extra-headers="SWITCH_SLOT_ON_REBOOT=0"
2. update_device.py ota.zip
3. Verify that 2 did not re-start the entire update,
only fs verification and postinstall may re-run.
Change-Id: I785cd04a35457181621ed7b8c0be9a46b6004b7b
diff --git a/payload_consumer/vabc_partition_writer.h b/payload_consumer/vabc_partition_writer.h
index 5eab23f..7fb2a2c 100644
--- a/payload_consumer/vabc_partition_writer.h
+++ b/payload_consumer/vabc_partition_writer.h
@@ -31,7 +31,8 @@
public:
using PartitionWriter::PartitionWriter;
[[nodiscard]] bool Init(const InstallPlan* install_plan,
- bool source_may_exist) override;
+ bool source_may_exist,
+ size_t next_op_index) override;
~VABCPartitionWriter() override;
[[nodiscard]] std::unique_ptr<ExtentWriter> CreateBaseExtentWriter() override;
@@ -43,7 +44,8 @@
const InstallOperation& operation) override;
[[nodiscard]] bool PerformSourceCopyOperation(
const InstallOperation& operation, ErrorCode* error) override;
- [[nodiscard]] bool Flush() override;
+
+ void CheckpointUpdateProgress(size_t next_op_index) override;
static bool WriteAllCowOps(size_t block_size,
const std::vector<CowOperation>& converted,