update_engine: Move InstallOperation to the top level.
The InstallOperation message in the protobuf is a nested message
inside the DeltaArchiveManifest message, making all references to
operation types be very long names like
DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ while most other
messages are not nested in the DeltaArchiveManifest message.
To improve readability and to prepare for future update metadata
changes, this patch moves the InstallOperation message to the top level
and replaces all references to operation types with the new shorter
version like InstallOperation::REPLACE_BZ.
This change only impacts the scope of the generated classes and the
serialized format of the protobuf. This exact same question was
addressed by protobuf maintainers here:
https://groups.google.com/forum/#!topic/protobuf/azWAPa6hP4A
Finally coding style and indentation was automatically updated due to
the shorter names.
BUG=b:23179128
TEST=Unittest still pass.
Change-Id: I55add54265934cd1fd3e9cb786c5d3f784902d17
Reviewed-on: https://chromium-review.googlesource.com/293504
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/delta_performer.h b/delta_performer.h
index 40ab55f..bc48f5d 100644
--- a/delta_performer.h
+++ b/delta_performer.h
@@ -235,8 +235,7 @@
// Returns true if enough of the delta file has been passed via Write()
// to be able to perform a given install operation.
- bool CanPerformInstallOperation(
- const DeltaArchiveManifest_InstallOperation& operation);
+ bool CanPerformInstallOperation(const InstallOperation& operation);
// Checks the integrity of the payload manifest. Returns true upon success,
// false otherwise.
@@ -245,8 +244,7 @@
// Validates that the hash of the blobs corresponding to the given |operation|
// matches what's specified in the manifest in the payload.
// Returns ErrorCode::kSuccess on match or a suitable error code otherwise.
- ErrorCode ValidateOperationHash(
- const DeltaArchiveManifest_InstallOperation& operation);
+ ErrorCode ValidateOperationHash(const InstallOperation& operation);
// Interprets the given |protobuf| as a DeltaArchiveManifest protocol buffer
// of the given protobuf_length and verifies that the signed hash of the
@@ -260,30 +258,23 @@
uint64_t protobuf_length);
// Returns true on success.
- bool PerformInstallOperation(
- const DeltaArchiveManifest_InstallOperation& operation);
+ bool PerformInstallOperation(const InstallOperation& operation);
// These perform a specific type of operation and return true on success.
- bool PerformReplaceOperation(
- const DeltaArchiveManifest_InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformMoveOperation(
- const DeltaArchiveManifest_InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformBsdiffOperation(
- const DeltaArchiveManifest_InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformSourceCopyOperation(
- const DeltaArchiveManifest_InstallOperation& operation,
- bool is_kernel_partition);
- bool PerformSourceBsdiffOperation(
- const DeltaArchiveManifest_InstallOperation& operation,
- bool is_kernel_partition);
+ bool PerformReplaceOperation(const InstallOperation& operation,
+ bool is_kernel_partition);
+ bool PerformMoveOperation(const InstallOperation& operation,
+ bool is_kernel_partition);
+ bool PerformBsdiffOperation(const InstallOperation& operation,
+ bool is_kernel_partition);
+ bool PerformSourceCopyOperation(const InstallOperation& operation,
+ bool is_kernel_partition);
+ bool PerformSourceBsdiffOperation(const InstallOperation& operation,
+ bool is_kernel_partition);
// Returns true if the payload signature message has been extracted from
// |operation|, false otherwise.
- bool ExtractSignatureMessage(
- const DeltaArchiveManifest_InstallOperation& operation);
+ bool ExtractSignatureMessage(const InstallOperation& operation);
// Updates the hash calculator with the bytes in |buffer_|. Then discard the
// content, ensuring that memory is being deallocated. If |do_advance_offset|,