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