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/partition_writer.h b/payload_consumer/partition_writer.h
index 79ba665..4b420d2 100644
--- a/payload_consumer/partition_writer.h
+++ b/payload_consumer/partition_writer.h
@@ -46,7 +46,15 @@
// Perform necessary initialization work before InstallOperation can be
// applied to this partition
[[nodiscard]] virtual bool Init(const InstallPlan* install_plan,
- bool source_may_exist);
+ bool source_may_exist,
+ size_t next_op_index);
+
+ // |CheckpointUpdateProgress| will be called after SetNextOpIndex(), but it's
+ // optional. DeltaPerformer may or may not call this everytime an operation is
+ // applied.
+ // |next_op_index| is index of next operation that should be applied.
+ // |next_op_index-1| is the last operation that is already applied.
+ virtual void CheckpointUpdateProgress(size_t next_op_index);
// Close partition writer, when calling this function there's no guarantee
// that all |InstallOperations| are sent to |PartitionWriter|. This function
@@ -73,7 +81,6 @@
ErrorCode* error,
const void* data,
size_t count);
- [[nodiscard]] virtual bool Flush();
// |DeltaPerformer| calls this when all Install Ops are sent to partition
// writer. No |Perform*Operation| methods will be called in the future, and