blob: fd602eabea22733ced86408bc22a9ee9bcb564d9 [file] [log] [blame]
Andrew de los Reyes0ce161b2010-02-22 15:27:01 -08001// Copyright (c) 2009 The Chromium 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_GRAPH_UTILS_H__
6#define CHROMEOS_PLATFORM_UPDATE_ENGINE_GRAPH_UTILS_H__
7
8#include <vector>
9#include "base/basictypes.h"
10#include "update_engine/graph_types.h"
11#include "update_engine/update_metadata.pb.h"
12
13// A few utility functions for graphs
14
15namespace chromeos_update_engine {
16
17namespace graph_utils {
18
19// Returns the number of blocks represented by all extents in the edge.
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070020uint64_t EdgeWeight(const Graph& graph, const Edge& edge);
Andrew de los Reyes0ce161b2010-02-22 15:27:01 -080021
22// block must either be the next block in the last extent or a block
23// in the next extent. This function will not handle inserting block
24// into an arbitrary place in the extents.
Andrew de los Reyes09e56d62010-04-23 13:45:53 -070025void AppendBlockToExtents(std::vector<Extent>* extents, uint64_t block);
Andrew de los Reyes0ce161b2010-02-22 15:27:01 -080026
27} // namespace graph_utils
28
29} // namespace chromeos_update_engine
30
31#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_GRAPH_UTILS_H__