Handle resume of VABC updates by emitting labels
To support resuming an update with Virtual AB Compression, we emit
labels in between operations. Before writing any data to CowWriter, we
emit label 0. After writing all SOURCE_COPY, we emit label 1. Each time
we finished writing an InstallOp, we emit a label incremented by 1. When
resuming, we pass the label to CowWriter.
Test: treehugger
Change-Id: I126efc406286a30a6090a9ce14c65a7d273aee56
diff --git a/payload_consumer/partition_writer.h b/payload_consumer/partition_writer.h
index 1acbddc..a67339e 100644
--- a/payload_consumer/partition_writer.h
+++ b/payload_consumer/partition_writer.h
@@ -25,6 +25,7 @@
#include <gtest/gtest_prod.h>
#include "update_engine/common/dynamic_partition_control_interface.h"
+#include "update_engine/common/prefs_interface.h"
#include "update_engine/payload_consumer/extent_writer.h"
#include "update_engine/payload_consumer/file_descriptor.h"
#include "update_engine/payload_consumer/install_plan.h"
@@ -36,6 +37,7 @@
const InstallPlan::Partition& install_part,
DynamicPartitionControlInterface* dynamic_control,
size_t block_size,
+ PrefsInterface* prefs,
bool is_interactive);
virtual ~PartitionWriter();
static bool ValidateSourceHash(const brillo::Blob& calculated_hash,
@@ -48,6 +50,11 @@
[[nodiscard]] virtual bool Init(const InstallPlan* install_plan,
bool source_may_exist);
+ // This will be called by DeltaPerformer after applying an InstallOp.
+ // |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) {}
+
int Close();
// These perform a specific type of operation and return true on success.
@@ -111,6 +118,8 @@
// Used to avoid re-opening the same source partition if it is not actually
// error corrected.
bool source_ecc_open_failure_{false};
+
+ PrefsInterface* prefs_;
};
namespace partition_writer {
@@ -121,6 +130,7 @@
const InstallPlan::Partition& install_part,
DynamicPartitionControlInterface* dynamic_control,
size_t block_size,
+ PrefsInterface* prefs,
bool is_interactive,
bool is_dynamic_partition);
} // namespace partition_writer