Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(964)

Unified Diff: src/platform/update_engine/delta_diff_generator.h

Issue 465067: Missed new files in last commit
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform/update_engine/delta_diff_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/update_engine/delta_diff_generator.h
diff --git a/src/platform/update_engine/delta_diff_generator.h b/src/platform/update_engine/delta_diff_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f73d06011eb11dc6cd8dc7a128fca1c6a0992c6
--- /dev/null
+++ b/src/platform/update_engine/delta_diff_generator.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2009 The Chromium 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_DELTA_DIFF_GENERATOR_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string>
+#include <vector>
+#include "base/basictypes.h"
+#include "update_engine/file_writer.h"
+#include "update_engine/update_metadata.pb.h"
+
+namespace chromeos_update_engine {
+
+class DeltaDiffGenerator {
+ public:
+ // Encodes the metadata at new_path recursively into a DeltaArchiveManifest
+ // protobuf object. This will only read the filesystem. Children will
+ // be recorded recursively iff they are on the same device as their
+ // parent.
+ // This will set all fields in the DeltaArchiveManifest except for
+ // DeltaArchiveManifest_File_data_* as those are set only when writing
+ // the actual delta file to disk.
+ // Caller is responsible for freeing the returned value.
+ // Returns NULL on failure.
+ static DeltaArchiveManifest* EncodeMetadataToProtoBuffer(
+ const char* new_path);
+
+ // Takes a DeltaArchiveManifest as given from EncodeMetadataToProtoBuffer(),
+ // fill in the missing fields (DeltaArchiveManifest_File_data_*), and
+ // write the full delta out to the output file.
+ // Returns true on success.
+ static bool EncodeDataToDeltaFile(DeltaArchiveManifest* archive,
+ const std::string& old_path,
+ const std::string& new_path,
+ const std::string& out_file);
+ private:
+ // These functions encode all the data about a file that's not already
+ // stored in the DeltaArchiveManifest message into the vector 'out'.
+ // They all return true on success.
+
+ // EncodeLink stores the path the symlink points to.
+ static bool EncodeLink(const std::string& path, std::vector<char>* out);
+ // EncodeDev stores the major and minor device numbers.
+ // Specifically it writes a LinuxDevice message.
+ static bool EncodeDev(const struct stat& stbuf, std::vector<char>* out);
+ // EncodeFile stores the full data, gzipped data, or a binary diff from
+ // the old data. out_data_format will be set to the method used.
+ static bool EncodeFile(const std::string& old_dir,
+ const std::string& new_dir,
+ const std::string& file_name,
+ DeltaArchiveManifest_File_DataFormat* out_data_format,
+ std::vector<char>* out);
+
+ static bool WriteFileDiffsToDeltaFile(DeltaArchiveManifest* archive,
+ DeltaArchiveManifest_File* file,
+ const std::string& file_name,
+ const std::string& old_path,
+ const std::string& new_path,
+ FileWriter* out_file_writer,
+ int* out_file_length);
+
+ // This should never be constructed
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator);
+};
+
+}; // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__
« no previous file with comments | « no previous file | src/platform/update_engine/delta_diff_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698