WO2021114101A1 - Method and apparatus for incremental update of file, and terminal and computer-readable storage medium - Google Patents

Method and apparatus for incremental update of file, and terminal and computer-readable storage medium Download PDF

Info

Publication number
WO2021114101A1
WO2021114101A1 PCT/CN2019/124363 CN2019124363W WO2021114101A1 WO 2021114101 A1 WO2021114101 A1 WO 2021114101A1 CN 2019124363 W CN2019124363 W CN 2019124363W WO 2021114101 A1 WO2021114101 A1 WO 2021114101A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
restored
terminal
restoring
difference
Prior art date
Application number
PCT/CN2019/124363
Other languages
French (fr)
Chinese (zh)
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 CN201980100492.2A priority Critical patent/CN114402311A/en
Priority to PCT/CN2019/124363 priority patent/WO2021114101A1/en
Publication of WO2021114101A1 publication Critical patent/WO2021114101A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This application belongs to the field of communication technology, and in particular relates to a method, device, terminal, and computer-readable storage medium for incrementally updating files.
  • the terminal when the full update method is used to update the file before the update, the terminal usually needs to download the entire updated file from the server to replace the file before the update to complete the file update.
  • an incremental update method is used to update the file before the update, the terminal only needs to download the difference file that records the difference between the updated file and the file before the update from the server, and then compare the file before the update with the difference file.
  • the files are synthesized to realize the update of the files; therefore, compared with the full update mode, the incremental update mode can reduce the amount of data download to a certain extent.
  • the embodiments of the present application provide a method, device, terminal, and computer-readable storage medium for incrementally updating files, which can solve the technical problem of excessive data download of differential files when files are incrementally updated.
  • the first aspect of the embodiments of the present application provides a method for incrementally updating files, which is applied to a first terminal, and includes:
  • the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file;
  • the first restored file is stored by the second terminal on the second terminal
  • the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
  • the second aspect of the embodiments of the present application provides a method for incrementally updating files, which is applied to a second terminal, and includes:
  • the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
  • a third aspect of the embodiments of the present application provides an incremental update device for files, which is configured in a first terminal, and includes:
  • the first obtaining unit is configured to obtain a differential file;
  • the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file;
  • the first restored file is the second terminal pair
  • the second restored file is the first file that the second terminal has completed the incremental update corresponding to the first file 2.
  • the first restoration unit is configured to obtain a third file to be incrementally updated stored in the first terminal, and restore the third file to a third restoration file;
  • a synthesis unit configured to synthesize the third restored file and the difference file to obtain a first synthesized file
  • the anti-restoration unit is configured to perform anti-restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  • a fourth aspect of the embodiments of the present application provides an incremental update device for files, which is configured in a second terminal, and includes:
  • a second acquiring unit configured to acquire a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
  • a second restoring unit configured to restore the first file to the first restored file, and restore the second file to the second restored file
  • the difference unit is used to perform a difference operation on the first restored file and the second restored file to obtain a difference file; the difference file is used to incrementally update the to-be-stored first terminal at the first terminal
  • the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the third file corresponding to the third file
  • the fourth file that has been incrementally updated.
  • a fifth aspect of the embodiments of the present application provides a terminal including a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor implements the steps of the method of the first aspect when the processor executes the computer program.
  • a sixth aspect of the embodiments of the present application provides a terminal including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the steps of the method of the second aspect when the processor executes the computer program.
  • a seventh aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method of the first aspect are implemented.
  • the eighth 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 steps of the method of the second aspect described above are implemented.
  • FIG. 1 is a schematic diagram of the system architecture of a method for incrementally updating files provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of the first implementation process of the incremental update method for files provided by an embodiment of the present application
  • Figure 3 is a schematic diagram of the implementation of file synthesis provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of the implementation process of confirming that the third file has been successfully incrementally updated according to an embodiment of the present application
  • FIG. 5 is a schematic diagram of a specific implementation flow of step 202 of the method for incrementally updating files provided by an embodiment of the present application;
  • FIG. 6 is a schematic diagram of a second implementation flow of the method for incrementally updating files provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of an implementation process of judging the validity of a difference file provided by an embodiment of the present application.
  • FIG. 8 is a first structural schematic diagram of a file incremental update device provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a second structure of a file incremental update device provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • the terminal updates files it can be implemented in two ways, full update and incremental update.
  • the terminal when the terminal uses the full update method to update the file, the terminal usually needs to download the entire updated file from the server to replace the file before the update. With each update, the data volume of the file is constantly superimposed. , The amount of data download is relatively large when the file is updated using the full update method.
  • the terminal When an incremental update method is used to update the file before the update, the terminal only needs to download the difference file that records the difference between the updated file and the file before the update from the server, and then compare the file before the update with the difference file.
  • the files are synthesized to realize the update of the files; therefore, compared with the full update mode, the incremental update mode can reduce the amount of data download to a certain extent.
  • the differential file is often a first file to be incrementally updated stored on the server (second terminal) and a second file corresponding to the first file that has been incrementally updated.
  • the difference is calculated.
  • the file format or compression algorithm of the first file and the second file when the file format corresponding to the first file is converted or compressed, the file format of the first restored file and the file format of the second file corresponds to
  • the data change of the second restored file before conversion or compression is small, it will still cause a large data change between the first file and the second file, and finally make the difference operation between the first file and the second file directly.
  • the data volume of the difference file is also relatively large.
  • the content of the first file to be incrementally updated is the binary character obtained by compressing the character "aaabbb", and the compression dictionary of the compression algorithm is 0 for aaa and 1 for bbb, then the incremental update is to be performed
  • the first file is "01”.
  • the first file to be incrementally updated is incrementally updated, and the content of the incrementally updated file is the binary character obtained by compressing the character "aaabb”, then Due to the change of file content, the corresponding compression dictionary of the same compression algorithm will change.
  • the embodiments of the present application provide a method, device, terminal, and computer-readable storage medium for incremental update of files, which can solve the technical problem of excessive data download when downloading differential files for incremental update.
  • FIG. 1 is a schematic structural diagram of a file incremental update system provided by an embodiment of the application.
  • the file incremental update system includes a first terminal 100 and a second terminal 200 that can implement two-way communication.
  • the above-mentioned first terminal 100 and second terminal 200 may both be smart terminals such as mobile phones, computers, servers, etc.
  • the following takes the second terminal as a server as an example for description.
  • the server when a certain file A has been updated, the server (the second terminal 200) may first upload the file A (the first file to be incrementally updated) and the updated file B corresponding to the file A. (The second file that has been incrementally updated corresponding to the first file) is restored separately to obtain the first restored file and the second restored file, and then the first restored file and the second restored file are performed Difference operation, get the difference file.
  • the first terminal 100 may send the file identification information to the second terminal (For example, the identification information of the file C, and the identification information may include identification information such as the file name or the MD5 value of the file), the second terminal 200 receives the differential file acquisition request sent by the first terminal 100 Then, the differential file corresponding to the differential file acquisition request stored by the second terminal 200 is sent to the first terminal 100.
  • the identification information of the file C and the identification information may include identification information such as the file name or the MD5 value of the file
  • the second terminal 200 receives the differential file acquisition request sent by the first terminal 100 Then, the differential file corresponding to the differential file acquisition request stored by the second terminal 200 is sent to the first terminal 100.
  • the first terminal 100 may first restore the file C to the third Restore the file, and then synthesize the third restored file with the obtained difference file to obtain the first synthesized file, and then reverse restore the first synthesized file to obtain the fourth file corresponding to file C that has been incrementally updated , To achieve incremental updates to file C.
  • the first terminal restores the acquired third file stored in the first terminal to be incrementally updated as the third restored file, and then combines the third restored file with the obtained second file.
  • the terminal synthesizes the difference file obtained by performing the difference operation on the first restored file and the second restored file to obtain the first synthesized file, and then reverse restores the first synthesized file to obtain the completed increase corresponding to the third file.
  • the fourth file for incremental update; the differential file used for incremental update is the file obtained by the second terminal through the differential operation of the first restored file and the second restored file, instead of the first incremental update to be directly processed File and the second file corresponding to the first file that has been incrementally updated.
  • the amount of data change between the first restored file and the second restored file is greater than that of the first file and the second file
  • the amount of change should be small, so that the data amount of the difference file obtained by performing the difference operation on the first restored file and the second restored file is smaller than the data amount of the difference file obtained by directly performing the difference operation on the first file and the second file.
  • the first terminal downloads the differential file generated by the second terminal, the amount of data that needs to be downloaded will also be reduced, which solves the technical problem of excessive data download of the differential file when the file is incrementally updated, and improves the file The efficiency of incremental updates.
  • FIG. 2 shows a schematic diagram of the first implementation flow of a method for incrementally updating files provided by an embodiment of the present application.
  • the method is applied to the first terminal, and the incremental file configuration on the first terminal is determined by the method.
  • Executed by the update device, the incremental update method of the above file may include step 201 to step 204.
  • Step 201 Obtain a difference file.
  • the above-mentioned differential file includes the differential file obtained by the second terminal performing the differential operation on the first restored file and the second restored file; the above-mentioned first restored file is the first to be incrementally updated stored by the second terminal on the second terminal.
  • a file obtained by restoring a file; the above-mentioned second restored file is a file obtained by restoring a second file corresponding to the first file that has been incrementally updated by the second terminal.
  • Step 202 Obtain a third file to be incrementally updated stored in the first terminal, and restore the third file as a third restored file.
  • the third file and the first file are files with the same content, but their storage locations are different.
  • the third file is stored in the first terminal, and the first file is stored in the second terminal.
  • the first terminal when the first terminal needs to incrementally update the third file, it needs to first obtain the above-mentioned differential file generated from the first file with the same content as the third file, and restore the third file to the third file.
  • the file is restored, so that in step 203 to step 204, the third restored file and the difference file are synthesized, and finally a fourth file corresponding to the third file that has been incrementally updated is obtained.
  • restoring the third file to the third restored file includes: decompressing the third file into the first decompressed file.
  • restoring the third file to the third restored file may include decompressing the compressed file in zip format or rar format to obtain document.
  • the above-mentioned restoring the third file to the third restoration file includes: retrieving the third file The format conversion is performed to obtain a first converted file in a third preset format corresponding to the second preset format.
  • the third file Restoring to the third restored file may include converting the file to be converted in the jpg format or the png format into a file in the bmp bitmap format.
  • the above-mentioned restoring the third file as the third restoring file may further include: invoking the first plug-in to restore the third file as the third restoring file.
  • the first plug-in may include an open source plug-in or a plug-in provided by the second terminal, or a plug-in provided by other third-party software developers.
  • the third file can be restored by calling the plug-in provided by the third-party software developer.
  • the third restore file can be restored by calling the plug-in provided by the third-party software developer.
  • the foregoing reverse restoration of the first composite file to obtain the fourth file corresponding to the third file that has been incrementally updated may also include: invoking the second plug-in to reverse the restoration of the first composite file to obtain the third file corresponding to the third file.
  • the fourth file that has been incrementally updated may also include: invoking the second plug-in to reverse the restoration of the first composite file to obtain the third file corresponding to the third file.
  • the aforementioned second plug-in may include an open source plug-in or a plug-in provided by the aforementioned second terminal, or a plug-in provided by other third-party software developers.
  • Step 203 Synthesize the third restored file and the difference file to obtain a first synthesized file.
  • the above-mentioned differential file may carry the marking information of the updated second sub-file, the marking information of the non-updated second sub-file, and the file information of the newly added file, according to the information of the updated second sub-file.
  • the tag information, the tag information of the second sub-file that does not exist and the file information of the newly added file can determine the need to replace the data of the third restored file and the update location and data content of the newly added data. Therefore, the first The third restored file is synthesized with the difference file, and the first synthesized file corresponding to the third restored file can be obtained.
  • the line segment JK represents the data content of the third restored file
  • the difference file records the need to add data content MN at point L of the data content line segment JK of the third restored file, and add the data content of the OP line segment Replaced with O'P', the third restored file and the difference file are synthesized, and the data content J'K' of the first synthesized file can be obtained.
  • the third restored file and the differential file are synthesized above to obtain the first composite Before the file, the integrity check of the differential file can also be performed to reduce the probability that the incremental update of the file fails.
  • the difference file obtained by the first terminal compares the difference file obtained by the first terminal with the difference file sent by the second terminal to determine whether the difference file obtained by the first terminal is consistent with the difference file sent by the second terminal. If the difference file is inconsistent with the difference file sent by the second terminal, the difference file sent by the second terminal is reacquired, and when the difference file obtained by the first terminal is consistent with the difference file sent by the second terminal, that is, the integrity When the verification is successful, the third restored file is synthesized with the difference file to obtain the first synthesized file.
  • the differential file sent by the second terminal acquired by the processor of the first terminal may be inconsistent with the differential file sent by the second terminal, that is, the differential file is in the transmission process. An error occurred in the file. Therefore, in order to avoid the incremental update failure of the file caused by an error in the data transmission, and to improve the incremental update efficiency of the file, in some embodiments of the present application, the file of the first terminal is incrementally updated. Previously, the difference file obtained by the first terminal may be compared with the difference file sent by the second terminal to determine whether the obtained difference file is consistent with the difference file sent by the second terminal.
  • the Cyclic Redundancy Check (CRC) method can be used to verify whether the differential files sent by the second terminal acquired by the processor of the first terminal are consistent, or by comparing the MD5 values of the differential files, and Or by comparing the hash values of the difference files, it is determined whether the obtained difference file is consistent with the difference file sent by the second terminal.
  • CRC Cyclic Redundancy Check
  • data check methods such as direct comparison method, parity check method, exclusive OR check method, Hamming code check, etc. to verify the difference sent by the second terminal obtained by the processor of the first terminal. Whether the documents are consistent, these should belong to the idea of this application.
  • Step 204 Perform reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  • the foregoing reverse restoration of the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated indicates that the incremental update of the third file has been completed.
  • Step 401 Determine whether the fourth file is consistent with the second file.
  • Step 402 If the fourth file is consistent with the second file, it is confirmed that the third file has been successfully incrementally updated.
  • the above-mentioned differential file may carry identification information used to identify the file content of the second file, for example, the MD5 value or hash value of the second file. Therefore, the above-mentioned determining whether the fourth file is consistent with the second file It may include: calculating the identification information used to identify the file content of the fourth file, for example, the MD5 value or hash value of the fourth file, and then combining the identification information used to identify the file content of the fourth file with the identification information used to identify the fourth file. The identification information of the file content of the two files is compared. The identification information used to identify the file content of the fourth file is the same as the identification information used to identify the file content of the second file, which means that the fourth file is consistent with the second file.
  • the fourth file that has been incrementally updated corresponding to the third file is the target file for incremental update of the third file; otherwise, it means that the fourth file is inconsistent with the second file, and the above-mentioned corresponding to the third file has been updated.
  • the fourth file that has been incrementally updated is not the target file for incrementally updating the third file.
  • the third file stored by the first terminal can be fully updated, that is, the third file stored by the first terminal can be fully updated. Replace all files with the second file obtained.
  • the above method for judging whether the fourth file is consistent with the second file can also refer to the above method for checking the integrity of the differential file, which will not be repeated here.
  • the third file when the third file is an application installation package and other files, the third file usually contains multiple first sub-files, and some of these first sub-files are the first sub-files to be incrementally updated. Some first subfiles are first subfiles that do not need to be updated. In addition, due to the limitation of the restoration method, some updated first subfiles may not be restored. Therefore, in some embodiments of this application, as shown in the figure As shown in 5, the above-mentioned restoring the third file as the third restoring file may include: step 501 to step 502.
  • Step 501 Confirm the first subfile to be incrementally updated among the multiple first subfiles according to the difference file.
  • the above-mentioned differential file may carry the marking information of the updated second subfile, the marking information of the second subfile that does not exist in the first file to be incrementally updated stored by the second terminal, and The file information of the newly-added file is added. Therefore, each first sub-file of the third file to be incrementally updated stored in the first terminal and each first file of the first file to be incrementally updated stored in the second terminal is added. Matching the tag information of the two sub-files can confirm the first sub-file to be incrementally updated and the first sub-file that does not need to be updated among the third files to be incrementally updated stored in the first terminal.
  • Step 502 Restore the first sub-file that can be restored among the first sub-files to be incrementally updated as the first reductive file.
  • the traditional incremental update method can only be used for updating, and the first subfile that can be restored can be used
  • the incremental update method of the file from step 201 to step 204 is updated. Therefore, it is necessary to confirm the first subfile that can be restored in the first subfile to be incrementally updated, and then restore the first subfile that can be restored For the first reduction of atomic files.
  • the above-mentioned first sub-file that can be restored may include: among the first sub-files to be incrementally updated, a compressed file belonging to a first preset format or a first sub-file belonging to a file to be converted in a second preset format. , Or the first sub-file that can be restored by calling the first plug-in.
  • the method may further include: synthesizing the first subfile that cannot be restored among the first subfiles to be incrementally updated with the difference file to obtain The incrementally updated file corresponding to the first subfile that cannot be restored.
  • the aforementioned first sub-file that cannot be restored may include: among the first sub-files to be incrementally updated, files that do not belong to compressed files in the first preset format and do not belong to files to be converted in the second preset format.
  • the first sub-file cannot be restored by calling the first plug-in.
  • the first subfile that cannot be restored belongs to the first subfile to be incrementally updated, that is, it belongs to the file that has a corresponding incremental update. Therefore, it needs to be compared with the difference
  • the files are synthesized, and the incrementally updated file corresponding to the first subfile that cannot be restored is obtained.
  • the difference file includes the second reduction file obtained by restoring the second subfile that can be restored in the first file and the third restoration obtained by restoring the corresponding third subfile that can be restored in the second file.
  • a difference operation is performed on the file, and the difference operation is performed on the second subfile that cannot be restored in the first file and the corresponding third subfile that cannot be restored in the second file to obtain a difference file.
  • the difference file may carry the marking information of the updated second sub-file, the marking information of the non-updated second sub-file, and the file information of the newly added file.
  • the process of obtaining the difference file refer to the description in the following related embodiments, which will not be repeated here.
  • synthesizing the third restored file with the difference file to obtain the first synthesized file may include: The first subfile that does not need to be updated among the multiple first subfiles is directly copied; the first subfile that can be restored in the first subfile to be incrementally updated is synthesized using the file incremental update method described in step 203 , Get the incrementally updated file corresponding to the first sub-file that can be restored; the first sub-file that cannot be restored among the first sub-files to be incrementally updated is synthesized with the difference file, and the obtained and cannot be restored The first sub-file corresponding to the file that has been incrementally updated; the copy file corresponding to the first sub-file that does not need to be updated, the file that has been incrementally updated corresponding to the first sub-file that can be restored, and The incrementally updated file corresponding to the first subfile that cannot be restored and the file information of the newly added file carried in the above-mentioned difference file are combined to obtain the
  • FIG. 6 shows a schematic diagram of the second implementation flow of a method for incremental update of files provided by an embodiment of the present application.
  • the method is applied to a second terminal and can be executed by an apparatus for incremental update of files configured on the second terminal.
  • the incremental update method of the aforementioned file may include step 601 to step 603.
  • Step 601 Obtain a first file to be incrementally updated stored in the second terminal and a second file corresponding to the first file that has been incrementally updated.
  • Step 602 Restore the first file to the first restored file, and restore the second file to the second restored file.
  • restoring the first file to the first restored file may include: decompressing the first file into a second restored file. unzip files.
  • restoring the second file to the second restored file may include: formatting the second file to obtain the second file corresponding to the second preset format. Third, the second conversion file in the preset format.
  • the above-mentioned restoring the second file to the second restoring file may also include calling the first plug-in to restore the first file to the first restoring file and/or restoring the second file to the second restoring file.
  • Step 603 Perform a differential operation on the first restored file and the second restored file to obtain a differential file.
  • the above-mentioned difference file is used to synthesize the third restored file corresponding to the third file when the first terminal performs incremental update to the third file to be incrementally updated stored in the first terminal to obtain the first synthesized file , And perform reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  • Step 701 Synthesize the difference file with the first restored file to obtain a second synthesized file.
  • step 203 For the above method of synthesizing the difference file and the first restored file, reference may be made to the description of step 203 above, which will not be repeated here.
  • Step 702 Perform reverse restoration on the second composite file to obtain the file to be confirmed.
  • Step 703 Determine whether the file to be confirmed is consistent with the second file.
  • step 401 for the above method for determining whether the file to be confirmed is consistent with the second file, reference may be made to the description of the above step 401 to step 402, which will not be repeated here.
  • Step 704 If the file to be confirmed is consistent with the second file, save the difference file obtained by performing the difference operation on the first restored file and the second restored file.
  • the differential file when the file to be confirmed is consistent with the second file, it indicates that the differential file is valid. Therefore, the differential file can be saved so that the first terminal can obtain the differential file.
  • the above-mentioned determining whether the file to be confirmed is consistent with the second file it may further include: if the file to be confirmed is inconsistent with the second file, then the first restoration file and the second restoration The difference file obtained by the difference operation of the file is marked as an error file. That is, the obtained difference file is invalid. Further, the second terminal may also delete the difference file marked as an error file, so that the first terminal can perform a full update when a valid difference file cannot be obtained.
  • the first file when the first file is a file such as an application installation package, the first file may include multiple second sub-files, and correspondingly, the second file may also include multiple third sub-files; Since some of these second sub-files are updated second sub-files, some of the second sub-files are first sub-files that do not have updates.
  • some updated second sub-files may exist. The restoration cannot be performed. Therefore, before restoring the first file as the first restoration file and the second file as the second restoration file, the files of each second sub-file among the multiple second sub-files can be first restored.
  • the identifier is compared with the file identifier of each third subfile in the plurality of third subfiles to obtain a second subfile of the plurality of second subfiles that has the same file identifier as the corresponding third subfile, and There is no second sub-file of the third sub-file with the same file identifier; then, the second sub-file with the same file identifier as the corresponding third sub-file is confirmed as no updated second sub-file, and all The second sub-file that does not have the third sub-file with the same file identifier is confirmed as the updated second sub-file.
  • restoring the first file as the first restoration file and restoring the second file as the second restoration file may include: restoring the second subfile that can be restored among the updated second subfiles Restore to the second reduced file, and restore the third sub-file with the same file name as the restored second sub-file to the third reduced file.
  • performing the differential operation on the first restored file and the second restored file to obtain the differential file may include: combining the second subfile that cannot be restored among the updated second subfiles with the corresponding third subfile.
  • a file is subjected to a difference operation, and the second reduction file and the corresponding third reduction file are subjected to a difference operation to obtain the difference file;
  • the difference file may carry a mark indicating that there is an updated second sub-file Information, the tag information of the updated second sub-file and the file information of the newly added file.
  • FIG. 8 shows a schematic structural diagram of a file incremental update device 800 provided by an embodiment of the present application.
  • the file incremental update device 800 is configured in a first terminal and includes an acquisition unit 801, a restoration unit 802, and a synthesis unit 803. And the anti-reduction unit 804.
  • the first obtaining unit 801 is configured to obtain a differential file;
  • the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file;
  • the first restored file is the second terminal A file obtained by restoring a first file to be incrementally updated stored by the second terminal;
  • the second restored file is a file obtained by the second terminal of the completed incremental update corresponding to the first file The file obtained by restoring the second file;
  • the first restoring unit 802 is configured to obtain a third file to be incrementally updated stored in the first terminal, and restore the third file to a third restored file;
  • the synthesis unit 803 is configured to synthesize the third restored file and the difference file to obtain a first synthesized file
  • the anti-restoration unit 804 is configured to perform anti-restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  • FIG. 9 shows a schematic structural diagram of a file incremental update device 900 provided by an embodiment of the present application.
  • the file incremental update device 900 is configured in a second terminal and includes an acquisition unit 901, a restoration unit 902, and a difference unit 903. .
  • the second obtaining unit 901 is configured to obtain a first file to be incrementally updated stored in the second terminal and a second file corresponding to the first file that has been incrementally updated;
  • the second restoring unit 902 is configured to restore the first file to the first restored file, and restore the second file to the second restored file;
  • the difference unit 903 is configured to perform a difference operation on the first restored file and the second restored file to obtain a difference file; the difference file is used for the first terminal to increment the to-be-stored first terminal
  • the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the third file Corresponding to the fourth file that has been incrementally updated.
  • the present application also provides a terminal for implementing the method for incrementally updating the files in FIG. 2 to FIG. 5, that is, the first terminal includes: a memory, a processor, and stored in the memory and on the processor.
  • the running computer program when the processor executes the computer program, the following steps are implemented:
  • the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file;
  • the first restored file is stored by the second terminal on the second terminal
  • the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
  • This application also provides another terminal for implementing the incremental update method for files shown in FIGS. 6 to 7, that is, the above-mentioned second terminal includes: a memory, a processor, and a memory and a processor, When the processor executes the computer program, the following steps are implemented:
  • the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
  • the aforementioned first terminal or second terminal may also include one or more input devices 13 (only one is shown in FIG. 10) and one or Multiple output devices 14 (only one is shown in Fig. 1).
  • the processor 11, the memory 12, the input device 13 and the output device 14 are connected by a bus 15.
  • the so-called processor 11 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (Digital Signal Processors, DSP). , Application Specific Integrated Circuit (ASIC), 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 input device 13 may include a virtual keyboard, a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc.
  • the output device 14 may include a display, a speaker, and the like.
  • the memory 12 may include a read-only memory and a random access memory, and provides instructions and data to the processor 11. A part or all of the memory 12 may also include a non-volatile random access memory. For example, the memory 12 may also store device type information.
  • the above-mentioned memory 12 stores a computer program, and the above-mentioned computer program can be run on the above-mentioned processor 11.
  • the above-mentioned computer program is a program of a file incremental update method.
  • the steps in the embodiment of the incremental update method for files are implemented, for example, step 201 to step 204 shown in FIG. 2 or, for example, step 601 to step 603 shown in FIG. 6.
  • the processor 11 executes the computer program, the functions of the modules/units in the above device embodiments are implemented, such as the functions of the units 801 to 804 shown in FIG. 8 or the functions of the units 901 to 903 shown in FIG. 9.
  • the foregoing computer program may be divided into one or more modules/units, and the foregoing one or more modules/units are stored in the foregoing memory 12 and executed by the foregoing processor 11 to complete the present application.
  • the aforementioned one or more modules/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 aforementioned computer program in the aforementioned first terminal that performs incremental file update.
  • the above-mentioned computer program can be divided into a first acquisition unit, a first restoration unit, a synthesis unit, and an anti-restoration unit.
  • each unit is as follows: the first acquisition unit is used to acquire a differential file; the differential file includes a second A differential file obtained by a terminal performing a differential operation on a first restored file and a second restored file; the first restored file is the second terminal restoring the first file stored by the second terminal to be incrementally updated The second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal; the first restoring unit is configured to obtain the The third file to be incrementally updated stored in the first terminal, and the third file is restored to the third restored file; the synthesis unit is configured to synthesize the third restored file with the difference file to obtain The first synthetic file; an anti-restoration unit, configured to perform an anti-restoration on the first synthetic file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  • the above computer program can be divided into a second acquisition unit, a second restoration unit, and a difference unit, and the specific functions of each unit are as follows: the second acquisition unit is used to acquire the second terminal stored by the second terminal to be incrementally updated. A file and a second file corresponding to the first file that has been incrementally updated; a second restoring unit for restoring the first file to the first restoring file, and restoring the second file to A second restored file; a difference unit, configured to perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to store the first terminal on the first terminal When the third file to be incrementally updated is incrementally updated, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the same The third file corresponds to the fourth file that has been incrementally updated.
  • the disclosed device/terminal and method may be implemented in other ways.
  • the above-described device/terminal embodiments are merely illustrative.
  • the division of the above-mentioned modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components. It can be combined or integrated into 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, devices or units, and may be in electrical, mechanical or other forms.
  • the units described above as separate components may or may not be physically separate, 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 application 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 above integrated modules/units are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program.
  • the above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the foregoing method embodiments can be implemented.
  • the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random Access memory (Random Access Memory, RAM), electric carrier signal, telecommunications signal, software distribution medium, etc.
  • ROM read-only memory
  • RAM random Access memory
  • electric carrier signal telecommunications signal
  • software distribution medium etc.
  • the content contained in the above-mentioned computer-readable media can be appropriately added or deleted in accordance with the requirements of the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, the computer-readable media cannot Including electric carrier signal and telecommunication signal.

Landscapes

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

Abstract

A method and apparatus for incremental update of a file, and a terminal and a computer-readable storage medium. The method comprises: a first terminal acquiring a differential file generated by a second terminal (201), and then restoring a third file to be subjected to incremental update to be a third restored file (202); then synthesizing the third restored file and the obtained differential file to obtain a first synthesized file (203); and then carrying out reverse restoration on the first synthesized file to obtain a fourth file that corresponds to the third file and has been completely subjected to incremental update (204). The technical effect of reducing a data download amount of a differential file when incremental update is performed on a file is achieved.

Description

文件的增量更新方法、装置、终端及计算机可读存储介质File incremental update method, device, terminal and computer readable storage medium 技术领域Technical field
本申请属于通信技术领域,尤其涉及一种文件的增量更新方法、装置、终端及计算机可读存储介质。This application belongs to the field of communication technology, and in particular relates to a method, device, terminal, and computer-readable storage medium for incrementally updating files.
背景技术Background technique
终端在对文件进行更新时,可以采用全量更新和增量更新这两种方式实现。When the terminal updates the file, it can be implemented in two ways: full update and incremental update.
其中,采用全量更新方式对更新前的文件进行更新时,终端通常需要从服务器中下载整个更新后的文件对更新前的文件进行替换,完成文件更新。而采用增量更新方式对更新前的文件进行更新时,终端只需要从服务器中下载记录有更新后的文件和更新前的文件之间的差异的差分文件,然后将更新前的文件与该差分文件进行合成,实现文件的更新;因此,相对于全量更新方式而言,增量更新方式能够一定程度上减少数据的下载量。Among them, when the full update method is used to update the file before the update, the terminal usually needs to download the entire updated file from the server to replace the file before the update to complete the file update. When an incremental update method is used to update the file before the update, the terminal only needs to download the difference file that records the difference between the updated file and the file before the update from the server, and then compare the file before the update with the difference file. The files are synthesized to realize the update of the files; therefore, compared with the full update mode, the incremental update mode can reduce the amount of data download to a certain extent.
发明内容Summary of the invention
本申请实施例提供一种文件的增量更新方法、装置、终端及计算机可读存储介质,可以解决在对文件进行增量更新时,差分文件的数据下载量过大的技术问题。The embodiments of the present application provide a method, device, terminal, and computer-readable storage medium for incrementally updating files, which can solve the technical problem of excessive data download of differential files when files are incrementally updated.
本申请实施例第一方面提供一种文件的增量更新方法,应用于第一终端,包括:The first aspect of the embodiments of the present application provides a method for incrementally updating files, which is applied to a first terminal, and includes:
获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;Obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is stored by the second terminal on the second terminal The file obtained by restoring the first file to be incrementally updated; the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;Acquiring a third file to be incrementally updated stored by the first terminal, and restoring the third file as a third restoration file;
将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;Synthesize the third restored file with the difference file to obtain a first synthesized file;
对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Performing reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
本申请实施例第二方面提供一种文件的增量更新方法,应用于第二终端,包括:The second aspect of the embodiments of the present application provides a method for incrementally updating files, which is applied to a second terminal, and includes:
获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;Acquiring a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;Restoring the first file as a first restoring file, and restoring the second file as a second restoring file;
对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的 第四文件。Perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
本申请实施例第三方面提供一种文件的增量更新装置,配置于第一终端,包括:A third aspect of the embodiments of the present application provides an incremental update device for files, which is configured in a first terminal, and includes:
第一获取单元,用于获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;The first obtaining unit is configured to obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is the second terminal pair The file obtained by restoring the first file to be incrementally updated stored by the second terminal; the second restored file is the first file that the second terminal has completed the incremental update corresponding to the first file 2. The file obtained by restoring the file;
第一还原单元,用于获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;The first restoration unit is configured to obtain a third file to be incrementally updated stored in the first terminal, and restore the third file to a third restoration file;
合成单元,用于将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;A synthesis unit, configured to synthesize the third restored file and the difference file to obtain a first synthesized file;
反还原单元,用于对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The anti-restoration unit is configured to perform anti-restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
本申请实施例第四方面提供一种文件的增量更新装置,配置于第二终端,包括:A fourth aspect of the embodiments of the present application provides an incremental update device for files, which is configured in a second terminal, and includes:
第二获取单元,用于获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;A second acquiring unit, configured to acquire a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
第二还原单元,用于将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;A second restoring unit, configured to restore the first file to the first restored file, and restore the second file to the second restored file;
差分单元,用于对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The difference unit is used to perform a difference operation on the first restored file and the second restored file to obtain a difference file; the difference file is used to incrementally update the to-be-stored first terminal at the first terminal When the third file of the third file is incrementally updated, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the third file corresponding to the third file The fourth file that has been incrementally updated.
本申请实施例第五方面提供一种终端,包括存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述第一方面的方法的步骤。A fifth aspect of the embodiments of the present application provides a terminal including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The processor implements the steps of the method of the first aspect when the processor executes the computer program.
本申请实施例第六方面提供一种终端,包括存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现上述第二方面的方法的步骤。A sixth aspect of the embodiments of the present application provides a terminal including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the steps of the method of the second aspect when the processor executes the computer program.
本申请实施例第七方面提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现上述第一方面的方法的步骤。A seventh aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method of the first aspect are implemented.
本申请实施例第八方面提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序被处理器执行时实现上述第二方面的方法的步骤。The eighth 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 steps of the method of the second aspect described above are implemented.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前 提下,还可以根据这些附图获得其他相关的附图。In order to more clearly describe the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative work.
图1是本申请实施例提供的文件的增量更新方法的系统架构示意图;FIG. 1 is a schematic diagram of the system architecture of a method for incrementally updating files provided by an embodiment of the present application;
图2是本申请实施例提供的文件的增量更新方法的第一实现流程示意图;2 is a schematic diagram of the first implementation process of the incremental update method for files provided by an embodiment of the present application;
图3是本申请实施例提供的文件合成的实现示意图;Figure 3 is a schematic diagram of the implementation of file synthesis provided by an embodiment of the present application;
图4是本申请实施例提供的确认已成功对第三文件进行增量更新的实现流程示意图;FIG. 4 is a schematic diagram of the implementation process of confirming that the third file has been successfully incrementally updated according to an embodiment of the present application;
图5是本申请实施例提供的文件的增量更新方法步骤202的具体实现流程示意图;FIG. 5 is a schematic diagram of a specific implementation flow of step 202 of the method for incrementally updating files provided by an embodiment of the present application;
图6是本申请实施例提供的文件的增量更新方法的第二实现流程示意图;FIG. 6 is a schematic diagram of a second implementation flow of the method for incrementally updating files provided by an embodiment of the present application;
图7是本申请实施例提供的判断差分文件的有效性的实现流程示意图;FIG. 7 is a schematic diagram of an implementation process of judging the validity of a difference file provided by an embodiment of the present application;
图8是本申请实施例提供的文件的增量更新装置的第一结构示意图;FIG. 8 is a first structural schematic diagram of a file incremental update device provided by an embodiment of the present application;
图9是本申请实施例提供的文件的增量更新装置的第二结构示意图;FIG. 9 is a schematic diagram of a second structure of a file incremental update device provided by an embodiment of the present application;
图10是本申请实施例提供的终端的结构示意图。FIG. 10 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。同时,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In order to make the purpose, technical solutions, and advantages of this application clearer and clearer, the following further describes the application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the existence of the described features, wholes, steps, operations, elements and/or components, but does not exclude one or more other features , The existence or addition of a whole, a step, an operation, an element, a component, and/or a collection thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of this application and the appended claims, unless the context clearly indicates other circumstances, the singular forms "a", "an" and "the" are intended to include plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个(其中多个包括两个或两个以上)的任何组合以及所有可能组合,并且包括这些组合。It should also be further understood that the term "and/or" used in the specification and appended claims of this application refers to one or more of the items listed in the associated list (a number of which includes two or more) Any combination and all possible combinations of and including these combinations.
为了说明本申请上述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the above-mentioned technical solutions of the present application, specific embodiments are used for description below.
目前,终端在对文件进行更新时,可以采用全量更新和增量更新这两种方式实现。At present, when the terminal updates files, it can be implemented in two ways, full update and incremental update.
具体的,终端采用全量更新方式对文件进行更新时,终端通常需要从服务器中下载整个更新后的文件对更新前的文件进行替换,随着一次次的更新,文件的数据量不断叠加,此时,采用全量更新方式对文件进行更新时数据下载量较大。Specifically, when the terminal uses the full update method to update the file, the terminal usually needs to download the entire updated file from the server to replace the file before the update. With each update, the data volume of the file is constantly superimposed. , The amount of data download is relatively large when the file is updated using the full update method.
而采用增量更新方式对更新前的文件进行更新时,终端只需要从服务器中下载记录有更新后的文件和更新前的文件之间的差异的差分文件,然后将更新前的文件与该差分文件进行合成,实现文件的更新;因此,相对于全量更新方式而言,增量 更新方式能够一定程度上减少数据的下载量。When an incremental update method is used to update the file before the update, the terminal only needs to download the difference file that records the difference between the updated file and the file before the update from the server, and then compare the file before the update with the difference file. The files are synthesized to realize the update of the files; therefore, compared with the full update mode, the incremental update mode can reduce the amount of data download to a certain extent.
一般的增量更新方法中,差分文件往往是通过直接对服务器(第二终端)存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件进行差分计算得到,然而,受到第一文件与第二文件的文件格式或者压缩算法的影响,当第一文件对应的文件格式转换前或者压缩前的第一还原文件与第二文件对应的文件格式转换前或者压缩前的第二还原文件的数据变化较小时,仍然会导致第一文件与第二文件之间发生较大的数据变化,最终使得直接对第一文件与第二文件进行差分运算得到的差分文件的数据量也相对较大。In a general incremental update method, the differential file is often a first file to be incrementally updated stored on the server (second terminal) and a second file corresponding to the first file that has been incrementally updated. The difference is calculated. However, affected by the file format or compression algorithm of the first file and the second file, when the file format corresponding to the first file is converted or compressed, the file format of the first restored file and the file format of the second file corresponds to When the data change of the second restored file before conversion or compression is small, it will still cause a large data change between the first file and the second file, and finally make the difference operation between the first file and the second file directly. The data volume of the difference file is also relatively large.
例如,待进行增量更新的第一文件的内容为将字符“aaabbb”进行压缩后得到的二进制字符,并且,压缩算法的压缩字典为0表示aaa,1表示bbb,则待进行增量更新的第一文件为“01”,此时,若对待进行增量更新的第一文件进行增量更新,得到增量更新后的文件的内容为将字符“aaabb”进行压缩后得到的二进制字符,那么由于文件内容的变化,同样的压缩算法其对应的压缩字典将发生变化,例如,该压缩字典变化为0表示a,1表示b,那么增量更新后的文件将变更为“00011”,由此可以看出,在对待进行增量更新的第一文件的进行增量更新时,虽然仅对待进行增量更新的第一文件对应的压缩前的字符“aaabbb”变化一个字符,即,将“aaabbb”变更为“aaabb”,但是,将导致增量更新后的文件对应的压缩后得到的二进制字符发生较大的改变,即,从“01”变为“00011”。所以,直接对待进行增量更新的第一文件以及增量更新后的文件进行差分计算得到的差分文件存在数据量过大的问题。For example, the content of the first file to be incrementally updated is the binary character obtained by compressing the character "aaabbb", and the compression dictionary of the compression algorithm is 0 for aaa and 1 for bbb, then the incremental update is to be performed The first file is "01". At this time, if the first file to be incrementally updated is incrementally updated, and the content of the incrementally updated file is the binary character obtained by compressing the character "aaabb", then Due to the change of file content, the corresponding compression dictionary of the same compression algorithm will change. For example, if the compression dictionary changes to 0 for a and 1 for b, then the incrementally updated file will be changed to "00011", thus It can be seen that when performing incremental update of the first file to be incrementally updated, although only the character "aaabbb" before compression corresponding to the first file to be incrementally updated is changed by one character, that is, "aaabbb "Is changed to "aaabb", but it will cause a big change in the compressed binary characters corresponding to the incrementally updated file, that is, from "01" to "00011". Therefore, the difference file obtained by directly performing the difference calculation on the first file to be incrementally updated and the file after the incremental update has the problem of excessive data volume.
基于此,本申请实施例提供了一种文件的增量更新方法、装置、终端及计算机可读存储介质,可以解决下载用于增量更新的差分文件时,数据下载量过大的技术问题。Based on this, the embodiments of the present application provide a method, device, terminal, and computer-readable storage medium for incremental update of files, which can solve the technical problem of excessive data download when downloading differential files for incremental update.
如图1所示为本申请实施例提供的文件的增量更新系统的结构示意图,该文件的增量更新系统包括可以实现双向通信的第一终端100与第二终端200。其中,上述第一终端100与第二终端200均可以为手机、电脑、服务器等智能终端,下面以第二终端为服务器为例进行举例说明。FIG. 1 is a schematic structural diagram of a file incremental update system provided by an embodiment of the application. The file incremental update system includes a first terminal 100 and a second terminal 200 that can implement two-way communication. Wherein, the above-mentioned first terminal 100 and second terminal 200 may both be smart terminals such as mobile phones, computers, servers, etc. The following takes the second terminal as a server as an example for description.
在实际应用中,当某个文件A存在更新时,服务器(第二终端200)可以先将对该文件A(待进行增量更新的第一文件)及该文件A对应的更新后的文件B(与所述第一文件对应的已完成增量更新的第二文件)分别进行还原,得到第一还原文件和第二还原文件,再对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件。In practical applications, when a certain file A has been updated, the server (the second terminal 200) may first upload the file A (the first file to be incrementally updated) and the updated file B corresponding to the file A. (The second file that has been incrementally updated corresponding to the first file) is restored separately to obtain the first restored file and the second restored file, and then the first restored file and the second restored file are performed Difference operation, get the difference file.
当第一终端100需要对其存储的与文件A相同的文件C(待进行增量更新的第三文件)进行增量更新时,上述第一终端100可以向第二终端发送携带有文件标识信息(例如,文件C的标识信息,并且,该标识信息可以包括文件名或文件的MD5值等标识信息)的差分文件获取请求,第二终端200接收到上述第一终端100发送的差分文件获取请求后,向第一终端100发送第二终端200存储的与差分文件获取 请求对应的差分文件,第一终端100在获取到第二终端200发送的差分文件后,可以先对文件C还原为第三还原文件,再将所述第三还原文件与获取的差分文件进行合成,得到第一合成文件,然后对所述第一合成文件进行反还原得到文件C对应的已完成增量更新的第四文件,实现对文件C的增量更新。When the first terminal 100 needs to incrementally update the stored file C (the third file to be incrementally updated) that is the same as the file A, the first terminal 100 may send the file identification information to the second terminal (For example, the identification information of the file C, and the identification information may include identification information such as the file name or the MD5 value of the file), the second terminal 200 receives the differential file acquisition request sent by the first terminal 100 Then, the differential file corresponding to the differential file acquisition request stored by the second terminal 200 is sent to the first terminal 100. After acquiring the differential file sent by the second terminal 200, the first terminal 100 may first restore the file C to the third Restore the file, and then synthesize the third restored file with the obtained difference file to obtain the first synthesized file, and then reverse restore the first synthesized file to obtain the fourth file corresponding to file C that has been incrementally updated , To achieve incremental updates to file C.
本申请实施例中,第一终端通过将获取到的第一终端存储的待进行增量更新的第三文件还原为第三还原文件,然后将所述第三还原文件与获取到的由第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件进行合成,得到第一合成文件,再对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件;使得用于进行增量更新的差分文件是第二终端通过对第一还原文件和第二还原文件进行差分运算得到的文件,而不是直接对待进行增量更新的第一文件及与第一文件对应的已完成增量更新的第二文件进行差分运算得到的文件,因此,当第一还原文件与第二还原文件的数据变化量比第一文件与第二文件的数据变化量要小时,可以使得对第一还原文件与第二还原文件进行差分运算得到的差分文件数据量比直接对第一文件与第二文件进行差分运算得到的差分文件数据量小,相应的,第一终端下载由第二终端生成的差分文件时,需要下载的数据量也将减少,解决了在对文件进行增量更新时,差分文件的数据下载量过大的技术问题,提高了对文件进行增量更新的效率。In the embodiment of the present application, the first terminal restores the acquired third file stored in the first terminal to be incrementally updated as the third restored file, and then combines the third restored file with the obtained second file. The terminal synthesizes the difference file obtained by performing the difference operation on the first restored file and the second restored file to obtain the first synthesized file, and then reverse restores the first synthesized file to obtain the completed increase corresponding to the third file. The fourth file for incremental update; the differential file used for incremental update is the file obtained by the second terminal through the differential operation of the first restored file and the second restored file, instead of the first incremental update to be directly processed File and the second file corresponding to the first file that has been incrementally updated. Therefore, when the amount of data change between the first restored file and the second restored file is greater than that of the first file and the second file The amount of change should be small, so that the data amount of the difference file obtained by performing the difference operation on the first restored file and the second restored file is smaller than the data amount of the difference file obtained by directly performing the difference operation on the first file and the second file. Correspondingly, When the first terminal downloads the differential file generated by the second terminal, the amount of data that needs to be downloaded will also be reduced, which solves the technical problem of excessive data download of the differential file when the file is incrementally updated, and improves the file The efficiency of incremental updates.
具体的,如图2示出了本申请实施例提供的一种文件的增量更新方法的第一实现流程示意图,该方法应用于第一终端,可以由第一终端上配置的文件的增量更新装置执行,上述文件的增量更新方法可以包括步骤201至步骤204。Specifically, FIG. 2 shows a schematic diagram of the first implementation flow of a method for incrementally updating files provided by an embodiment of the present application. The method is applied to the first terminal, and the incremental file configuration on the first terminal is determined by the method. Executed by the update device, the incremental update method of the above file may include step 201 to step 204.
步骤201,获取差分文件。Step 201: Obtain a difference file.
其中,上述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;上述第一还原文件为第二终端对第二终端存储的待进行增量更新的第一文件进行还原得到的文件;上述第二还原文件为第二终端对与第一文件对应的已完成增量更新的第二文件进行还原得到的文件。Wherein, the above-mentioned differential file includes the differential file obtained by the second terminal performing the differential operation on the first restored file and the second restored file; the above-mentioned first restored file is the first to be incrementally updated stored by the second terminal on the second terminal. A file obtained by restoring a file; the above-mentioned second restored file is a file obtained by restoring a second file corresponding to the first file that has been incrementally updated by the second terminal.
步骤202,获取第一终端存储的待进行增量更新的第三文件,并将第三文件还原为第三还原文件。Step 202: Obtain a third file to be incrementally updated stored in the first terminal, and restore the third file as a third restored file.
需要说明的是,上述第三文件与上述第一文件为内容相同的文件,但是其存储位置不相同,第三文件存储在第一终端,第一文件存储在第二终端。It should be noted that the third file and the first file are files with the same content, but their storage locations are different. The third file is stored in the first terminal, and the first file is stored in the second terminal.
本申请实施例中,当第一终端需要对第三文件进行增量更新时,需要先获取上述根据与第三文件内容相同的第一文件生成的差分文件,并将第三文件还原为第三还原文件,以便在步骤203至步骤204中,将第三还原文件与差分文件进行合成,并最终得到与第三文件对应的已完成增量更新的第四文件。In this embodiment of the application, when the first terminal needs to incrementally update the third file, it needs to first obtain the above-mentioned differential file generated from the first file with the same content as the third file, and restore the third file to the third file. The file is restored, so that in step 203 to step 204, the third restored file and the difference file are synthesized, and finally a fourth file corresponding to the third file that has been incrementally updated is obtained.
在本申请的一些实施方式中,当第三文件为第一预设格式的压缩文件时,上述将第三文件还原为第三还原文件包括:将所述第三文件解压为第一解压文件。In some embodiments of the present application, when the third file is a compressed file in the first preset format, restoring the third file to the third restored file includes: decompressing the third file into the first decompressed file.
例如,上述第一预设格式的压缩文件为zip格式或者rar格式的压缩文件时,上述将第三文件还原为第三还原文件可以包括将zip格式或者rar格式的压缩文件进行 解压,得到压缩前的文件。For example, when the compressed file in the first preset format is a compressed file in zip format or rar format, restoring the third file to the third restored file may include decompressing the compressed file in zip format or rar format to obtain document.
在本申请的一些实施方式中,当所述第三文件为第二预设格式的待转换文件时,上述所述将所述第三文件还原为第三还原文件包括:对所述第三文件进行格式转换,得到与所述第二预设格式对应的第三预设格式的第一转换文件。In some embodiments of the present application, when the third file is a file to be converted in a second preset format, the above-mentioned restoring the third file to the third restoration file includes: retrieving the third file The format conversion is performed to obtain a first converted file in a third preset format corresponding to the second preset format.
例如,上述第二预设格式的待转换文件为jpg格式或png格式的待转换文件,与所述第二预设格式对应的第三预设格式为bmp位图格式,则上述将第三文件还原为第三还原文件可以包括将上述jpg格式或png格式的待转换文件转换为bmp位图格式的文件。For example, if the file to be converted in the second preset format is a file to be converted in jpg format or png format, and the third preset format corresponding to the second preset format is a bmp bitmap format, then the third file Restoring to the third restored file may include converting the file to be converted in the jpg format or the png format into a file in the bmp bitmap format.
需要说明的是,此处仅仅是对第二预设格式的待转换文件进行举例说明,在本申请的其他实施方式中,还可以包括其他第二预设格式的待转换文件。It should be noted that, here is only an example of the file to be converted in the second preset format. In other embodiments of the present application, other files to be converted in the second preset format may also be included.
在本申请的一些实施方式中,上述将第三文件还原为第三还原文件,还可以包括:调用第一插件将第三文件还原为第三还原文件。In some embodiments of the present application, the above-mentioned restoring the third file as the third restoring file may further include: invoking the first plug-in to restore the third file as the third restoring file.
其中,上述第一插件可以包括开源的或者由上述第二终端提供的插件,又或者为其他第三方软件开发商提供的插件。Wherein, the first plug-in may include an open source plug-in or a plug-in provided by the second terminal, or a plug-in provided by other third-party software developers.
例如,当上述第三文件为通过第三方软件开发商自定义的加密方法得到的文件或者为第三方自定义格式的文件,则可以通过调用第三方软件开发商提供的插件将第三文件还原为第三还原文件。For example, when the aforementioned third file is a file obtained through a third-party software developer’s custom encryption method or a third-party custom format file, the third file can be restored by calling the plug-in provided by the third-party software developer. The third restore file.
相应的,上述对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件也可以包括:调用第二插件对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件。Correspondingly, the foregoing reverse restoration of the first composite file to obtain the fourth file corresponding to the third file that has been incrementally updated may also include: invoking the second plug-in to reverse the restoration of the first composite file to obtain the third file corresponding to the third file. The fourth file that has been incrementally updated.
同样的,上述第二插件可以包括开源的或者由上述第二终端提供的插件,又或者为其他第三方软件开发商提供的插件。Similarly, the aforementioned second plug-in may include an open source plug-in or a plug-in provided by the aforementioned second terminal, or a plug-in provided by other third-party software developers.
步骤203,将第三还原文件与差分文件进行合成,得到第一合成文件。Step 203: Synthesize the third restored file and the difference file to obtain a first synthesized file.
具体的,上述差分文件可以携带有存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息,根据所述存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息即可确定需要对第三还原文件的数据进行替换和新增的数据的更新位置与数据内容,因此,将第三还原文件与差分文件进行合成,可以得到与第三还原文件对应的第一合成文件。Specifically, the above-mentioned differential file may carry the marking information of the updated second sub-file, the marking information of the non-updated second sub-file, and the file information of the newly added file, according to the information of the updated second sub-file. The tag information, the tag information of the second sub-file that does not exist and the file information of the newly added file can determine the need to replace the data of the third restored file and the update location and data content of the newly added data. Therefore, the first The third restored file is synthesized with the difference file, and the first synthesized file corresponding to the third restored file can be obtained.
例如,如图3所示,线段JK代表第三还原文件的数据内容,差分文件记录了需要在第三还原文件的数据内容线段JK的点L处新增数据内容MN,并将OP线段数据内容替换为O’P’,则将所述第三还原文件与差分文件进行合成,可以得到第一合成文件的数据内容J’K’。For example, as shown in Figure 3, the line segment JK represents the data content of the third restored file, and the difference file records the need to add data content MN at point L of the data content line segment JK of the third restored file, and add the data content of the OP line segment Replaced with O'P', the third restored file and the difference file are synthesized, and the data content J'K' of the first synthesized file can be obtained.
另外,为了进一步提高文件的增量更新效率,避免因差分文件中的数据出现错误,而导致文件的增量更新失败,在上述将第三还原文件与所述差分文件进行合成,得到第一合成文件之前,还可以对差分文件进行完整性校验,以降低文件的增量更新失败的概率。In addition, in order to further improve the efficiency of the incremental update of the file and avoid the incremental update failure of the file due to errors in the data in the differential file, the third restored file and the differential file are synthesized above to obtain the first composite Before the file, the integrity check of the differential file can also be performed to reduce the probability that the incremental update of the file fails.
例如,将第一终端获取到的差分文件与第二终端发送的差分文件进行比对,判断第一终端获取到的差分文件与第二终端发送的差分文件是否一致,若第一终端获取到的差分文件与第二终端发送的差分文件不一致,则重新获取第二终端发送的差分文件,并在第一终端获取到的差分文件与第二终端发送的差分文件一致时,即,所述完整性校验成功时,将第三还原文件与所述差分文件进行合成,得到第一合成文件。For example, compare the difference file obtained by the first terminal with the difference file sent by the second terminal to determine whether the difference file obtained by the first terminal is consistent with the difference file sent by the second terminal. If the difference file is inconsistent with the difference file sent by the second terminal, the difference file sent by the second terminal is reacquired, and when the difference file obtained by the first terminal is consistent with the difference file sent by the second terminal, that is, the integrity When the verification is successful, the third restored file is synthesized with the difference file to obtain the first synthesized file.
具体的,由于数据传输过程中,受各种因素影响,第一终端的处理器获取到的第二终端发送的差分文件有可能与第二终端发送的差分文件不一致,即,差分文件在传输过程中出现了错误,因此,为了避免因数据传输发生错误导致的文件的增量更新失败,提高文件的增量更新效率,本申请的一些实施方式中,在对第一终端的文件进行增量更新之前,可以先将第一终端获取到的差分文件与第二终端发送的差分文件进行比对,判断获取到的差分文件与第二终端发送的差分文件是否一致。Specifically, due to various factors during the data transmission process, the differential file sent by the second terminal acquired by the processor of the first terminal may be inconsistent with the differential file sent by the second terminal, that is, the differential file is in the transmission process. An error occurred in the file. Therefore, in order to avoid the incremental update failure of the file caused by an error in the data transmission, and to improve the incremental update efficiency of the file, in some embodiments of the present application, the file of the first terminal is incrementally updated. Previously, the difference file obtained by the first terminal may be compared with the difference file sent by the second terminal to determine whether the obtained difference file is consistent with the difference file sent by the second terminal.
例如,可以采用循环冗余校验法(Cyclic Redundancy Check,CRC)验证第一终端的处理器获取到的第二终端发送的差分文件是否一致,或者通过对差分文件的MD5值进行比对,又或者通过对差分文件的哈希值进行比对,判断获取到的差分文件与第二终端发送的差分文件是否一致。然而,本领域技术人员还可以采用直接比较法、奇偶校验法、异或校验法、海明码校验等数据校验方法来验证第一终端的处理器获取到的第二终端发送的差分文件是否一致,这些均应属于本申请的构思。For example, the Cyclic Redundancy Check (CRC) method can be used to verify whether the differential files sent by the second terminal acquired by the processor of the first terminal are consistent, or by comparing the MD5 values of the differential files, and Or by comparing the hash values of the difference files, it is determined whether the obtained difference file is consistent with the difference file sent by the second terminal. However, those skilled in the art can also use data check methods such as direct comparison method, parity check method, exclusive OR check method, Hamming code check, etc. to verify the difference sent by the second terminal obtained by the processor of the first terminal. Whether the documents are consistent, these should belong to the idea of this application.
步骤204,对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件。Step 204: Perform reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
上述对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件,表示已完成对上述第三文件的增量更新。The foregoing reverse restoration of the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated indicates that the incremental update of the third file has been completed.
然而,为了确认上述对第三文件的增量更新得到的第四文件是文件增量更新的目标文件,在本申请的一些实施方式中,如图4所示,在上述对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件之后,可以包括:步骤401至步骤402。However, in order to confirm that the fourth file obtained by the incremental update of the third file is the target file of the incremental update of the file, in some embodiments of the present application, as shown in FIG. After anti-restoration obtains the fourth file corresponding to the third file that has been incrementally updated, it may include: step 401 to step 402.
步骤401,判断第四文件与第二文件是否一致。Step 401: Determine whether the fourth file is consistent with the second file.
步骤402,若第四文件与第二文件一致,则确认已成功对第三文件进行增量更新。Step 402: If the fourth file is consistent with the second file, it is confirmed that the third file has been successfully incrementally updated.
本申请实施例中,上述差分文件可以携带有用于标识第二文件的文件内容的标识信息,例如,第二文件的MD5值或哈希值,因此,上述判断第四文件与第二文件是否一致可以包括:计算用于标识第四文件的文件内容的标识信息,例如,第四文件的MD5值或哈希值,然后将用于标识第四文件的文件内容的标识信息与上述用于标识第二文件的文件内容的标识信息进行比对,用于标识第四文件的文件内容的标识信息与上述用于标识第二文件的文件内容的标识信息相同,则表示第四文件与第二文件一致,上述与第三文件对应的已完成增量更新的第四文件是对第三文件进行增量更新的目标文件;否则,表示第四文件与第二文件不一致,上述与第三文 件对应的已完成增量更新的第四文件不是对第三文件进行增量更新的目标文件,此时可以对获取所述第一终端存储的第三文件进行全量更新,即,将第一终端存储的第三文件全部替换为获取到的第二文件。In the embodiment of the present application, the above-mentioned differential file may carry identification information used to identify the file content of the second file, for example, the MD5 value or hash value of the second file. Therefore, the above-mentioned determining whether the fourth file is consistent with the second file It may include: calculating the identification information used to identify the file content of the fourth file, for example, the MD5 value or hash value of the fourth file, and then combining the identification information used to identify the file content of the fourth file with the identification information used to identify the fourth file. The identification information of the file content of the two files is compared. The identification information used to identify the file content of the fourth file is the same as the identification information used to identify the file content of the second file, which means that the fourth file is consistent with the second file. , The fourth file that has been incrementally updated corresponding to the third file is the target file for incremental update of the third file; otherwise, it means that the fourth file is inconsistent with the second file, and the above-mentioned corresponding to the third file has been updated. The fourth file that has been incrementally updated is not the target file for incrementally updating the third file. At this time, the third file stored by the first terminal can be fully updated, that is, the third file stored by the first terminal can be fully updated. Replace all files with the second file obtained.
具体的,上述判断第四文件与第二文件是否一致的方法还可以参看上述的对差分文件进行完整性校验的方法,此处不再赘述。Specifically, the above method for judging whether the fourth file is consistent with the second file can also refer to the above method for checking the integrity of the differential file, which will not be repeated here.
需要说明的是,当第三文件为应用安装包等文件时,第三文件通常包含多个第一子文件,并且,这些第一子文件中有些为待进行增量更新的第一子文件,有些第一子文件为不需要更新的第一子文件,另外,受还原方法的限制,一些存在更新的第一子文件有可能无法进行还原,因此,在本申请的一些实施方式中,如图5所示,上述将所述第三文件还原为第三还原文件,可以包括:步骤501至步骤502。It should be noted that when the third file is an application installation package and other files, the third file usually contains multiple first sub-files, and some of these first sub-files are the first sub-files to be incrementally updated. Some first subfiles are first subfiles that do not need to be updated. In addition, due to the limitation of the restoration method, some updated first subfiles may not be restored. Therefore, in some embodiments of this application, as shown in the figure As shown in 5, the above-mentioned restoring the third file as the third restoring file may include: step 501 to step 502.
步骤501,根据差分文件确认多个第一子文件中待进行增量更新的第一子文件。Step 501: Confirm the first subfile to be incrementally updated among the multiple first subfiles according to the difference file.
本申请实施例中,上述差分文件可以携带有第二终端存储的待进行增量更新的第一文件中存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息,因此,对第一终端存储的待进行增量更新的第三文件的每个第一子文件与第二终端存储的待进行增量更新的第一文件的每个第二子文件的标记信息进行匹配,可以确认第一终端存储的待进行增量更新的第三文件中待进行增量更新的第一子文件以及不需要更新的第一子文件。In the embodiment of the present application, the above-mentioned differential file may carry the marking information of the updated second subfile, the marking information of the second subfile that does not exist in the first file to be incrementally updated stored by the second terminal, and The file information of the newly-added file is added. Therefore, each first sub-file of the third file to be incrementally updated stored in the first terminal and each first file of the first file to be incrementally updated stored in the second terminal is added. Matching the tag information of the two sub-files can confirm the first sub-file to be incrementally updated and the first sub-file that does not need to be updated among the third files to be incrementally updated stored in the first terminal.
步骤502,将待进行增量更新的第一子文件中能够还原的第一子文件还原为第一还原子文件。Step 502: Restore the first sub-file that can be restored among the first sub-files to be incrementally updated as the first reductive file.
由于受还原方法的限制,一些待进行增量更新的第一子文件有可能无法进行还原,因而,只能采用传统的增量更新方式进行更新,对于可以进行还原的第一子文件则可以采用上述步骤201至步骤204的文件的增量更新方法进行更新,因此,需要对待进行增量更新的第一子文件中能够还原的第一子文件进行确认,然后将能够还原的第一子文件还原为第一还原子文件。Due to the limitation of the restoration method, some of the first subfiles to be incrementally updated may not be restored. Therefore, the traditional incremental update method can only be used for updating, and the first subfile that can be restored can be used The incremental update method of the file from step 201 to step 204 is updated. Therefore, it is necessary to confirm the first subfile that can be restored in the first subfile to be incrementally updated, and then restore the first subfile that can be restored For the first reduction of atomic files.
具体的,上述能够还原的第一子文件可以包括:待进行增量更新的第一子文件中属于第一预设格式的压缩文件或者属于第二预设格式的待转换文件的第一子文件,或者可以通过调用第一插件进行还原的第一子文件。Specifically, the above-mentioned first sub-file that can be restored may include: among the first sub-files to be incrementally updated, a compressed file belonging to a first preset format or a first sub-file belonging to a file to be converted in a second preset format. , Or the first sub-file that can be restored by calling the first plug-in.
在本申请的一些实施方式中,在上述步骤501之后,还可以包括:将所述待进行增量更新的第一子文件中不能够还原的第一子文件与所述差分文件进行合成,得到与所述不能够还原的第一子文件对应的已完成增量更新的文件。In some embodiments of the present application, after step 501, the method may further include: synthesizing the first subfile that cannot be restored among the first subfiles to be incrementally updated with the difference file to obtain The incrementally updated file corresponding to the first subfile that cannot be restored.
具体的,上述不能够还原的第一子文件可以包括:待进行增量更新的第一子文件中不属于第一预设格式的压缩文件且不属于第二预设格式的待转换文件的文件,同时,也不能通过调用第一插件进行还原的第一子文件。Specifically, the aforementioned first sub-file that cannot be restored may include: among the first sub-files to be incrementally updated, files that do not belong to compressed files in the first preset format and do not belong to files to be converted in the second preset format. At the same time, the first sub-file cannot be restored by calling the first plug-in.
需要说明的是,由于不能够还原的第一子文件是属于待进行增量更新的第一子文件,即,属于存在与之对应的已完成增量更新的文件,因此,需要将其与差分文件进行合成,得到与所述不能够还原的第一子文件对应的已完成增量更新的文件。It should be noted that, because the first subfile that cannot be restored belongs to the first subfile to be incrementally updated, that is, it belongs to the file that has a corresponding incremental update. Therefore, it needs to be compared with the difference The files are synthesized, and the incrementally updated file corresponding to the first subfile that cannot be restored is obtained.
其中,该差分文件为包括对第一文件中能够还原的第二子文件进行还原得到的 第二还原子文件与对第二文件中相应的能够还原的第三子文件进行还原得到的第三还原文件进行差分运算,以及对第一文件中不能够还原的第二子文件与第二文件中相应的不能够还原的第三子文件进行差分运算,得到的差分文件。并且,该差分文件可以携带有存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息。具体的,该差分文件的获取过程可以参看下面相关实施例中的描述,此处不再赘述。Wherein, the difference file includes the second reduction file obtained by restoring the second subfile that can be restored in the first file and the third restoration obtained by restoring the corresponding third subfile that can be restored in the second file. A difference operation is performed on the file, and the difference operation is performed on the second subfile that cannot be restored in the first file and the corresponding third subfile that cannot be restored in the second file to obtain a difference file. In addition, the difference file may carry the marking information of the updated second sub-file, the marking information of the non-updated second sub-file, and the file information of the newly added file. Specifically, for the process of obtaining the difference file, refer to the description in the following related embodiments, which will not be repeated here.
在本申请实施例中,当上述第三文件包含多个第一子文件的情况下,上述将所述第三还原文件与所述差分文件进行合成,得到第一合成文件可以包括:对所述多个第一子文件中不需要更新的第一子文件直接进行拷贝;对待进行增量更新的第一子文件中能够还原的第一子文件采用步骤203所述的文件增量更新方法进行合成,得到与能够还原的第一子文件对应的已完成增量更新的文件;对待进行增量更新的第一子文件中不能够还原的第一子文件与差分文件进行合成,得到与不能够还原的第一子文件对应的已完成增量更新的文件;将所述不需要更新的第一子文件对应的拷贝文件、与能够还原的第一子文件对应的已完成增量更新的文件、与不能够还原的第一子文件对应的已完成增量更新的文件以及上述差分文件携带的新增文件的文件信息进行合并,得到第一合成文件。In the embodiment of the present application, when the third file contains multiple first sub-files, synthesizing the third restored file with the difference file to obtain the first synthesized file may include: The first subfile that does not need to be updated among the multiple first subfiles is directly copied; the first subfile that can be restored in the first subfile to be incrementally updated is synthesized using the file incremental update method described in step 203 , Get the incrementally updated file corresponding to the first sub-file that can be restored; the first sub-file that cannot be restored among the first sub-files to be incrementally updated is synthesized with the difference file, and the obtained and cannot be restored The first sub-file corresponding to the file that has been incrementally updated; the copy file corresponding to the first sub-file that does not need to be updated, the file that has been incrementally updated corresponding to the first sub-file that can be restored, and The incrementally updated file corresponding to the first subfile that cannot be restored and the file information of the newly added file carried in the above-mentioned difference file are combined to obtain the first composite file.
如图6示出了本申请实施例提供的一种文件的增量更新方法的第二实现流程示意图,该方法应用于第二终端,可以由第二终端上配置的文件的增量更新装置执行,上述文件的增量更新方法可以包括步骤601至步骤603。FIG. 6 shows a schematic diagram of the second implementation flow of a method for incremental update of files provided by an embodiment of the present application. The method is applied to a second terminal and can be executed by an apparatus for incremental update of files configured on the second terminal. , The incremental update method of the aforementioned file may include step 601 to step 603.
步骤601,获取第二终端存储的待进行增量更新的第一文件以及与第一文件对应的已完成增量更新的第二文件。Step 601: Obtain a first file to be incrementally updated stored in the second terminal and a second file corresponding to the first file that has been incrementally updated.
步骤602,将第一文件还原为第一还原文件,并将第二文件还原为第二还原文件。Step 602: Restore the first file to the first restored file, and restore the second file to the second restored file.
在本申请的一些实施方式中,当上述第一文件为第一预设格式的压缩文件时,上述将第一文件还原为第一还原文件,可以包括:将所述第一文件解压为第二解压文件。当上述第一文件为第二预设格式的待转换文件时,上述将第二文件还原为第二还原文件,可以包括:对第二文件进行格式转换,得到与第二预设格式对应的第三预设格式的第二转换文件。In some embodiments of the present application, when the first file is a compressed file in a first preset format, restoring the first file to the first restored file may include: decompressing the first file into a second restored file. unzip files. When the first file is the file to be converted in the second preset format, restoring the second file to the second restored file may include: formatting the second file to obtain the second file corresponding to the second preset format. Third, the second conversion file in the preset format.
另外,上述将第二文件还原为第二还原文件还可以包括调用第一插件将第一文件还原为第一还原文件和/或将第二文件还原为第二还原文件。In addition, the above-mentioned restoring the second file to the second restoring file may also include calling the first plug-in to restore the first file to the first restoring file and/or restoring the second file to the second restoring file.
具体的,上述步骤602的具体实现方式可以参考上述步骤202的描述,此处不再赘述。Specifically, for the specific implementation of the foregoing step 602, reference may be made to the description of the foregoing step 202, which is not repeated here.
步骤603,对第一还原文件和第二还原文件进行差分运算,得到差分文件。Step 603: Perform a differential operation on the first restored file and the second restored file to obtain a differential file.
其中,上述差分文件用于在第一终端对第一终端存储的待进行增量更新的第三文件进行增量更新时,与第三文件对应的第三还原文件进行合成,得到第一合成文件,并对第一合成文件进行反还原得到与第三文件对应的已完成增量更新的第四文件。Wherein, the above-mentioned difference file is used to synthesize the third restored file corresponding to the third file when the first terminal performs incremental update to the third file to be incrementally updated stored in the first terminal to obtain the first synthesized file , And perform reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
为了保证得到的差分文件的有效性,在本申请的一些实施方式中,如图7所示,在上述对第一还原文件和所述第二还原文件进行差分运算,得到差分文件之后,可以包括:步骤701至步骤704。In order to ensure the validity of the obtained differential file, in some embodiments of the present application, as shown in FIG. 7, after the above-mentioned differential operation is performed on the first restored file and the second restored file to obtain the differential file, it may include :Step 701 to step 704.
步骤701,将差分文件与第一还原文件进行合成,得到第二合成文件。Step 701: Synthesize the difference file with the first restored file to obtain a second synthesized file.
其中,上述将差分文件与第一还原文件进行合成的方法可以参考上述步骤203的描述,此处不再赘述。For the above method of synthesizing the difference file and the first restored file, reference may be made to the description of step 203 above, which will not be repeated here.
步骤702,对第二合成文件进行反还原得到待确认文件。Step 702: Perform reverse restoration on the second composite file to obtain the file to be confirmed.
步骤703,判断待确认文件与第二文件是否一致。Step 703: Determine whether the file to be confirmed is consistent with the second file.
具体的,上述判断待确认文件与第二文件是否一致的方法可以参考上述步骤401至步骤402的描述,此处不再赘述。Specifically, for the above method for determining whether the file to be confirmed is consistent with the second file, reference may be made to the description of the above step 401 to step 402, which will not be repeated here.
步骤704,若待确认文件与第二文件一致,则保存对第一还原文件和第二还原文件进行差分运算得到的差分文件。Step 704: If the file to be confirmed is consistent with the second file, save the difference file obtained by performing the difference operation on the first restored file and the second restored file.
本申请实施例中,当待确认文件与第二文件一致时,表示差分文件是有效的,因此,可以保存该差分文件,使得第一终端可以获取该差分文件。In the embodiment of the present application, when the file to be confirmed is consistent with the second file, it indicates that the differential file is valid. Therefore, the differential file can be saved so that the first terminal can obtain the differential file.
在本申请的另外一些实施方式中,上述判断待确认文件与所述第二文件是否一致之后,还可以包括:若待确认文件与第二文件不一致,则将对第一还原文件和第二还原文件进行差分运算得到的差分文件标记为错误文件。即,得到的差分文件是无效的,进一步的,第二终端还可以将所述标记为错误文件的差分文件删除,以便第一终端可以在无法获取到有效的差分文件时,进行全量更新。In some other embodiments of the present application, after the above-mentioned determining whether the file to be confirmed is consistent with the second file, it may further include: if the file to be confirmed is inconsistent with the second file, then the first restoration file and the second restoration The difference file obtained by the difference operation of the file is marked as an error file. That is, the obtained difference file is invalid. Further, the second terminal may also delete the difference file marked as an error file, so that the first terminal can perform a full update when a valid difference file cannot be obtained.
在本申请的一些实施方式中,当第一文件为应用安装包等文件时,该第一文件可以包括多个第二子文件,相应的,第二文件也可以包括多个第三子文件;由于这些第二子文件中有些为存在更新的第二子文件,有些第二子文件为不存在更新的第一子文件,另外,受还原方法的限制,一些存在更新的第二子文件有可能无法进行还原,因此,在将第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件之前,可以先将多个第二子文件中各个第二子文件的文件标识与所述多个第三子文件中各个第三子文件的文件标识进行比较,得到所述多个第二子文件中与对应的第三子文件的文件标识相同的第二子文件,以及不存在文件标识相同的第三子文件的第二子文件;然后,将所述与对应的第三子文件的文件标识相同的第二子文件确认为不存在更新的第二子文件,将所述不存在文件标识相同的第三子文件的第二子文件确认为存在更新的第二子文件。In some embodiments of the present application, when the first file is a file such as an application installation package, the first file may include multiple second sub-files, and correspondingly, the second file may also include multiple third sub-files; Since some of these second sub-files are updated second sub-files, some of the second sub-files are first sub-files that do not have updates. In addition, due to the limitation of the restoration method, some updated second sub-files may exist. The restoration cannot be performed. Therefore, before restoring the first file as the first restoration file and the second file as the second restoration file, the files of each second sub-file among the multiple second sub-files can be first restored. The identifier is compared with the file identifier of each third subfile in the plurality of third subfiles to obtain a second subfile of the plurality of second subfiles that has the same file identifier as the corresponding third subfile, and There is no second sub-file of the third sub-file with the same file identifier; then, the second sub-file with the same file identifier as the corresponding third sub-file is confirmed as no updated second sub-file, and all The second sub-file that does not have the third sub-file with the same file identifier is confirmed as the updated second sub-file.
进一步地,上述将第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件,可以包括:将所述存在更新的第二子文件中能够还原的第二子文件还原为第二还原子文件,以及将与所述能够还原的第二子文件文件名相同的第三子文件还原为第三还原子文件。Further, restoring the first file as the first restoration file and restoring the second file as the second restoration file may include: restoring the second subfile that can be restored among the updated second subfiles Restore to the second reduced file, and restore the third sub-file with the same file name as the restored second sub-file to the third reduced file.
相应的,上述对第一还原文件和第二还原文件进行差分运算,得到差分文件,可以包括:将所述存在更新的第二子文件中不能够还原的第二子文件与对应的第三子文件进行差分运算,并将所述第二还原子文件与对应的所述第三还原子文件进行 差分运算,得到所述差分文件;所述差分文件可以携带有存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息。Correspondingly, performing the differential operation on the first restored file and the second restored file to obtain the differential file may include: combining the second subfile that cannot be restored among the updated second subfiles with the corresponding third subfile. A file is subjected to a difference operation, and the second reduction file and the corresponding third reduction file are subjected to a difference operation to obtain the difference file; the difference file may carry a mark indicating that there is an updated second sub-file Information, the tag information of the updated second sub-file and the file information of the newly added file.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为根据本发明,某些步骤可以采用其它顺序进行。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described sequence of actions. Because according to the present invention, certain steps can be performed in other orders.
图8示出了本申请实施例提供的一种文件的增量更新装置800的结构示意图,该文件的增量更新装置800配置于第一终端,包括获取单元801、还原单元802、合成单元803以及反还原单元804。FIG. 8 shows a schematic structural diagram of a file incremental update device 800 provided by an embodiment of the present application. The file incremental update device 800 is configured in a first terminal and includes an acquisition unit 801, a restoration unit 802, and a synthesis unit 803. And the anti-reduction unit 804.
第一获取单元801,用于获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;The first obtaining unit 801 is configured to obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is the second terminal A file obtained by restoring a first file to be incrementally updated stored by the second terminal; the second restored file is a file obtained by the second terminal of the completed incremental update corresponding to the first file The file obtained by restoring the second file;
第一还原单元802,用于获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;The first restoring unit 802 is configured to obtain a third file to be incrementally updated stored in the first terminal, and restore the third file to a third restored file;
合成单元803,用于将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;The synthesis unit 803 is configured to synthesize the third restored file and the difference file to obtain a first synthesized file;
反还原单元804,用于对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The anti-restoration unit 804 is configured to perform anti-restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
需要说明的是,为描述的方便和简洁,上述描述的文件的增量更新装置800的具体工作过程,可以参考上述图2至图5中描述的方法的对应过程,在此不再赘述。It should be noted that, for the convenience and conciseness of the description, the specific working process of the file incremental updating device 800 described above can refer to the corresponding process of the method described in the above-mentioned FIG. 2 to FIG. 5, which will not be repeated here.
图9示出了本申请实施例提供的一种文件的增量更新装置900的结构示意图,该文件的增量更新装置900配置于第二终端,包括获取单元901、还原单元902以及差分单元903。FIG. 9 shows a schematic structural diagram of a file incremental update device 900 provided by an embodiment of the present application. The file incremental update device 900 is configured in a second terminal and includes an acquisition unit 901, a restoration unit 902, and a difference unit 903. .
第二获取单元901,用于获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;The second obtaining unit 901 is configured to obtain a first file to be incrementally updated stored in the second terminal and a second file corresponding to the first file that has been incrementally updated;
第二还原单元902,用于将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;The second restoring unit 902 is configured to restore the first file to the first restored file, and restore the second file to the second restored file;
差分单元903,用于对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The difference unit 903 is configured to perform a difference operation on the first restored file and the second restored file to obtain a difference file; the difference file is used for the first terminal to increment the to-be-stored first terminal When the updated third file is incrementally updated, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the third file Corresponding to the fourth file that has been incrementally updated.
需要说明的是,为描述的方便和简洁,上述描述的文件的增量更新装置900的具体工作过程,可以参考上述图6至图7中描述的方法的对应过程,在此不再赘述。It should be noted that, for the convenience and conciseness of the description, the specific working process of the file incremental update device 900 described above can refer to the corresponding process of the method described in the above-mentioned FIG. 6 to FIG. 7, which will not be repeated here.
本申请还提供一种用于实现上述图2至图5的文件的增量更新的方法的终端,即,上述第一终端,包括:存储器、处理器以及存储在存储器中并可在处理器上运 行的计算机程序,处理器执行计算机程序时实现如下步骤:The present application also provides a terminal for implementing the method for incrementally updating the files in FIG. 2 to FIG. 5, that is, the first terminal includes: a memory, a processor, and stored in the memory and on the processor. The running computer program, when the processor executes the computer program, the following steps are implemented:
获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;Obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is stored by the second terminal on the second terminal The file obtained by restoring the first file to be incrementally updated; the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;Acquiring a third file to be incrementally updated stored by the first terminal, and restoring the third file as a third restoration file;
将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;Synthesize the third restored file with the difference file to obtain a first synthesized file;
对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Performing reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
本申请还提供另一种用于实现图6至图7所示的文件的增量更新方法的终端,即,上述第二终端,包括:存储器、处理器以及存储在存储器中并可在处理器上运行的计算机程序,处理器执行计算机程序时实现如下步骤:This application also provides another terminal for implementing the incremental update method for files shown in FIGS. 6 to 7, that is, the above-mentioned second terminal includes: a memory, a processor, and a memory and a processor, When the processor executes the computer program, the following steps are implemented:
获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;Acquiring a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;Restoring the first file as a first restoring file, and restoring the second file as a second restoring file;
对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
具体地,如图10所示,上述第一终端或第二终端除了包括处理器11、存储器12之外,还可以包括一个或多个输入设备13(图10中仅示出一个)和一个或多个输出设备14(图1中仅示出一个)。处理器11、存储器12、输入设备13和输出设备14通过总线15连接。Specifically, as shown in FIG. 10, in addition to the processor 11 and the memory 12, the aforementioned first terminal or second terminal may also include one or more input devices 13 (only one is shown in FIG. 10) and one or Multiple output devices 14 (only one is shown in Fig. 1). The processor 11, the memory 12, the input device 13 and the output device 14 are connected by a bus 15.
应当理解,在本申请实施例中,所称处理器11可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the so-called processor 11 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors or digital signal processors (Digital Signal Processors, DSP). , Application Specific Integrated Circuit (ASIC), 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.
输入设备13可以包括虚拟键盘、触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出设备14可以包括显示器、扬声器等。The input device 13 may include a virtual keyboard, a touch panel, a fingerprint sensor (used to collect user fingerprint information and fingerprint orientation information), a microphone, etc., and the output device 14 may include a display, a speaker, and the like.
存储器12可以包括只读存储器和随机存取存储器,并向处理器11提供指令和数据。存储器12的一部分或全部还可以包括非易失性随机存取存储器。例如,存 储器12还可以存储设备类型的信息。The memory 12 may include a read-only memory and a random access memory, and provides instructions and data to the processor 11. A part or all of the memory 12 may also include a non-volatile random access memory. For example, the memory 12 may also store device type information.
上述存储器12存储有计算机程序,上述计算机程序可在上述处理器11上运行,例如,上述计算机程序为文件的增量更新方法的程序。上述处理器11执行上述计算机程序时实现上述文件的增量更新方法实施例中的步骤,例如图2所示的步骤201至步骤204,或者例如图6所示的步骤601至步骤603。或者,上述处理器11执行上述计算机程序时实现上述各装置实施例中各模块/单元的功能,例如图8所示单元801至804的功能,或者例如图9所示单元901至903的功能。The above-mentioned memory 12 stores a computer program, and the above-mentioned computer program can be run on the above-mentioned processor 11. For example, the above-mentioned computer program is a program of a file incremental update method. When the processor 11 executes the computer program, the steps in the embodiment of the incremental update method for files are implemented, for example, step 201 to step 204 shown in FIG. 2 or, for example, step 601 to step 603 shown in FIG. 6. Alternatively, when the processor 11 executes the computer program, the functions of the modules/units in the above device embodiments are implemented, such as the functions of the units 801 to 804 shown in FIG. 8 or the functions of the units 901 to 903 shown in FIG. 9.
上述计算机程序可以被分割成一个或多个模块/单元,上述一个或者多个模块/单元被存储在上述存储器12中,并由上述处理器11执行,以完成本申请。上述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述上述计算机程序在上述进行文件的增量更新的第一终端中的执行过程。例如,上述计算机程序可以被分割成第一获取单元、第一还原单元、合成单元以及反还原单元,各单元具体功能如下:第一获取单元,用于获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;第一还原单元,用于获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;合成单元,用于将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;反还原单元,用于对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The foregoing computer program may be divided into one or more modules/units, and the foregoing one or more modules/units are stored in the foregoing memory 12 and executed by the foregoing processor 11 to complete the present application. The aforementioned one or more modules/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 aforementioned computer program in the aforementioned first terminal that performs incremental file update. For example, the above-mentioned computer program can be divided into a first acquisition unit, a first restoration unit, a synthesis unit, and an anti-restoration unit. The specific functions of each unit are as follows: the first acquisition unit is used to acquire a differential file; the differential file includes a second A differential file obtained by a terminal performing a differential operation on a first restored file and a second restored file; the first restored file is the second terminal restoring the first file stored by the second terminal to be incrementally updated The second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal; the first restoring unit is configured to obtain the The third file to be incrementally updated stored in the first terminal, and the third file is restored to the third restored file; the synthesis unit is configured to synthesize the third restored file with the difference file to obtain The first synthetic file; an anti-restoration unit, configured to perform an anti-restoration on the first synthetic file to obtain a fourth file corresponding to the third file that has been incrementally updated.
或者,上述计算机程序可以被分割成第二获取单元、第二还原单元和差分单元,各单元具体功能如下:第二获取单元,用于获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;第二还原单元,用于将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;差分单元,用于对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Alternatively, the above computer program can be divided into a second acquisition unit, a second restoration unit, and a difference unit, and the specific functions of each unit are as follows: the second acquisition unit is used to acquire the second terminal stored by the second terminal to be incrementally updated. A file and a second file corresponding to the first file that has been incrementally updated; a second restoring unit for restoring the first file to the first restoring file, and restoring the second file to A second restored file; a difference unit, configured to perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to store the first terminal on the first terminal When the third file to be incrementally updated is incrementally updated, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the same The third file corresponds to the fourth file that has been incrementally updated.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将上述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相 互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed. Module completion, that is, the internal structure of the above device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of distinguishing each other, and are not used to limit the protection scope of this application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端实施例仅仅是示意性的,例如,上述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device/terminal and method may be implemented in other ways. For example, the above-described device/terminal embodiments are merely illustrative. For example, the division of the above-mentioned modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components. It can be combined or integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separate, 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.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application 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.
上述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,上述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,上述计算机程序包括计算机程序代码,上述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。上述计算机可读介质可以包括:能够携带上述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。需要说明的是,上述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。If the above integrated modules/units are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code may be in the form of source code, object code, executable file, or some intermediate forms. The above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random Access memory (Random Access Memory, RAM), electric carrier signal, telecommunications signal, software distribution medium, etc. It should be noted that the content contained in the above-mentioned computer-readable media can be appropriately added or deleted in accordance with the requirements of the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to the legislation and patent practice, the computer-readable media cannot Including electric carrier signal and telecommunication signal.
以上上述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述 实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still compare the foregoing embodiments. The recorded technical solutions are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in this Within the scope of protection applied for.

Claims (20)

  1. 一种文件的增量更新方法,应用于第一终端,其特征在于,所述增量更新方法包括:A method for incremental updating of files, applied to a first terminal, characterized in that the incremental updating method includes:
    获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;Obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is stored by the second terminal on the second terminal The file obtained by restoring the first file to be incrementally updated; the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
    获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;Acquiring a third file to be incrementally updated stored by the first terminal, and restoring the third file as a third restoration file;
    将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;Synthesize the third restored file with the difference file to obtain a first synthesized file;
    对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Performing reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  2. 如权利要求1所述的增量更新方法,其特征在于,当所述第三文件为第一预设格式的压缩文件时,所述将所述第三文件还原为第三还原文件包括:5. The incremental update method according to claim 1, wherein when the third file is a compressed file in a first preset format, restoring the third file to a third restored file comprises:
    将所述第三文件解压为第一解压文件。Decompress the third file into a first decompressed file.
  3. 如权利要求1所述的增量更新方法,其特征在于,当所述第三文件为第二预设格式的待转换文件时,所述将所述第三文件还原为第三还原文件包括:The incremental update method according to claim 1, wherein when the third file is a file to be converted in a second preset format, the restoring the third file to the third restored file comprises:
    对所述第三文件进行格式转换,得到与所述第二预设格式对应的第三预设格式的第一转换文件。Performing format conversion on the third file to obtain a first converted file in a third preset format corresponding to the second preset format.
  4. 如权利要求1所述的增量更新方法,其特征在于,所述将所述第三文件还原为第三还原文件,包括:8. The incremental update method according to claim 1, wherein said restoring said third file to a third restored file comprises:
    调用第一插件将所述第三文件还原为所述第三还原文件;Calling the first plug-in to restore the third file to the third restored file;
    所述对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件包括:The reverse restoration of the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated includes:
    调用第二插件对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的所述第四文件。Invoking the second plug-in to reverse the restoration of the first composite file to obtain the fourth file corresponding to the third file that has been incrementally updated.
  5. 如权利要求2-4任意一项所述的增量更新方法,其特征在于,所述第三文件包括多个第一子文件,所述将所述第三文件还原为第三还原文件,包括:The incremental update method according to any one of claims 2-4, wherein the third file includes a plurality of first sub-files, and the restoring the third file to the third restored file includes :
    根据所述差分文件确认所述多个第一子文件中待进行增量更新的第一子文件;Confirming the first subfile to be incrementally updated among the plurality of first subfiles according to the difference file;
    将所述待进行增量更新的第一子文件中能够还原的第一子文件还原为第一还原子文件。Restore the first subfile that can be restored among the first subfiles to be incrementally updated as the first reduction file.
  6. 如权利要求5所述的增量更新方法,其特征在于,在所述根据所述差分文件确认所述多个第一子文件中待进行增量更新的第一子文件之后,包括:The incremental update method according to claim 5, wherein after the confirming the first subfile to be incrementally updated among the plurality of first subfiles according to the difference file, the method comprises:
    将所述待进行增量更新的第一子文件中不能够还原的第一子文件与所述差分文件进行合成,得到与所述不能够还原的第一子文件对应的已完成增量更新的文件。Synthesize the first sub-file that cannot be restored among the first sub-files to be incrementally updated with the difference file to obtain a completed incremental update corresponding to the first sub-file that cannot be restored file.
  7. 如权利要求1所述的增量更新方法,其特征在于,在将所述第三还原文件与所述差分文件进行合成,得到第一合成文件之前,包括:5. The incremental update method according to claim 1, wherein before synthesizing the third restored file with the difference file to obtain the first synthesized file, the method comprises:
    对所述差分文件进行完整性校验;Perform an integrity check on the differential file;
    所述将所述第三还原文件与所述差分文件进行合成,得到第一合成文件,包括:The synthesizing the third restored file with the difference file to obtain the first synthesized file includes:
    若所述完整性校验成功,则将所述第三还原文件与所述差分文件进行合成,得到所述第一合成文件。If the integrity check succeeds, the third restored file and the difference file are synthesized to obtain the first synthesized file.
  8. 如权利要求1所述的增量更新方法,其特征在于,在所述对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件之后,包括:The incremental update method according to claim 1, wherein after the reverse restoration of the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated, the method comprises :
    判断所述第四文件与所述第二文件是否一致;Determine whether the fourth file is consistent with the second file;
    若所述第四文件与所述第二文件一致,则确认已成功对所述第三文件进行增量更新。If the fourth file is consistent with the second file, it is confirmed that the third file has been successfully incrementally updated.
  9. 一种文件的增量更新方法,应用于第二终端,其特征在于,所述增量更新方法包括:A method for incremental update of files, applied to a second terminal, characterized in that the incremental update method includes:
    获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;Acquiring a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
    将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;Restoring the first file as a first restoring file, and restoring the second file as a second restoring file;
    对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
  10. 如权利要求9所述的增量更新方法,其特征在于,所述第一文件包括多个第二子文件,所述第二文件包括多个第三子文件;在所述将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件之前,包括:The incremental update method of claim 9, wherein the first file includes a plurality of second sub-files, and the second file includes a plurality of third sub-files; Before restoring the file as the first restored file and restoring the second file as the second restored file, it includes:
    将所述多个第二子文件中各个第二子文件的文件标识与所述多个第三子文件中各个第三子文件的文件标识进行比较,得到所述多个第二子文件中与对应的第三子文件的文件标识相同的第二子文件,以及不存在文件标识相同的第三子文件的第二子文件;The file identifier of each second subfile in the plurality of second subfiles is compared with the file identifier of each third subfile in the plurality of third subfiles to obtain the A second subfile with the same file identifier of the corresponding third subfile, and a second subfile in which there is no third subfile with the same file identifier;
    将所述与对应的第三子文件的文件标识相同的第二子文件确认为不存在更新的第二子文件,将所述不存在文件标识相同的第三子文件的第二子文件确认为存在更新的第二子文件。The second subfile with the same file identifier as the corresponding third subfile is confirmed as no updated second subfile, and the second subfile that does not exist with the third subfile with the same file identifier is confirmed as There is an updated second subfile.
  11. 如权利要求10所述的增量更新方法,其特征在于,所述将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件,包括:10. The incremental update method according to claim 10, wherein said restoring said first file as a first restoring file and restoring said second file as a second restoring file comprises:
    将所述存在更新的第二子文件中能够还原的第二子文件还原为第二还原子文件,以及将与所述能够还原的第二子文件文件名相同的第三子文件还原为第三还原子文件。Restore the second subfile that can be restored among the updated second subfiles to the second reduction file, and restore the third subfile with the same file name as the restored second subfile to the third Return atomic files.
  12. 如权利要求11所述的增量更新方法,其特征在于,The incremental update method of claim 11, wherein:
    所述对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件,包括:The performing a differential operation on the first restored file and the second restored file to obtain a differential file includes:
    将所述存在更新的第二子文件中不能够还原的第二子文件与对应的第三子文件进行差分运算,并将所述第二还原子文件与对应的所述第三还原子文件进行差分运算,得到所述差分文件;所述差分文件携带有存在更新的第二子文件的标记信息、不存在更新的第二子文件的标记信息以及新增文件的文件信息。Perform a difference operation between the second subfile that cannot be restored among the updated second subfiles and the corresponding third subfile, and perform the second reduction file with the corresponding third reduction file The difference operation is performed to obtain the difference file; the difference file carries the mark information of the updated second subfile, the mark information of the second subfile that does not exist, and the file information of the newly added file.
  13. 如权利要求9所述的增量更新方法,其特征在于,所述对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件之后,包括:9. The incremental update method according to claim 9, wherein after performing a differential operation on the first restored file and the second restored file to obtain a differential file, the method comprises:
    将所述差分文件与所述第一还原文件进行合成,得到第二合成文件;Synthesize the difference file with the first restored file to obtain a second synthesized file;
    对所述第二合成文件进行反还原得到待确认文件;Reverse restore the second composite file to obtain the file to be confirmed;
    判断所述待确认文件与所述第二文件是否一致;Determine whether the file to be confirmed is consistent with the second file;
    若所述待确认文件与所述第二文件一致,则保存对所述第一还原文件和所述第二还原文件进行差分运算得到的差分文件。If the file to be confirmed is consistent with the second file, save the difference file obtained by performing a difference operation on the first restored file and the second restored file.
  14. 如权利要求13所述的增量更新方法,其特征在于,所述判断所述待确认文件与所述第二文件是否一致之后,包括:The incremental update method according to claim 13, wherein after determining whether the file to be confirmed is consistent with the second file, the method comprises:
    若所述待确认文件与所述第二文件不一致,则将对所述第一还原文件和所述第二还原文件进行差分运算得到的差分文件标记为错误文件。If the file to be confirmed is inconsistent with the second file, the difference file obtained by performing the difference operation on the first restored file and the second restored file is marked as an error file.
  15. 一种文件的增量更新装置,配置于第一终端,其特征在于,包括:A device for incrementally updating files, which is configured in a first terminal, is characterized in that it includes:
    第一获取单元,用于获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;The first obtaining unit is configured to obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is the second terminal pair The file obtained by restoring the first file to be incrementally updated stored by the second terminal; the second restored file is the first file that the second terminal has completed the incremental update corresponding to the first file 2. The file obtained by restoring the file;
    第一还原单元,用于获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;The first restoration unit is configured to obtain a third file to be incrementally updated stored in the first terminal, and restore the third file to a third restoration file;
    合成单元,用于将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;A synthesis unit, configured to synthesize the third restored file and the difference file to obtain a first synthesized file;
    反还原单元,用于对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The anti-restoration unit is configured to perform anti-restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  16. 一种文件的增量更新装置,配置于第二终端,其特征在于,包括:A device for incrementally updating files, which is configured in a second terminal, is characterized in that it includes:
    第二获取单元,用于获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;A second acquiring unit, configured to acquire a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
    第二还原单元,用于将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;A second restoring unit, configured to restore the first file to the first restored file, and restore the second file to the second restored file;
    差分单元,用于对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的 第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。The difference unit is used to perform a difference operation on the first restored file and the second restored file to obtain a difference file; the difference file is used to incrementally update the to-be-stored first terminal at the first terminal When the third file of the third file is incrementally updated, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the third file corresponding to the third file The fourth file that has been incrementally updated.
  17. 一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如下步骤:A terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    获取差分文件;所述差分文件包括第二终端对第一还原文件以及第二还原文件进行差分运算得到的差分文件;所述第一还原文件为所述第二终端对所述第二终端存储的待进行增量更新的第一文件进行还原得到的文件;所述第二还原文件为所述第二终端对与所述第一文件对应的已完成增量更新的第二文件进行还原得到的文件;Obtain a differential file; the differential file includes a differential file obtained by a second terminal performing a differential operation on a first restored file and a second restored file; the first restored file is stored by the second terminal on the second terminal The file obtained by restoring the first file to be incrementally updated; the second restored file is the file obtained by restoring the second file corresponding to the first file that has been incrementally updated by the second terminal ;
    获取所述第一终端存储的待进行增量更新的第三文件,并将所述第三文件还原为第三还原文件;Acquiring a third file to be incrementally updated stored by the first terminal, and restoring the third file as a third restoration file;
    将所述第三还原文件与所述差分文件进行合成,得到第一合成文件;Synthesize the third restored file with the difference file to obtain a first synthesized file;
    对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Performing reverse restoration on the first composite file to obtain a fourth file corresponding to the third file that has been incrementally updated.
  18. 一种终端,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如下步骤:A terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    获取所述第二终端存储的待进行增量更新的第一文件以及与所述第一文件对应的已完成增量更新的第二文件;Acquiring a first file to be incrementally updated stored by the second terminal and a second file corresponding to the first file that has been incrementally updated;
    将所述第一文件还原为第一还原文件,并将所述第二文件还原为第二还原文件;Restoring the first file as a first restoring file, and restoring the second file as a second restoring file;
    对所述第一还原文件和所述第二还原文件进行差分运算,得到差分文件;所述差分文件用于在第一终端对所述第一终端存储的待进行增量更新的第三文件进行增量更新时,与所述第三文件对应的第三还原文件进行合成,得到第一合成文件,并对所述第一合成文件进行反还原得到与所述第三文件对应的已完成增量更新的第四文件。Perform a differential operation on the first restored file and the second restored file to obtain a differential file; the differential file is used to perform, at the first terminal, a third file stored in the first terminal to be incrementally updated During incremental update, the third restored file corresponding to the third file is synthesized to obtain the first synthesized file, and the first synthesized file is reversely restored to obtain the completed increment corresponding to the third file The updated fourth file.
  19. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至8任意一项所述方法的步骤。A computer-readable storage medium storing a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 8 when the computer program is executed by a processor.
  20. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求9至14任意一项所述方法的步骤。A computer-readable storage medium storing a computer program, wherein the computer program implements the steps of the method according to any one of claims 9 to 14 when the computer program is executed by a processor.
PCT/CN2019/124363 2019-12-10 2019-12-10 Method and apparatus for incremental update of file, and terminal and computer-readable storage medium WO2021114101A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980100492.2A CN114402311A (en) 2019-12-10 2019-12-10 Incremental updating method and device of file, terminal and computer-readable storage medium
PCT/CN2019/124363 WO2021114101A1 (en) 2019-12-10 2019-12-10 Method and apparatus for incremental update of file, and terminal and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/124363 WO2021114101A1 (en) 2019-12-10 2019-12-10 Method and apparatus for incremental update of file, and terminal and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2021114101A1 true WO2021114101A1 (en) 2021-06-17

Family

ID=76329181

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/124363 WO2021114101A1 (en) 2019-12-10 2019-12-10 Method and apparatus for incremental update of file, and terminal and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN114402311A (en)
WO (1) WO2021114101A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486313A (en) * 2021-07-05 2021-10-08 江苏欧帝电子科技有限公司 Uniform identity authentication method and system for school system personnel

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103713928A (en) * 2013-12-31 2014-04-09 优视科技有限公司 Incremental file generating method, and application program installing file updating method and device
CN105573785A (en) * 2015-12-11 2016-05-11 青岛海信电器股份有限公司 Differential package manufacturing method and device
CN106462430A (en) * 2016-08-29 2017-02-22 北京小米移动软件有限公司 Method and device for obtaining application upgrade packages
CN107391145A (en) * 2017-07-27 2017-11-24 中兴通讯股份有限公司 AKU preparation method and device, the method and device of upgrade file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103713928A (en) * 2013-12-31 2014-04-09 优视科技有限公司 Incremental file generating method, and application program installing file updating method and device
CN105573785A (en) * 2015-12-11 2016-05-11 青岛海信电器股份有限公司 Differential package manufacturing method and device
CN106462430A (en) * 2016-08-29 2017-02-22 北京小米移动软件有限公司 Method and device for obtaining application upgrade packages
CN107391145A (en) * 2017-07-27 2017-11-24 中兴通讯股份有限公司 AKU preparation method and device, the method and device of upgrade file

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486313A (en) * 2021-07-05 2021-10-08 江苏欧帝电子科技有限公司 Uniform identity authentication method and system for school system personnel
CN113486313B (en) * 2021-07-05 2023-07-25 江苏欧帝电子科技有限公司 Unified identity authentication method and system for school system personnel

Also Published As

Publication number Publication date
CN114402311A (en) 2022-04-26

Similar Documents

Publication Publication Date Title
US20210209373A1 (en) Media authentication using distributed ledger
US20210124573A1 (en) Firmware upgrade method and apparatus, and terminal
JP6457406B2 (en) Manage operations on stored data units
JP6491605B2 (en) Manage operations on stored data units
CN113468118B (en) File increment storage method, device and storage medium based on blockchain
CN113326165A (en) Data processing method and device based on block chain and computer readable storage medium
WO2021114101A1 (en) Method and apparatus for incremental update of file, and terminal and computer-readable storage medium
JP6632380B2 (en) Managing operations on stored data units
CN112445769A (en) Block chain-based on-chain storage method and device, terminal equipment and medium
WO2021087662A1 (en) Memory allocation method and apparatus, terminal, and computer readable storage medium
CN111324645A (en) Data processing method and device for block chain
WO2021097624A1 (en) File processing method, file processing apparatus, and terminal device
WO2021097623A1 (en) File processing method and device, and terminal apparatus
CN115129360A (en) Code file management method and device, electronic equipment and storage medium
WO2020088211A1 (en) Data compression method and related apparatus, and data decompression method and related apparatus
EP2843587A1 (en) Method for generating evidence-data for a long-term data storage system for datasets
WO2021128269A1 (en) File processing method, file processing device, mobile terminal and server
CN110888863A (en) State field optimization method and device, electronic equipment and storage medium
CN113688360B (en) Distributed digital signature processing method and system thereof
CN114218441B (en) Method for calling and displaying UOF document
US20230131294A1 (en) Executable code blocks based on captured user interactions
CN112579547B (en) Image file compression method and device for embedded system
CN112860284B (en) SP upgrade package generation method and device for equipment remote upgrade and computer equipment
TWI735841B (en) Computer system and method for verifying archived data
CN114386056A (en) Method for processing data storage integrity and terminal equipment

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: 19955924

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 FORM1205A DATED 020822)

122 Ep: pct application non-entry in european phase

Ref document number: 19955924

Country of ref document: EP

Kind code of ref document: A1