Alex Deymo | 477aec2 | 2015-03-24 23:40:48 -0700 | [diff] [blame^] | 1 | // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |
| 6 | #define UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |
| 7 | |
| 8 | #include <ostream> // NOLINT(readability/streams) |
| 9 | #include <string> |
| 10 | |
| 11 | #include "update_engine/update_metadata.pb.h" |
| 12 | |
| 13 | namespace chromeos_update_engine { |
| 14 | |
| 15 | struct AnnotatedOperation { |
| 16 | // The name given to the operation, for logging and debugging purposes only. |
| 17 | // This normally includes the path to the file and the chunk used, if any. |
| 18 | std::string name; |
| 19 | |
| 20 | // The InstallOperation, as defined by the protobuf. |
| 21 | DeltaArchiveManifest_InstallOperation op; |
| 22 | |
| 23 | // Sets |name| to a human readable representation of a chunk in a file. |
| 24 | void SetNameFromFileAndChunk(const std::string& filename, |
| 25 | off_t chunk_offset, off_t chunk_size); |
| 26 | }; |
| 27 | |
| 28 | // For logging purposes. |
| 29 | std::ostream& operator<<(std::ostream& os, const AnnotatedOperation& aop); |
| 30 | |
| 31 | std::string InstallOperationTypeName( |
| 32 | DeltaArchiveManifest_InstallOperation_Type op_type); |
| 33 | |
| 34 | } // namespace chromeos_update_engine |
| 35 | |
| 36 | #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_ |