Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 1 | // Copyright (c) 2010 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 | |
Alex Vakulenko | 072359c | 2014-07-18 11:41:07 -0700 | [diff] [blame] | 5 | #ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_ |
| 6 | #define UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 10 | |
Alex Deymo | 161c4a1 | 2014-05-16 15:56:21 -0700 | [diff] [blame] | 11 | #include "update_engine/payload_generator/delta_diff_generator.h" |
| 12 | #include "update_engine/payload_generator/graph_types.h" |
Thieu Le | 5c7d975 | 2010-12-15 16:09:28 -0800 | [diff] [blame] | 13 | |
| 14 | namespace chromeos_update_engine { |
| 15 | |
| 16 | class Metadata { |
| 17 | public: |
| 18 | // Reads metadata from old image and new image and determines |
| 19 | // the smallest way to encode the metadata for the diff. |
| 20 | // If there's no change in the metadata, it creates a MOVE |
| 21 | // operation. If there is a change, the smallest of REPLACE, REPLACE_BZ, |
| 22 | // or BSDIFF wins. It writes the diff to data_fd and updates data_file_size |
| 23 | // accordingly. It also adds the required operation to the graph and adds the |
| 24 | // metadata extents to blocks. |
| 25 | // Returns true on success. |
| 26 | static bool DeltaReadMetadata(Graph* graph, |
| 27 | std::vector<DeltaDiffGenerator::Block>* blocks, |
| 28 | const std::string& old_image, |
| 29 | const std::string& new_image, |
| 30 | int data_fd, |
| 31 | off_t* data_file_size); |
| 32 | |
| 33 | private: |
| 34 | // This should never be constructed. |
| 35 | DISALLOW_IMPLICIT_CONSTRUCTORS(Metadata); |
| 36 | }; |
| 37 | |
| 38 | }; // namespace chromeos_update_engine |
| 39 | |
Alex Vakulenko | 072359c | 2014-07-18 11:41:07 -0700 | [diff] [blame] | 40 | #endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_ |