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>
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc
index 2d8c051..3f9b28f 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 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:";