WO2021128371A1 - 差分文件生成方法、增量更新方法、计算设备及存储介质 - Google Patents

差分文件生成方法、增量更新方法、计算设备及存储介质 Download PDF

Info

Publication number
WO2021128371A1
WO2021128371A1 PCT/CN2019/129574 CN2019129574W WO2021128371A1 WO 2021128371 A1 WO2021128371 A1 WO 2021128371A1 CN 2019129574 W CN2019129574 W CN 2019129574W WO 2021128371 A1 WO2021128371 A1 WO 2021128371A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
blocks
block
old
difference
Prior art date
Application number
PCT/CN2019/129574
Other languages
English (en)
French (fr)
Inventor
赵杰
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2019/129574 priority Critical patent/WO2021128371A1/zh
Priority to CN201980100485.2A priority patent/CN114424165A/zh
Publication of WO2021128371A1 publication Critical patent/WO2021128371A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates

Definitions

  • the embodiments of the present application belong to the technical field of incremental update, and in particular relate to a differential file generation method, an incremental update method, a computing device, and a storage medium.
  • Incremental update means that during the update operation, only the places that need to be changed are updated, and the places that do not need to be updated and the places that have been updated will not be updated repeatedly. Incremental update is opposite to complete update. Incremental update technology is widely used in various places where data update is required, such as software update, database update, virus database update, content management system (CMS) update, and routing table update.
  • CMS content management system
  • the first aspect of the embodiments of the present application provides a method for generating a differential file, which is applied to a first computing device, and the method for generating a differential file includes:
  • the difference file is obtained according to the blocks with the same characteristics in the old file and the new file.
  • a second aspect of the embodiments of the present application provides an incremental update method, which is applied to a second computing device, and the incremental update method includes:
  • differential file sent by the first computing device; where the differential file includes differential data corresponding to each group of blocks with the same feature in the old file and the new file;
  • a synthesis operation is performed on the corresponding blocks and difference data in the old file and the difference file to obtain a new file.
  • the third aspect of the embodiments of the present application provides a computing device, including a memory, a processor, and a computer program that is stored in the memory and can run on the processor.
  • the processor executes the computer program as follows The steps of the differential file generation method described in the first aspect or the incremental update method described in the second aspect of the embodiments of the present application.
  • the fourth aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the differential file as described in the first aspect of the embodiments of the present application is realized The step of the generating method or the step of the incremental update method described in the second aspect.
  • FIG. 1 is a schematic diagram of an implementation process of a method for generating a differential file provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of the file composition of a compressed package provided by an embodiment of the present application.
  • Figure 3 is a schematic diagram of an example of file merging provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of an implementation process of an incremental update method provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a first computing device provided by an embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of a second computing device provided by an embodiment of the present application.
  • an embodiment of the present application provides a differential file generation method, which is applied to a first computing device and can be implemented by a processor of the first computing device when running a computer program.
  • the first computing device may be a computing device such as a desktop computer, a notebook computer, a palmtop computer, a cloud server, and an operating device of a content delivery (Content Delivery) platform.
  • the difference file generation method is used to compare or calculate the difference between the old file and the new file, obtain the difference file and send it to the second computing device, and the second computing device is used to synthesize the new file according to the old file and the difference file to realize the pairing Incremental update of old files.
  • the second computing device can be a computing device such as a desktop computer, a notebook computer, a palmtop computer, a cloud server, etc., and it can also be a mobile terminal such as a mobile phone, a tablet computer, a smart bracelet, and a head mounted display (HMD). It can also be self-service terminals, robots, smart home appliances, etc.
  • the differential file generation method includes:
  • Step S101 Divide the old file into several blocks, and divide the new file into several blocks.
  • the new file and the old file are the existing files in the first computing device.
  • the old file refers to the file before the update
  • the new file refers to the file after the update.
  • Old files and new files can be audio files, video files, document files, image files, web application files (WAR (Web Archive file) files), Java archive files (JAR files), enterprise JAR files (EAR files), etc. At least one of them may also be a compressed package compressed by compression software such as WinRar, WinAce, WinZip, or 7-Zip, for example, an application package, which may specifically be an Android application package (APK).
  • API Android application package
  • blocks can be data segments or independent files.
  • a block may be a mutually independent file in a compressed package, and specifically may be a dex file (an executable file on the Android platform), a manifest file, a resource file, etc. in an Android application package.
  • step S101 includes:
  • the old file and the new file can be divided into several independent blocks according to the components of the old file and the new file.
  • a compressed package in Zip format contains at least one file, a central directory (Central Directory), and an end of central directory (End of Central Directory). After each file, there may be a blank area for inserting the identification information of the file. When there is a blank area in the compressed package, you can speed up the decompression speed of the compressed package.
  • Each file in the Zip format compressed package and the blank area after the file can be divided into a first block, and each remaining file without a blank area thereafter can be divided into a first block, the central directory and The end of the central directory is divided into a second block. After each file in the compressed package, there may or may not be a blank area.
  • file composition of the compressed package in Zip format is exemplarily shown, including: file 1, file 2, blank area after file 2, file 3,..., file n, central directory, and central directory End; Among them, file 2 and the following blank area are divided into a first block, file 1, file 3, ..., file n are each divided into a single first block, the central directory and the end of the central directory are Divided into a second block, n ⁇ 1 and n is an integer.
  • Step S102 Combine the blocks with the same feature in the old file into one block, and combine the blocks with the same feature in the new file into one block.
  • a feature is a feature related to the file itself that can be used to distinguish different types of files.
  • file name For example, file name, MD5 value, basic data type, etc.
  • the file name includes the prefix name, suffix name, main name or extension.
  • the components of the compressed package in Zip format include file 1, file 2, the blank area after file 2, the central directory, and the end of the central directory; among them, the file name of file 1 is assets/file1.jpg and the file of file 2
  • the name is res/a.xml
  • the file name of file 3 is assets/file2.png.
  • assets/file1 is the main name
  • assets is the prefix name
  • jpg is the suffix name
  • file name of file 2 is res/a is the main name
  • res is the prefix name
  • xml is the suffix name
  • assets in the file name of file 3 are the prefix name
  • assets/file2 is the main name
  • png is the suffix name.
  • the basic data types are different according to the writing language of the old file and the new file.
  • the C language includes six basic data types: short, int, long, char, float, and double
  • the Java language includes byte, short, int, and long.
  • the characteristic includes at least one of a file name and a basic data type.
  • the file name includes at least one of a main name, a prefix name, and a suffix name.
  • step S102 includes:
  • At least two first blocks with the same feature in the new file are merged into a third block respectively.
  • the number of third blocks is greater than or equal to 0, that is, there may not be two first blocks with the same characteristics.
  • the compressed package in Zip format includes file 1, file 2, the blank area after file 2, file 3, file 4, file 5, the central directory, and the end of the central directory.
  • the blank area after file 2 and file 2 is divided As a first block A, file 1, file 3, file 4, and file 5 are divided into four independent first blocks B, C, D, E, and the central directory and the end of the central directory are divided into a first block.
  • the old file is exemplarily shown as a compressed package, including file 1, file 2, blank area after file 2, file 3, file 4, file 5, central directory and the end of central directory, where ,
  • the blank area after file 2 and file 2 is divided into a first block A
  • file 1, file 3, file 4 and file 5 are divided into four independent first blocks B, C, D, E
  • the central directory and the end of the central directory are divided into a second block 31
  • the first block B and the first block E with the same characteristics are merged into another third block 32
  • the first block C with the same feature is merged into a third block 33.
  • Step S103 Obtain a differential file according to the blocks with the same feature in the old file and the new file.
  • the difference algorithm such as JSDiff, HdiffPatch, Exediff, BSDiff, RTPatch, XDelta, bzip2, etc. can be used to perform differential operations on the blocks with the same features in the old file and the new file.
  • the old file and the new file have the same feature
  • the second block performs a difference operation and performs a difference operation on each group of third blocks with the same characteristics in the old file and the new file.
  • multiple groups of blocks with the same feature can be calculated in parallel.
  • step S103 includes:
  • the difference file includes difference data corresponding to each group of blocks with the same feature in the old file and the new file.
  • step S103 the method further includes:
  • the first computing device partitions its existing old file and new file, calculates the difference between the partitions with the same characteristics in the old file and the new file, obtains the difference file, and then sends the difference file to the first
  • the second computing device the second computing device may partition the existing old file and perform a combined calculation with the received difference file, thereby restoring the new file.
  • the existing old file of the second computing device is the same as the existing old file of the first computing device, and the new file restored by the second computing device is the same as the existing new file of the first computing device.
  • the first computing device includes a communication module, and the step of sending the difference file to the second computing device for incremental update is performed by the processor controlling the communication module of the first computing device.
  • the communication module can be based on Wireless Fidelity (WIFI), Ultra Wide Band (UWB), Bluetooth (Bluetooth), ZigBee protocol (ZigBee), Near Field Communication (NFC), low power Wide Area Network (Low-Power Wide-Area Network, LPWAN), Global Navigation Satellite System (Global Navigation Satellite System, GNSS), Cellular Network (Cellular Network), Wireless Local Area Network (Wireless Local Area Networks, WLAN), Local Area Network (Local Area Network) , LAN), Wide Area Network (Wide Area Network, WAN) and other wireless communication technologies or wired communication technologies.
  • WIFI Wireless Fidelity
  • UWB Ultra Wide Band
  • Bluetooth Bluetooth
  • ZigBee protocol ZigBee protocol
  • NFC Near Field Communication
  • Low power Wide Area Network Low-Power Wide-Area Network
  • LPWAN Global Navigation Satellite System
  • GNSS Global Navigation Satellite System
  • Cellular Network Cellular Network
  • Wireless Local Area Network Wireless Local Area Network
  • WLAN Local Area Network
  • WLAN Local Area Network
  • WLAN Local Area
  • the old file is divided into several blocks, and the new file is divided into several blocks; the blocks with the same characteristics in the old file are merged into one block, and the characteristics in the new file are the same.
  • the blocks of the old file and the new file are combined into one block; the difference file is obtained based on the blocks with the same characteristics in the old file and the new file, which can reduce the amount of data processing and increase the data processing speed, thereby reducing the time occupied by memory; it can also simultaneously compare the same characteristics Blocks are processed in parallel to further increase the data processing speed, further reduce the time occupied by memory, and reduce the requirements for the hardware performance of the first computing device; by sending the difference file to the second computing device for incremental update, the second The computing device does not need to download a new file with a large amount of data or a new compressed package for incremental update.
  • an embodiment of the present application provides an incremental update method, which is applied to a second computing device and can be implemented by a processor of the second computing device when running a computer program.
  • the second computing device can be a computing device such as a desktop computer, a notebook computer, a palmtop computer, and a cloud server, and it can also be a mobile terminal such as a mobile phone, a tablet computer, a smart bracelet, and a head mounted display (HMD). It can also be self-service terminals, robots, smart home appliances, etc.
  • the incremental update method is used to perform a synthetic operation on the existing old file and the difference file sent by the first computing device to obtain a new file, thereby realizing an incremental update to the old file.
  • the incremental update method includes:
  • Step S401 Receive a differential file sent by the first computing device, where the differential file includes differential data corresponding to each group of blocks with the same feature in the old file and the new file.
  • the second computing device after receiving the difference file, performs a synthesis operation on the existing old file and the difference file to obtain a new file, thereby realizing an incremental update to the old file.
  • the second computing device includes a communication module, and step S401 is executed by the processor controlling the communication module of the second computing device.
  • the communication module can be based on Wireless Fidelity (WIFI), Ultra Wide Band (UWB), Bluetooth (Bluetooth), ZigBee protocol (ZigBee), Near Field Communication (NFC), low power Wide Area Network (Low-Power Wide-Area Network, LPWAN), Global Navigation Satellite System (Global Navigation Satellite System, GNSS), Cellular Network (Cellular Network), Wireless Local Area Network (Wireless Local Area Networks, WLAN), Local Area Network (Local Area Network) , LAN), Wide Area Network (Wide Area Network, WAN) and other wireless communication technologies or wired communication technologies.
  • WIFI Wireless Fidelity
  • UWB Ultra Wide Band
  • Bluetooth Bluetooth
  • ZigBee protocol ZigBee protocol
  • NFC Near Field Communication
  • Low power Wide Area Network Low-Power Wide-Area Network
  • LPWAN Global Navigation Satellite System
  • GNSS Global Navigation Satellite System
  • Cellular Network Cellular Network
  • Wireless Local Area Network Wireless Local Area Network
  • WLAN Local Area Network
  • WLAN Local Area Network
  • WLAN Local Area
  • Step S402 Divide the old file into several blocks.
  • the old file is the same file existing in the second computing device as the old file in the first computing device.
  • Old files can be at least one of audio files, video files, document files, image files, web application files (WAR (Web Archive file) files), Java archive files (JAR files), enterprise JAR files (EAR files), etc. It may also be a compressed package compressed by compression software such as WinRar, WinAce, WinZip, or 7-Zip, for example, an application package, which may specifically be an Android application package (APK).
  • WAR Web Archive file
  • Java archive files JAR files
  • EAR files enterprise JAR files
  • It may also be a compressed package compressed by compression software such as WinRar, WinAce, WinZip, or 7-Zip, for example, an application package, which may specifically be an Android application package (APK).
  • API Android application package
  • step S402 includes:
  • the old file can be divided into several independent blocks according to the components of the old file.
  • a compressed package in Zip format contains at least one file, a central directory (Central Directory), and an end of central directory (End of Central Directory). After each file, there may be a blank area for inserting the identification information of the file. When there is a blank area in the compressed package, you can speed up the decompression speed of the compressed package.
  • Each file in the Zip format compressed package and the blank area after the file can be divided into a first block, and each remaining file without a blank area thereafter can be divided into a first block, the central directory and The end of the central directory is divided into a second block. After each file in the compressed package, there may or may not be a blank area.
  • Step S403 Combine blocks with the same feature in the old file into one block.
  • a feature is a feature related to the file itself that can be used to distinguish different types of files.
  • file name For example, file name, MD5 value, basic data type, etc.
  • the file name includes the prefix name, suffix name, main name or extension.
  • the components of a compressed package in Zip format include file 1, file 2, the blank area after file 2, the central directory, and the end of the central directory; among them, the file name of file 1 is assets/file1.jpg, and the file name of file 2 is assets/file1.jpg.
  • the name of the file is res/a.xml, and the file name of file 3 is assets/file2.png.
  • assets/file1 is the main name
  • assets is the prefix name
  • jpg is the suffix name
  • the file of file 2 is In the name
  • res/a is the main name
  • res is the prefix name
  • xml is the suffix name
  • assets is the prefix name
  • assets/file2 is the main name
  • png is the suffix name.
  • the basic data types are different according to the writing language of the old file and the new file.
  • the C language includes six basic data types: short, int, long, char, float, and double
  • the Java language includes byte, short, int, and long.
  • the characteristic includes at least one of a file name and a basic data type.
  • the file name includes at least one of a main name, a prefix name, and a suffix name.
  • step S403 includes:
  • At least two first blocks with the same feature in the old file are merged into a third block respectively.
  • the number of third blocks is greater than or equal to 0, that is, there may not be two first blocks with the same characteristics.
  • the compressed package in Zip format includes file 1, file 2, the blank area after file 2, file 3, file 4, file 5, the central directory, and the end of the central directory.
  • the blank area after file 2 and file 2 is divided As a first block A, file 1, file 3, file 4, and file 5 are divided into four independent first blocks B, C, D, E, and the central directory and the end of the central directory are divided into a first block.
  • Step S404 According to the characteristics of the blocks, a synthesis operation is performed on the corresponding blocks and the difference data in the old file and the difference file to obtain a new file.
  • the BSPatch algorithm can be used to synthesize the corresponding block and difference data in the old file and the difference file, for example, the second block in the old file and the difference file and the corresponding difference data. , Perform a synthesis operation on each third block in the old file and the difference file and the corresponding difference file.
  • parallel calculations can be performed on multiple sets of corresponding blocks and difference data.
  • step S404 includes:
  • the second block and difference data corresponding to the old file and the difference file and the third block and difference data corresponding to each group are synthesized to obtain the new file.
  • step S404 the method includes:
  • the blocks with the same characteristics in the old file are merged before the synthesis operation, the blocks with the same characteristics in the new file are merged together. Therefore, the blocks with the same characteristics in the new file need to be merged. Perform difference, and then re-order the components of the old file before the synthesis operation, so that the order of the components in the new file and the old file is the same.
  • the difference file sent by the first computing device is received; the old file is divided into several blocks; the blocks with the same characteristics in the old file are merged into one block; Feature: Perform synthesis operation on the corresponding blocks and difference data in the old file and the difference file to obtain a new file, which can reduce the file size of the synthesis operation, increase the synthesis operation speed, and reduce the time occupied by the memory; Multiple sets of corresponding blocks and differential data are calculated in parallel to further increase the speed of synthesis calculations, further reduce the time occupied by memory, and reduce the requirements for the hardware performance of the second computing device; increase by downloading differential files with a small amount of data The second computing device does not need to download new files or new compressed packages with a large amount of data for incremental update, which can effectively reduce the data traffic consumed by the second computing device for incremental updates, so that the second computing device does not need to be updated. Performing a differential operation on the old file and the new file reduces the amount of data calculation and calculation time when the second computing device
  • an embodiment of the present application provides a first computing device 5, which includes: a communication module 50, a processor 51, a memory 52, and a computer stored in the memory 52 and running on the processor 51 Program 53, such as a difference file generation program.
  • Program 53 such as a difference file generation program.
  • the computer program 53 may be divided into one or more units, and the one or more units are stored in the memory 52 and executed by the processor 51 to complete the present invention.
  • One or more units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 53 in the first computing device 5.
  • the computer program 53 can be divided into a region unit 531, a merging unit 532, and a difference file generating unit 533.
  • the specific functions of each unit are as follows:
  • the partition unit 531 is used to divide the old file into several blocks, and divide the new file into several blocks;
  • the merging unit 532 is used to merge blocks with the same characteristics in the old file into one block, and merge blocks with the same characteristics in the new file into one block;
  • the difference file generating unit 533 is configured to obtain the difference file according to the blocks with the same characteristics in the old file and the new file.
  • the computer program 53 may be divided into sending units for sending the difference file to the second computing device for incremental update.
  • the first computing device 5 may be a computing device such as a desktop computer, a notebook computer, a palmtop computer, a cloud server, and an operating device of a content distribution platform.
  • the first computing device 5 may include, but is not limited to, a communication module 50, a processor 51, and a memory 52.
  • FIG. 5 is only an example of the first computing device 5, and does not constitute a limitation on the first computing device 5. It may include more or less components than shown in the figure, or combine certain components. Or different components, for example, the first computing device may also include an input/output device, a network access device, a bus, and so on.
  • the processor 51 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and application specific integrated circuits (ASICs). ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 52 may be an internal storage unit of the first computing device 5, such as a hard disk or a memory of the first computing device 5.
  • the memory 52 may also be an external storage device of the first computing device 5, such as a plug-in hard disk equipped on the first computing device 5, a Smart Media Card (SMC), or a Secure Digital (SD) card. Flash Card, etc.
  • the memory may also include both an internal storage unit of the first computing device 5 and an external storage device.
  • the memory 52 is used to store computer programs and other programs and data required by the first computing device.
  • the memory 52 can also be used to temporarily store data that has been output or will be output.
  • an embodiment of the present application provides a second computing device 6, which includes: a communication module 60, a processor 61, a memory 62, and a computer stored in the memory 62 and running on the processor 61 Program 63, for example, incremental update program.
  • Program 63 for example, incremental update program.
  • the computer program 63 may be divided into one or more units, and the one or more units are stored in the memory 62 and executed by the processor 61 to complete the present invention.
  • One or more units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 63 in the second computing device 6.
  • the computer program 63 can be divided into a receiving unit 631, a partitioning unit 632, a merging unit 633, and a synthesis operation unit 634.
  • the specific functions of each unit are as follows:
  • the receiving unit 631 is configured to receive the difference file sent by the first computing device; where the difference file includes the difference data corresponding to each group of blocks with the same feature in the old file and the new file;
  • the partition unit 632 is used to divide the old file into several blocks
  • the merging unit 633 is used to merge blocks with the same feature in the old file into one block;
  • the synthesis operation unit 634 is configured to perform synthesis operations on the corresponding blocks and difference data in the old file and the difference file according to the characteristics of the blocks to obtain a new file.
  • the computer program 63 may also be divided into splitting units, which are used to split blocks with the same characteristics in the new file and reorder them according to the components of the old file before the synthesis operation.
  • the second computing device 6 may be a computing device such as a desktop computer, a notebook computer, a palmtop computer, and a cloud server.
  • the second computing device 6 may include, but is not limited to, a communication module 60, a processor 61, and a memory 62.
  • FIG. 6 is only an example of the second computing device 6 and does not constitute a limitation on the second computing device 6. It may include more or less components than shown in the figure, or combine certain components. Or different components, for example, the second computing device may also include an input/output device, a network access device, a bus, and so on.
  • the processor 61 can be a central processing unit, or other general-purpose processors, digital signal processors, application specific integrated circuits, field programmable gate arrays or other programmable logic devices, discrete gates or transistor logic devices, discrete Hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 62 may be an internal storage unit of the second computing device 6, for example, the hard disk or memory of the second computing device 6.
  • the memory 62 may also be an external storage device of the second computing device 6, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc., equipped on the second computing device 6. Further, the memory may also include both an internal storage unit of the second computing device 6 and an external storage device.
  • the memory 62 is used to store computer programs and other programs and data required by the second computing device.
  • the memory 62 can also be used to temporarily store data that has been output or will be output.
  • the disclosed terminal and method may be implemented in other ways.
  • the terminal embodiments described above are only illustrative, for example, the division of units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, terminals or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the present invention implements all or part of the processes in the above-mentioned embodiment methods, and can also be completed by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium, and the computer program can be stored in a computer-readable storage medium.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may include: any entity or terminal capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access Memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal, software distribution medium, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种差分文件生成方法、增量更新方法、计算设备及存储介质。本方案通过将旧文件划分成若干区块,将新文件划分成若干区块(S101);并将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块(S102);然后根据旧文件与新文件中特征相同的区块获得差分文件(S103),能够降低数据处理量,提高数据处理速度,从而减少占用内存的时间。

Description

差分文件生成方法、增量更新方法、计算设备及存储介质 技术领域
本申请实施例属于增量更新技术领域,尤其涉及一种差分文件生成方法、增量更新方法、计算设备及存储介质。
背景技术
增量更新是指在进行更新操作时,只更新需要改变的地方,不需要更新的地方和已经更新过的地方不会重复更新,增量更新与完全更新相对。增量更新技术广泛应用与各种需要进行数据更新的地方,例如,软件更新、数据库更新、病毒库更新、内容管理系统(Content Management System,CMS)更新和路由表更新等。
发明内容
本申请实施例第一方面提供一种差分文件生成方法,应用于第一计算设备,所述差分文件生成方法包括:
将旧文件划分成若干区块,将新文件划分成若干区块;
将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块;
根据旧文件与新文件中特征相同的区块获得差分文件。
本申请实施例第二方面提供一种增量更新方法,应用于第二计算设备,所述增量更新方法包括:
接收第一计算设备发送的差分文件;其中,差分文件包括旧文件与新文件中每组特征相同的区块对应的差分数据;
将旧文件划分成若干区块;
将旧文件中特征相同的区块合并成一个区块;
根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件。
本申请实施例第三方面提供一种计算设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如本申请实施例第一方面所述差分文件生成方法的步骤或第二方面所述增量更新方法的步骤。
本申请实施例第四方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如本申请实施例第一方面所述差分文件生成方法的步骤或第二方面所述增量更新方法的步骤。
附图说明
为了更清楚地说明本申请实施例中的技术申请,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的差分文件生成方法的实现流程示意图;
图2是本申请实施例提供的压缩包的文件组成示意图;
图3是本申请实施例提供的文件合并示例的示意图;
图4是本申请实施例提供的增量更新方法的实现流程示意图;
图5是本申请实施例提供的第一计算设备的结构示意图;
图6是本申请实施例提供的第二计算设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请申请,下面将结合本申请实施例中的附图,对本申请实施例中的技术申请进行清楚地描述,显然,所描述的实施例是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“包括”以及它们任何变形,意图在于覆盖不排他的包含。此外,术语“第一”和“第二”等是用于区别不同对象,而非用于描述特定顺序。
如图1所示,本申请的一个实施例提供一种差分文件生成方法,应用于第一计算设备,可以由第一计算设备的处理器在运行计算机程序时实现。第一计算设备可以是桌上型计算机、笔记本电脑、掌上电脑、云端服务器、内容分发(Content Delivery)平台的运行设备等计算设备。所述差分文件生成方法用于比较或计算旧文件和新文件之间的差异,获得差分文件并发送给第二计算设备,第二计算设备用于根据旧文件和差分文件合成新文件,实现对旧文件的增量更新。第二计算设备可以是桌上型计算机、笔记本电脑、掌上电脑、云端服务器等计算设备,还可以是手机、平板电脑、智能手环、头戴式显示器(Head Mounted Display,HMD)等移动终端,还可以是自助终端机、机器人、智能家电等。所述差分文件生成方法包括:
步骤S101、将旧文件划分成若干区块,将新文件划分成若干区块。
在应用中,新文件和旧文件是第一计算设备中已有的文件。旧文件是指更新之前的文件,新文件是指更新之后的文件。旧文件和新文件可以是音频文件、视频文件、文档文件、图像文件、网络应用程序文件(WAR(Web Archive file)文件)、Java归档文件(JAR文件)、企业JAR文件(EAR文件)等中的至少一种,也可以是通过WinRar、WinAce、WinZip 或7-Zip等压缩软件压缩而成的压缩包,例如,应用程序包,具体可以为安卓应用程序包(Android application package,APK)。
在应用中,区块可以是数据段或者独立文件。例如,区块可以是压缩包中相互独立的文件,具体可以是安卓应用程序包中的dex文件(安卓平台上的可执行文件)、清单文件、资源文件等。
在一个实施例中,旧文件和新文件均为压缩包,步骤S101包括:
将旧文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块;
将新文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块。
在应用中,可以根据旧文件和新文件的组成部分,将旧文件和新文件划分成若干个独立的区块。例如,Zip格式的压缩包中包含至少一个文件、一个中央目录(Central Directory)和中央目录结尾(End of Central Directory),每个文件之后可能会存在用于插入该文件的标识信息的空白区,压缩包中存在空白区时,可以加快压缩包的解压速度。可以将Zip格式的压缩包中的每个文件和该文件之后存在的空白区划分成一个第一区块、剩余的其后不存在空白区的每个文件划分为一个第一区块,中央目录和中央目录结尾划分成一个第二区块。压缩包中的每个文件之后都可能存在或者不存在空白区。
如图2所示,示例性的示出了Zip格式的压缩包的文件组成,包括:文件1、文件2、位于文件2之后的空白区、文件3、…、文件n、中央目录和中央目录结尾;其中,文件2和其后的空白区被划分为一个第一区块,文件1、文件3、…、文件n各被划分成一个单独的第一区块,中央目录和中央目录结尾被划分为一个第二区块,n≥1且n为整数。
步骤S102、将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块。
在应用中,特征是与文件本身相关的可用于对不同类型的文件进行区分的特性。例如,文件名、MD5值、基本数据类型等。文件名包括前缀名、后缀名、主名或扩展名。假设Zip格式的压缩包的组成部分,包括文件1、文件2、位于文件2之后的空白区、中央目录和中央目录结尾;其中,文件1的文件名为assets/file1.jpg,文件2的文件名为res/a.xml,文件3的文件名为assets/file2.png,则文件1的文件名中assets/file1为主名、assets为前缀名、jpg为后缀名,文件2的文件名中res/a为主名、res为前缀名、xml为后缀名,文件3的文件名中为assets为前缀名、assets/file2为主名、png为后缀名。根据旧文件和新文件的编写语言的不同基本数据类型也不相同,例如,C语言包括short、int、long、char、float、 double六种基本数据类型,Java语言包括byte、short、int、long、float、double、char、boolean八种数据类型。
在一个实施例中,所述特征包括文件名和基本数据类型中的至少一种。
在一个实施例中,所述文件名包括主名、前缀名和后缀名中的至少一种。
在一个实施例中,步骤S102包括:
分别将旧文件中特征相同的至少两个第一区块合并成一个第三区块;
分别将新文件中特征相同的至少两个第一区块合并成一个第三区块。
在应用中,第三区块的数量大于或等于0,也即可能并不存在特征相同的两个第一区块。假设Zip格式的压缩包包括文件1、文件2、位于文件2之后的空白区、文件3、文件4、文件5、中央目录和中央目录结尾,其中,文件2和文件2之后的空白区被划分为一个第一区块A,文件1、文件3、文件4和文件5被划分为四个相互独立的第一区块B、C、D、E,中央目录和中央目录结尾被划分为一个第二区块;其中,特征相同第一区块A和特征相同的第一区块C被合并成一个第三区块,特征相同的第一区块B和第一区块E被合并成另一个第三区块,未找到与第一区块D特征相同的区块,因此,第一区块D未被合并。
如图3所示,示例性的示出了旧文件为压缩包,包括文件1、文件2、位于文件2之后的空白区、文件3、文件4、文件5、中央目录和中央目录结尾,其中,文件2和文件2之后的空白区被划分为一个第一区块A,文件1、文件3、文件4和文件5被划分为四个相互独立的第一区块B、C、D、E,中央目录和中央目录结尾被划分为一个第二区块31,特征相同的第一区块B和第一区块E被合并成另一个第三区块32,特征相同第一区块A和特征相同的第一区块C被合并成一个第三区块33,未找到与第一区块D特征相同的区块时,压缩包中的区块的合并情况。
步骤S103、根据旧文件与新文件中特征相同的区块获得差分文件。
在应用中,可以比较旧文件与新文件中每组特征相同的区块之间的差异,获得每组特征相同的区块之间的差分数据,然后生成包括每组特征相同的区块对应的差分数据的差分文件;也可以对旧文件与新文件中每组特征相同的区块进行差分运算,获得每组特征相同的区块之间的差分数据,然后生成包括每组特征相同的区块对应的差分数据的差分文件。
在应用中,可以通过JSDiff、HdiffPatch、Exediff、BSDiff、RTPatch、XDelta、bzip2等差分算法对旧文件与新文件中特征相同的区块进行差分运算,例如,对旧文件与新文件中特征相同的第二区块进行差分运算以及对旧文件与新文件中每组特征相同的第三区块进行差分运算。在进行差分运算时,可以对多组特征相同的区块进行并行计算。
在一个实施例中,步骤S103包括:
分别比较旧文件与新文件中每组特征相同的区块之间的差异,并根据比较结果生成差分文件;
或者,对旧文件与新文件中每组特征相同的区块进行差分运算,获得差分文件;
其中,差分文件包括旧文件与新文件中每组特征相同的区块对应的差分数据。
在一个实施例中,步骤S103之后,还包括:
将差分文件发送给第二计算设备进行增量更新。
在应用中,第一计算设备对其已有的旧文件和新文件进行分区,并计算旧文件与新文件中特征相同的分区之间的差异,获得的差分文件,然后将差分文件发送给第二计算设备,第二计算设备可以对其已有的旧文件进行分区之后和接收到的差分文件进行合并计算,从而还原出新文件。第二计算设备已有的旧文件与第一计算设备已有的旧文件相同,第二计算设备还原出的新文件与第一计算设备已有的新文件相同。第一计算设备包括通信模块,将差分文件发送给第二计算设备进行增量更新的步骤由第一计算设备的处理器控制通信模块执行。通信模块可以是基于无线保真(Wireless Fidelity,WIFI)、超宽带(Ultra Wide Band,UWB)、蓝牙(Bluetooth)、紫蜂协议(ZigBee)、近场通信(Near Field Communication,NFC)、低功率广域网络(Low-Power Wide-Area Network,LPWAN)、全球导航卫星系统(Global Navigation Satellite System,GNSS)、蜂窝网络(Cellular network)、无线局域网(Wireless Local Area Networks,WLAN)、局域网(Local Area Network,LAN)、广域网(Wide Area Network,WAN)等无线通信技术或有线通信技术中的至少一种实现。
图1所对应的上述实施例中通过将旧文件划分成若干区块,将新文件划分成若干区块;并将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块;根据旧文件与新文件中特征相同的区块获得差分文件,能够降低数据处理量,提高数据处理速度,从而减少占用内存的时间;还可以同时对特征相同的区块进行并行处理,进一步提高数据处理速度,并进一步减少占用内存的时间,降低对第一计算设备的硬件性能的要求;通过将差分文件发送给第二计算设备进行增量更新,使得第二计算设备无需下载数据量较大的新文件或新压缩包进行增量更新,只需下载数据量较小的差分文件进行增量更新,可以有效减少第二计算设备进行增量更新时耗费的数据流量,使得第二计算设备无需再获取旧文件和新文件的差分文件,降低了第二计算设备进行增量更新时的数据计算量和计算时间。
如图4所示,本申请的一个实施例提供一种增量更新方法,应用于第二计算设备,可以由第二计算设备的处理器在运行计算机程序时实现。第二计算设备可以是桌上型计算机、 笔记本电脑、掌上电脑及云端服务器等计算设备,还可以是手机、平板电脑、智能手环、头戴式显示器(Head Mounted Display,HMD)等移动终端,还可以是自助终端机、机器人、智能家电等。所述增量更新方法用于对已有的旧文件和第一计算设备发送的差分文件进行合成运算,获得新文件,从而实现对旧文件的增量更新。通过第一计算设备获得差分文件的方法详见上述实施例提供的增量更新方法,本实施例中不在赘述。所述增量更新方法包括:
步骤S401、接收第一计算设备发送的差分文件其中,差分文件包括旧文件与新文件中每组特征相同的区块对应的差分数据。
在应用中,第二计算设备接收到差分文件之后,将已有的旧文件与差分文件进行合成运算,获得新文件,从而实现对旧文件的增量更新。第二计算设备包括通信模块,步骤S401由第二计算设备的处理器控制通信模块执行。通信模块可以是基于无线保真(Wireless Fidelity,WIFI)、超宽带(Ultra Wide Band,UWB)、蓝牙(Bluetooth)、紫蜂协议(ZigBee)、近场通信(Near Field Communication,NFC)、低功率广域网络(Low-Power Wide-Area Network,LPWAN)、全球导航卫星系统(Global Navigation Satellite System,GNSS)、蜂窝网络(Cellular network)、无线局域网(Wireless Local Area Networks,WLAN)、局域网(Local Area Network,LAN)、广域网(Wide Area Network,WAN)等无线通信技术或有线通信技术中的至少一种实现。
步骤S402、将旧文件划分成若干区块。
在应用中,旧文件是第二计算设备中已有的与第一计算设备中的旧文件相同的文件。旧文件可以是音频文件、视频文件、文档文件、图像文件、网络应用程序文件(WAR(Web Archive file)文件)、Java归档文件(JAR文件)、企业JAR文件(EAR文件)等中的至少一种,也可以是通过WinRar、WinAce、WinZip或7-Zip等压缩软件压缩而成的压缩包,例如,应用程序包,具体可以为安卓应用程序包(Android application package,APK)。
在一个实施例中,所述旧文件为压缩包,步骤S402包括:
将旧文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块。
在应用中,可以根据旧文件组成部分,将旧文件划分成若干个独立的区块。例如,
例如,Zip格式的压缩包中包含至少一个文件、一个中央目录(Central Directory)和中央目录结尾(End of Central Directory),每个文件之后可能会存在用于插入该文件的标识信息的空白区,压缩包中存在空白区时,可以加快压缩包的解压速度。可以将Zip格式的压缩包中的每个文件和该文件之后存在的空白区划分成一个第一区块、剩余的其后不存在 空白区的每个文件划分为一个第一区块,中央目录和中央目录结尾划分成一个第二区块。压缩包中的每个文件之后都可能存在或者不存在空白区。
步骤S403、将旧文件中特征相同的区块合并成一个区块。
在应用中,特征是与文件本身相关的可用于对不同类型的文件进行区分的特性。例如,文件名、MD5值、基本数据类型等。文件名包括前缀名、后缀名、主名或扩展名。例如,假设Zip格式的压缩包的组成部分,包括文件1、文件2、位于文件2之后的空白区、中央目录和中央目录结尾;其中,文件1的文件名为assets/file1.jpg,文件2的文件名为res/a.xml,文件3的文件名为assets/file2.png,则文件1的文件名中assets/file1为主名、assets为前缀名、jpg为后缀名,文件2的文件名中res/a为主名、res为前缀名、xml为后缀名,文件3的文件名中为assets为前缀名、assets/file2为主名、png为后缀名。根据旧文件和新文件的编写语言的不同基本数据类型也不相同,例如,C语言包括short、int、long、char、float、double六种基本数据类型,Java语言包括byte、short、int、long、float、double、char、boolean八种数据类型。
在一个实施例中,所述特征包括文件名和基本数据类型中的至少一种。
在一个实施例中,所述文件名包括主名、前缀名和后缀名中的至少一种。
在一个实施例中,步骤S403包括:
分别将旧文件中特征相同的至少两个第一区块合并成一个第三区块。
在应用中,第三区块的数量大于或等于0,也即可能并不存在特征相同的两个第一区块。假设Zip格式的压缩包包括文件1、文件2、位于文件2之后的空白区、文件3、文件4、文件5、中央目录和中央目录结尾,其中,文件2和文件2之后的空白区被划分为一个第一区块A,文件1、文件3、文件4和文件5被划分为四个相互独立的第一区块B、C、D、E,中央目录和中央目录结尾被划分为一个第二区块;其中,特征相同第一区块A和特征相同的第一区块C被合并成一个第三区块,特征相同的第一区块B和第一区块E被合并成另一个第三区块,未找到与第一区块D特征相同的区块,因此,第一区块D未被合并。
步骤S404、根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件。
在应用中,可以通过BSPatch算法来对对旧文件与差分文件中对应的区块和差分数据进行合成运算,例如,对旧文件与差分文件中的第二区块和对应的差分数据进行合成运算、对旧文件与差分文件中的每个第三区块和对应的差分文件进行合成运算。在进行合成运算时,可以对多组对应的区块和差分数据进行并行计算。
在一个实施例中,步骤S404包括:
根据第二区块的特征和第三区块的特征,分别对旧文件与差分文件中对应的第二区块和差分数据以及每组对应的第三区块和差分数据进行合成运算,获得新文件。
在一个实施例中,步骤S404之后包括:
拆分新文件中特征相同的区块并按照进行合成运算之前旧文件的组成部分重新排序。
在应用中,由于在进行合成运算之前,对旧文件中特征相同的区块进行了合并处理,导致新文件中特征相同的区块合并在一起,因此,需要对新文件中特征相同的区块进行差分,然后按照进行合成运算之前旧文件的组成部分重新排序,使得新文件与旧文件中的组成部分的顺序相同。
图4所对应的上述实施例中通过接收第一计算设备发送的差分文件;将旧文件划分成若干区块;并将旧文件中特征相同的区块合并成一个区块;然后根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件,能够减小进行合成运算的文件大小,提高合成运算速度,从而减少占用内存的时间;还可以同时对多组对应的区块和差分数据进行并行计算,进一步提高合成运算速度,并进一步减少占用内存的时间,降低对第二计算设备的硬件性能的要求;通过下载数据量较小的差分文件进行增量更新,使得第二计算设备无需下载数据量较大的新文件或新压缩包进行增量更新,可以有效减少第二计算设备进行增量更新时耗费的数据流量,使得第二计算设备无需再对旧文件和新文件进行差分运算,降低了第二计算设备进行增量更新时的数据计算量和计算时间。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。
如图5所示,本申请的一个实施例提供一种第一计算设备5,其包括:通信模块50、处理器51、存储器52以及存储在存储器52中并可在处理器51上运行的计算机程序53,例如差分文件生成程序。处理器51执行计算机程序53时实现图1对应的实施例中的步骤,例如步骤S101至S104。
示例性的,计算机程序53可以被分割成一个或多个单元,一个或者多个单元被存储在存储器52中,并由处理器51执行,以完成本发明。一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序53在第一计算设备5中的执行过程。例如,如图5所示,计算机程序53可以被分割成分区单元531、合并单元532、差分文件生成单元533,各单元具体功能如下:
分区单元531,用于将旧文件划分成若干区块,将新文件划分成若干区块;
合并单元532,用于将旧文件中特征相同的区块合并成一个区块,将新文件中特征相 同的区块合并成一个区块;
差分文件生成单元533,用于根据旧文件与新文件中特征相同的区块获得差分文件。
在一个实施例中,计算机程序53可以被分割成发送单元,用于将差分文件发送给第二计算设备进行增量更新。在应用中,第一计算设备5可以是桌上型计算机、笔记本电脑、掌上电脑、云端服务器、内容分发平台的运行设备等计算设备。第一计算设备5可包括,但不仅限于,通信模块50、处理器51、存储器52。本领域技术人员可以理解,图5仅仅是第一计算设备5的示例,并不构成对第一计算设备5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如第一计算设备还可以包括输入输出设备、网络接入设备、总线等。
在应用中,处理器51可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
在应用中,存储器52可以是第一计算设备5的内部存储单元,例如第一计算设备5的硬盘或内存。存储器52也可以是第一计算设备5的外部存储设备,例如第一计算设备5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器还可以既包括第一计算设备5的内部存储单元也包括外部存储设备。存储器52用于存储计算机程序以及第一计算设备所需的其他程序和数据。存储器52还可以用于暂时地存储已经输出或者将要输出的数据。
如图6所示,本申请的一个实施例提供一种第二计算设备6,其包括:通信模块60、处理器61、存储器62以及存储在存储器62中并可在处理器61上运行的计算机程序63,例如增量更新程序。处理器61执行计算机程序63时实现图4对应的实施例中的步骤,例如步骤S401至S404。
示例性的,计算机程序63可以被分割成一个或多个单元,一个或者多个单元被存储在存储器62中,并由处理器61执行,以完成本发明。一个或多个单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序63在第二计算设备6中的执行过程。例如,如图6所示,计算机程序63可以被分割成接收单元631、分区单元632、合并单元633、合成运算单元634,各单元具体功能如下:
接收单元631,用于接收第一计算设备发送的差分文件;其中,差分文件包括旧文件 与新文件中每组特征相同的区块对应的差分数据;
分区单元632,用于将旧文件划分成若干区块;
合并单元633,用于将旧文件中特征相同的区块合并成一个区块;
合成运算单元634,用于根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件。
在一个实施例中,计算机程序63还可以被分割成拆分单元,用于拆分新文件中特征相同的区块并按照进行合成运算之前旧文件的组成部分重新排序。
在应用中,第二计算设备6可以是桌上型计算机、笔记本电脑、掌上电脑及云端服务器等计算设备。第二计算设备6可包括,但不仅限于,通信模块60、处理器61、存储器62。本领域技术人员可以理解,图6仅仅是第二计算设备6的示例,并不构成对第二计算设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如第二计算设备还可以包括输入输出设备、网络接入设备、总线等。
在应用中,处理器61可以是中央处理单元,还可以是其他通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
在应用中,存储器62可以是第二计算设备6的内部存储单元,例如第二计算设备6的硬盘或内存。存储器62也可以是第二计算设备6的外部存储设备,例如第二计算设备6上配备的插接式硬盘,智能存储卡,安全数字卡,闪存卡等。进一步地,存储器还可以既包括第二计算设备6的内部存储单元也包括外部存储设备。存储器62用于存储计算机程序以及第二计算设备所需的其他程序和数据。存储器62还可以用于暂时地存储已经输出或者将要输出的数据。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元完成,即将终端的内部结构划分成不同的功能单元,以完成以上描述的全部或者部分功能。实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的 部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
在本发明所提供的实施例中,应该理解到,所揭露的终端和方法,可以通过其它的方式实现。例如,以上所描述的终端实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,终端或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,计算机程序包括计算机程序代码,计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读介质可以包括:能够携带计算机程序代码的任何实体或终端、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。
以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发 明的保护范围之内。

Claims (14)

  1. 一种差分文件生成方法,其特征在于,应用于第一计算设备,所述差分文件生成方法包括:
    将旧文件划分成若干区块,将新文件划分成若干区块;
    将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块;
    根据旧文件与新文件中特征相同的区块获得差分文件。
  2. 如权利要求1所述的差分文件生成方法,其特征在于,根据旧文件与新文件中特征相同的区块获得差分文件,包括:
    分别比较旧文件与新文件中每组特征相同的区块之间的差异,并根据比较结果生成差分文件;
    或者,对旧文件与新文件中每组特征相同的区块进行差分运算,获得差分文件;
    其中,差分文件包括旧文件与新文件中每组特征相同的区块对应的差分数据。
  3. 如权利要求1所述的差分文件生成方法,其特征在于,旧文件和新文件均为压缩包;
    将旧文件划分成若干区块,将新文件划分成若干区块,包括:
    将旧文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块;
    将新文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块。
  4. 如权利要求2所述的差分文件生成方法,其特征在于,将旧文件中特征相同的区块合并成一个区块,将新文件中特征相同的区块合并成一个区块,包括:
    分别将旧文件中特征相同的至少两个第一区块合并成一个第三区块;
    分别将新文件中特征相同的至少两个第一区块合并成一个第三区块;
    根据旧文件与新文件中特征相同的区块获得差分文件,包括:
    根据旧文件与新文件中的第二区块和每组特征相同的第三区块,获得差分文件。
  5. 如权利要求2至4任一项所述的差分文件生成方法,其特征在于,所述特征包括文件名和基本数据类型中的至少一种。
  6. 如权利要求5所述的差分文件生成方法,其特征在于,所述文件名包括主名、前缀名和后缀名中的至少一种。
  7. 如权利要求2至4任一项所述的差分文件生成方法,其特征在于,根据旧文件与新文件中特征相同的区块获得差分文件之后,还包括:
    将差分文件发送给第二计算设备进行增量更新。
  8. 一种增量更新方法,其特征在于,应用于第二计算设备,所述增量更新方法包括:
    接收第一计算设备发送的差分文件;其中,差分文件包括旧文件与新文件中每组特征相同的区块对应的差分数据;
    将旧文件划分成若干区块;
    将旧文件中特征相同的区块合并成一个区块;
    根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件。
  9. 如权利要求8所述的增量更新方法,其特征在于,所述旧文件为压缩包;
    将旧文件划分成若干区块,包括:
    将旧文件中的每个空白区和每个空白区之前的文件划分为一个第一区块、剩余的每个文件划分为一个第一区块、中央目录和中央目录结尾划分为一个第二区块。
  10. 如权利要求9所述的增量更新方法,其特征在于,将旧文件中特征相同的区块合并成一个区块,包括:
    分别将旧文件中特征相同的至少两个第一区块合并成一个第三区块;
    根据区块的特征,对旧文件与差分文件中对应的区块和差分数据进行合成运算,获得新文件,包括:
    根据第二区块的特征和第三区块的特征,分别对旧文件与差分文件中对应的第二区块和差分数据以及每组对应的第三区块和差分数据进行合成运算,获得新文件。
  11. 如权利要求10所述的增量更新方法,其特征在于,所述特征包括文件名和基本数据类型中的至少一种。
  12. 如权利要求11所述的增量更新方法,其特征在于,所述文件名包括主名、前缀名和后缀名中的至少一种。
  13. 一种计算设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述差分文件生成方法的步骤或8至12任一项所述增量更新方法的步骤。
  14. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述差分文件生成方法的步骤或8至12任一项所述增量更新方法的步骤。
PCT/CN2019/129574 2019-12-28 2019-12-28 差分文件生成方法、增量更新方法、计算设备及存储介质 WO2021128371A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/129574 WO2021128371A1 (zh) 2019-12-28 2019-12-28 差分文件生成方法、增量更新方法、计算设备及存储介质
CN201980100485.2A CN114424165A (zh) 2019-12-28 2019-12-28 差分文件生成方法、增量更新方法、计算设备及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/129574 WO2021128371A1 (zh) 2019-12-28 2019-12-28 差分文件生成方法、增量更新方法、计算设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021128371A1 true WO2021128371A1 (zh) 2021-07-01

Family

ID=76573583

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/129574 WO2021128371A1 (zh) 2019-12-28 2019-12-28 差分文件生成方法、增量更新方法、计算设备及存储介质

Country Status (2)

Country Link
CN (1) CN114424165A (zh)
WO (1) WO2021128371A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107016053A (zh) * 2017-03-02 2017-08-04 中国科学院信息工程研究所 一种并行的数据差分方法
CN108804130A (zh) * 2017-05-03 2018-11-13 腾讯科技(深圳)有限公司 程序安装包生成方法及装置
CN109697071A (zh) * 2017-10-24 2019-04-30 腾讯科技(深圳)有限公司 安装包合成方法、装置、终端及存储介质
WO2019245884A1 (en) * 2018-06-21 2019-12-26 Microsoft Technology Licensing, Llc Memory-efficient upgrade staging

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107016053A (zh) * 2017-03-02 2017-08-04 中国科学院信息工程研究所 一种并行的数据差分方法
CN108804130A (zh) * 2017-05-03 2018-11-13 腾讯科技(深圳)有限公司 程序安装包生成方法及装置
CN109697071A (zh) * 2017-10-24 2019-04-30 腾讯科技(深圳)有限公司 安装包合成方法、装置、终端及存储介质
WO2019245884A1 (en) * 2018-06-21 2019-12-26 Microsoft Technology Licensing, Llc Memory-efficient upgrade staging

Also Published As

Publication number Publication date
CN114424165A (zh) 2022-04-29

Similar Documents

Publication Publication Date Title
CN110599169B (zh) 数据处理方法、装置、终端及介质
CN112583931B (zh) 消息处理方法、消息中间件、电子设备和存储介质
CN110019080B (zh) 数据访问方法和装置
US9529873B2 (en) Enhancing performance of extract, transform, and load (ETL) jobs
CN105740016B (zh) 应用程序的增量发布方法和装置、升级方法和装置
WO2021174836A1 (zh) 差分包生成方法方法、装置、计算机设备及存储介质
CN111857550A (zh) 用于数据去重的方法、设备以及计算机可读介质
CN113553300B (zh) 文件的处理方法、装置、可读介质和电子设备
CN110633284A (zh) 数据库中表的变更方法及装置
CN111680067A (zh) 基于区块链的数据处理方法、装置及系统
CN111651424B (zh) 一种数据处理方法、装置、数据节点及存储介质
CN111078672A (zh) 数据库的数据对比方法及装置
US11159616B2 (en) Email synchronization method and apparatus, and computer readable storage medium
CN104063377B (zh) 信息处理方法和使用其的电子设备
CN109302449B (zh) 数据写入方法、数据读取方法、装置和服务器
CN113051102A (zh) 文件备份方法、装置、系统、存储介质和计算机设备
WO2021128371A1 (zh) 差分文件生成方法、增量更新方法、计算设备及存储介质
CN111343220B (zh) 转发器、分布式文件传输方法、系统、介质及电子设备
CN110019040B (zh) 一种文件夹处理方法、移动终端及存储介质
CN111198880A (zh) 一种基于redis的数据存储方法、装置及电子设备
CN116049142A (zh) 数据处理方法、装置、电子设备及存储介质
WO2021097704A1 (zh) 一种数据传输方法、数据下载方法及终端
CN110504973A (zh) 文件压缩、解压方法和装置
CN111090530B (zh) 一种分布式跨进程间通信总线系统
CN110545107B (zh) 数据处理方法、装置、电子设备及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19958006

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 29/11/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19958006

Country of ref document: EP

Kind code of ref document: A1