Diff Update

This project consists of developing an application that generates binary updates between different versions of a file, allowing reconstruction of the latest version from any previous version using encoded insert, delete, and change operations.

Phase 1: Input Parsing and Validation

Parse the command-line inputs and validate file existence and formats.

  • Accept commands create and update with appropriate file arguments
  • Verify that all input files exist and are accessible
  • Handle invalid commands or missing arguments gracefully

Functional Output: The application correctly identifies the operation mode and validates input files


Phase 2: Generating Differences Between Versions

Create a list of operations (insert, delete, change) to transform older versions into the latest version.

  • Compare the latest version with each previous version byte-by-byte
  • Generate operations required to convert each old version to the latest
  • Optimize operations to minimize file size

Functional Output: A complete set of differences (operations) is prepared for all previous versions


Phase 3: Encoding Differences into a Binary File

Encode the generated operations into a compact binary format.

  • Write insert, delete, and change operations into a single .diff file
  • Ensure the binary file contains enough information to reconstruct the latest version
  • Handle large files efficiently

Functional Output: A binary .diff file is created containing all necessary update information


Phase 4: Applying Updates to Previous Versions

Implement functionality to reconstruct the latest version from an old version using the .diff file.

  • Read the .diff file and interpret operations sequentially
  • Apply insert, delete, and change operations to the input old version
  • Create a new file representing the latest version

Functional Output: The latest version is correctly reconstructed from any previous version using the .diff file


Phase 5: Error Handling and Integrity Verification

Ensure reliable updates and handle errors during generation or application of diffs.

  • Validate .diff file integrity before applying updates
  • Catch file access errors, invalid operations, and mismatched versions
  • Provide meaningful error messages to the user

Functional Output: The application handles errors gracefully and prevents corrupted updates


Phase 6: Command-Line Interface and Automation

Provide a user-friendly CLI for both creating diffs and updating files.

  • Support create mode to generate .diff files
  • Support update mode to reconstruct the latest file from a previous version
  • Print progress or summary messages during operations

Functional Output: Users can efficiently create and apply binary updates via the command-line interface