AU: Speed up full update payload generation by running multiple threads.
Full end-to-end payload generation drops from 140 to 40 seconds on my machine.
BUG=8747
TEST=unit tests, updated through dev server
Change-Id: Ib3934b38a55e043abfa49abb25b2931e529ff768
Review URL: http://codereview.chromium.org/4610001
diff --git a/full_update_generator.h b/full_update_generator.h
new file mode 100644
index 0000000..4b9211c
--- /dev/null
+++ b/full_update_generator.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FULL_UPDATE_GENERATOR_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_FULL_UPDATE_GENERATOR_H__
+
+#include <glib.h>
+
+#include "update_engine/graph_types.h"
+
+namespace chromeos_update_engine {
+
+class FullUpdateGenerator {
+ public:
+ // Given a new rootfs and kernel (|new_image|, |new_kernel_part|), reads them
+ // sequentially, creating a full update of chunk_size chunks. Populates
+ // |graph|, |kernel_ops|, and |final_order|, with data about the update
+ // operations, and writes relevant data to |fd|, updating |data_file_size| as
+ // it does. Only the first |image_size| bytes are read from |new_image|
+ // assuming that this is the actual file system.
+ static bool Run(
+ Graph* graph,
+ const std::string& new_kernel_part,
+ const std::string& new_image,
+ off_t image_size,
+ int fd,
+ off_t* data_file_size,
+ off_t chunk_size,
+ off_t block_size,
+ std::vector<DeltaArchiveManifest_InstallOperation>* kernel_ops,
+ std::vector<Vertex::Index>* final_order);
+
+ private:
+ // This should never be constructed.
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FullUpdateGenerator);
+};
+
+} // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FULL_UPDATE_GENERATOR_H__