diff options
author | Alex Deymo <deymo@chromium.org> | 2015-03-24 23:40:48 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-27 04:11:05 +0000 |
commit | 477aec2166a571cbe28081d806c3226e8b31b6e9 (patch) | |
tree | 3f31258432bf233ceaaa1d46c9c3990c2d4c00ff /payload_generator/graph_utils.cc | |
parent | 08d5a45ac109292ff80c877c4045335a2f0b917d (diff) |
update_engine: Refactor OperationsGenerator into a base class.
This refactor cleans up the interface of the algorithms that generate
the list of rootfs and kernel operations removing the mention of a
Graph from it. The Graph class is only used by the in-place generator
because it requires to keep track of dependencies between operations
reading or writting the same block. The full update generator, using
only REPLACE or REPLACE_BZ doesn't need to use a graph to do that, but
in order to reuse some code, the interface was hacked that way.
This patch now uses two vectors of "AnnotatedOperations", which are
a mere InstallOperation as defined by the .proto file plus a name
used for logging purposes only. Both rootfs and kernel operations
have now the same type on the interface, allowing to share common
functions handling those.
BUG=chromium:331965
TEST=FEATURES=test emerge-link update_engine
Change-Id: I78566bbecb948634b7ecc8d086766ce67a79b43e
Reviewed-on: https://chromium-review.googlesource.com/262281
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'payload_generator/graph_utils.cc')
-rw-r--r-- | payload_generator/graph_utils.cc | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc index 2d8c0518..3f9b28ff 100644 --- a/payload_generator/graph_utils.cc +++ b/payload_generator/graph_utils.cc @@ -12,6 +12,7 @@ #include <base/macros.h> #include "update_engine/payload_constants.h" +#include "update_engine/payload_generator/annotated_operation.h" using std::make_pair; using std::pair; @@ -138,32 +139,11 @@ void DumpOutEdges(const Vertex::EdgeMap& out_edges) { void DumpGraph(const Graph& graph) { LOG(INFO) << "Graph length: " << graph.size(); for (Graph::size_type i = 0, e = graph.size(); i != e; ++i) { - string type_str = "UNK"; - switch (graph[i].op.type()) { - case DeltaArchiveManifest_InstallOperation_Type_BSDIFF: - type_str = "BSDIFF"; - break; - case DeltaArchiveManifest_InstallOperation_Type_MOVE: - type_str = "MOVE"; - break; - case DeltaArchiveManifest_InstallOperation_Type_REPLACE: - type_str = "REPLACE"; - break; - case DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ: - type_str = "REPLACE_BZ"; - break; - case DeltaArchiveManifest_InstallOperation_Type_SOURCE_COPY: - type_str = "SOURCE_COPY"; - break; - case DeltaArchiveManifest_InstallOperation_Type_SOURCE_BSDIFF: - type_str = "SOURCE_BSDIFF"; - break; - } LOG(INFO) << i << (graph[i].valid ? "" : "-INV") << ": " << graph[i].file_name << " " << graph[i].chunk_size << "@" << graph[i].chunk_offset - << ": " << type_str; + << ": " << InstallOperationTypeName(graph[i].op.type()); LOG(INFO) << " src_extents:"; DumpExtents(graph[i].op.src_extents(), 4); LOG(INFO) << " dst_extents:"; |