blob: cf3d043ab6cf5c920f369d028f9f88c79b843712 [file] [log] [blame]
Thieu Le5c7d9752010-12-15 16:09:28 -08001// 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 Vakulenko072359c2014-07-18 11:41:07 -07005#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
6#define UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_
7
8#include <string>
9#include <vector>
Thieu Le5c7d9752010-12-15 16:09:28 -080010
Alex Deymo161c4a12014-05-16 15:56:21 -070011#include "update_engine/payload_generator/delta_diff_generator.h"
12#include "update_engine/payload_generator/graph_types.h"
Thieu Le5c7d9752010-12-15 16:09:28 -080013
14namespace chromeos_update_engine {
15
16class 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 Vakulenko072359c2014-07-18 11:41:07 -070040#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_METADATA_H_