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

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

Issue 545072: AU: Gut code for old updater. New protobuf for v2 updater. (Closed)
Patch Set: better comments Created 10 years, 11 months 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
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
index 5d422c34f424523d0e712624f2c86963303ef22a..6b232dad8ee557505cbd4ed7d5ef294d77dbcf07 100644
--- a/src/platform/update_engine/delta_diff_generator.h
+++ b/src/platform/update_engine/delta_diff_generator.h
@@ -5,86 +5,12 @@
#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 <set>
-#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.
- // Any paths in nondiff_paths will be included in full, rather than
- // as a diff. This is useful for files that change during postinstall, since
- // future updates can't depend on them having remaining unchanged.
- // Returns true on success.
- // If non-empty, the device at force_compress_dev_path will be compressed.
- static bool EncodeDataToDeltaFile(
- DeltaArchiveManifest* archive,
- const std::string& old_path,
- const std::string& new_path,
- const std::string& out_file,
- const std::set<std::string>& nondiff_paths,
- const std::string& force_compress_dev_path);
-
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,
- DeltaArchiveManifest_File_DataFormat* format,
- bool force_compression);
- // 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,
- const bool avoid_diff,
- DeltaArchiveManifest_File_DataFormat* out_data_format,
- std::vector<char>* out,
- bool* no_change);
-
- // nondiff_paths is passed in to EncodeDataToDeltaFile() with
- // paths relative to the installed system (e.g. /etc/fstab), but
- // WriteFileDiffsToDeltaFile requires always_full_target_paths to be
- // the entire path of the new file.
- // If non-empty, the device at force_compress_dev_path will be compressed.
- 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,
- std::set<std::string> always_full_target_paths,
- const std::string& force_compress_dev_path);
-
// This should never be constructed
DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator);
};

Powered by Google App Engine
This is Rietveld 408576698