blob: 2a88bef1debb5e67ff239518fcc176858e34f570 [file] [log] [blame]
Alex Deymo477aec22015-03-24 23:40:48 -07001// 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
Gilad Arnold41e34742015-05-11 11:31:50 -070011#include <chromeos/secure_blob.h>
Sen Jiang8cc502d2015-08-10 10:04:54 -070012
13#include "update_engine/payload_generator/blob_file_writer.h"
Alex Deymo477aec22015-03-24 23:40:48 -070014#include "update_engine/update_metadata.pb.h"
15
16namespace chromeos_update_engine {
17
18struct AnnotatedOperation {
19 // The name given to the operation, for logging and debugging purposes only.
20 // This normally includes the path to the file and the chunk used, if any.
21 std::string name;
22
23 // The InstallOperation, as defined by the protobuf.
24 DeltaArchiveManifest_InstallOperation op;
25
Gilad Arnold41e34742015-05-11 11:31:50 -070026 // Writes |blob| to the end of |data_fd|, and updates |data_file_size| to
27 // match the new size of |data_fd|. It sets the data_offset and data_length
28 // in AnnotatedOperation to match the offset and size of |blob| in |data_fd|.
Sen Jiang8cc502d2015-08-10 10:04:54 -070029 bool SetOperationBlob(chromeos::Blob* blob, BlobFileWriter* blob_file);
Alex Deymo477aec22015-03-24 23:40:48 -070030};
31
32// For logging purposes.
33std::ostream& operator<<(std::ostream& os, const AnnotatedOperation& aop);
34
35std::string InstallOperationTypeName(
36 DeltaArchiveManifest_InstallOperation_Type op_type);
37
38} // namespace chromeos_update_engine
39
40#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_ANNOTATED_OPERATION_H_