File updating method, electronic equipment and storage medium

By pre-establishing block index information during file updates and using block index matching to determine reusable and differential blocks, the problem of high computational pressure on the server side of the differential update algorithm is solved, and efficient incremental updates are achieved.

CN121833010APending Publication Date: 2026-04-10GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGZHOU BOGUAN TELECOMM TECH LTD
Filing Date
2025-12-10
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Differential update algorithms consume a lot of computing power on the server side, increasing the server's computational pressure and cost.

Method used

By pre-establishing block index information for the current and updated files, reusable and differing blocks can be quickly identified using block index matching, reducing the computational burden on the server.

Benefits of technology

This enables the rapid determination of difference blocks, reduces the computational burden on the server for incremental updates, and helps to reduce server costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833010A_ABST
    Figure CN121833010A_ABST
Patent Text Reader

Abstract

The invention discloses a file updating method, electronic equipment and a storage medium. The method comprises the steps that first index information of a current file and second index information of a corresponding updating file are obtained, the first index information comprises block indexes of a plurality of first blocks of the current file, and the second index information comprises block indexes of a plurality of second blocks of the updating file; comparing the first index information with the second index information, and determining that third index information matched with the first index information exists in the second index information; and obtaining a first block matched with the third index information in the current file, and downloading a second block not matched with the third index information in the update file from the cloud to update the current file. By establishing the block index information of the update file and the historical file in advance, the difference block needing to be downloaded can be quickly determined only by comparing the block indexes during incremental update, the required computing power is low, the computing pressure of a server for realizing incremental update is reduced, and the cost of the server is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document update technology, specifically to a document update method, electronic device, and storage medium. Background Technology

[0002] In today's world, the updating and release of software applications, game resources, and various datasets has become commonplace. Traditional update mechanisms typically employ a full update model, meaning that if a file is modified, the entire file is downloaded again. Full updates consume significant network bandwidth and are slow.

[0003] Therefore, the differential update algorithm emerged. Differential update, also known as incremental update or differential update, is a highly efficient software update technique. Its core idea is that the server does not directly publish the complete new version file. Instead, it uses a specific data comparison algorithm to generate a "differential package" (or patch file) that only describes the differences between the old and new versions. When updating, the client only needs to download this much smaller differential package and then use the existing old version file and the differential package to reconstruct the complete new version file locally through a synthesis algorithm.

[0004] However, generating differential packets requires the server to consume a lot of computing power to execute specific comparison algorithms, which greatly increases the computational pressure on the server and increases the server cost due to incremental updates. Summary of the Invention

[0005] This application provides a file update method, electronic device, and storage medium. By pre-establishing block index information for updated files and historical files, during incremental updates, only the block index needs to be compared to quickly determine reusable blocks and difference blocks that need to be downloaded. The computational power required to determine the difference blocks is low, which reduces the computational pressure on the server to implement incremental updates and helps to reduce server costs.

[0006] In a first aspect, embodiments of this application provide a file updating method, the method comprising: Obtain the first index information of the current file and the second index information of the corresponding updated file. The first index information includes the block indexes of multiple first blocks of the current file, and the second index information includes the block indexes of multiple second blocks of the updated file. By comparing the first index information and the second index information, it is determined that there is a third index information in the second index information that matches the first index information; The system retrieves a first block in the current file that matches the third index information and downloads a second block in the updated file from the cloud that does not match the third index information, in order to update the current file.

[0007] Secondly, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the file update method as described in any of the above embodiments by calling the computer program stored in the memory.

[0008] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the file update method as described in any of the above embodiments.

[0009] The file update method, electronic device, and storage medium provided in this application establish a first index information for the current file (i.e., the historical version of the file to be updated) and a second index information for the updated file in advance. The first index information includes block indices of multiple first blocks of the current file, and the second index information includes block indices of multiple second blocks of the updated file. The block indexes can represent the corresponding blocks, and the first and second blocks with the same block index are the same blocks.

[0010] Each time a user updates, they not only download the file but also its index information. When an update is needed, the system retrieves the first index information of the current file locally and the second index information of the updated file stored in the cloud. Then, it compares the first and second index information to obtain the third index information in the updated file that matches the first index information. For example, the third index information may include multiple block indices of the second block that share the same first block.

[0011] It can be understood that each second block corresponding to the third index information is a reused block of the corresponding first block locally; while other second blocks that do not match the third index information are difference blocks. Therefore, after determining the third index information, the difference blocks can be downloaded from the cloud to achieve incremental updates, and then the reused blocks can be obtained from the current file locally and combined to form a complete update file to complete the update of the current file.

[0012] In this way, the difference blocks can be quickly determined by matching the block index. The determination of the difference blocks requires less computing power, which reduces the computational pressure on the server to implement incremental updates and helps to reduce the cost of the server. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 This is a schematic diagram of an example file update system provided in an embodiment of this application.

[0015] Figure 2 This is a first flowchart illustrating the file update method provided in an embodiment of this application.

[0016] Figure 3 This is a schematic diagram illustrating the principle of the file update method provided in the embodiments of this application.

[0017] Figure 4 This is a second flowchart illustrating the file update method provided in an embodiment of this application.

[0018] Figure 5 This is a schematic diagram of the third process of the file update method provided in the embodiments of this application.

[0019] Figure 6 This is a schematic diagram of the fourth process of the file update method provided in the embodiments of this application.

[0020] Figure 7 This is a schematic diagram of the structure of the file update device provided in the embodiments of this application.

[0021] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] This application provides a file update method, apparatus, storage medium, device, and program product. Specifically, the file update method of this application can be executed by an electronic device, which can be a terminal or server, etc.

[0024] The terminal can be a smartphone, tablet, laptop, smart TV, wearable smart device, smart vehicle terminal, etc. The terminal can also include a client, which can be a game client, browser client, instant messaging client, or mini-program, etc.

[0025] A server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0026] For example, when the file update method runs on a terminal device, the terminal device may include a display screen and a processor. The display screen is used to present the download screen and receive instructions generated by the player interacting with it. The download screen may include a portion of a virtual game scene, which is a virtual world where virtual characters move. The processor is used to store the game application, run the game, generate game screens, respond to instructions, and control the display of the game screen on the display screen. When the player interacts with the download screen through the display screen, the download screen can control local content on the terminal device (such as displaying the download progress) in response to received operation instructions. The terminal device can provide the graphical user interface to the player in various ways, such as rendering it on the terminal device's display screen or presenting the graphical user interface through holographic projection.

[0027] For example, when the file update method runs on a server, it can be implemented and executed based on a cloud system. A cloud system refers to a gaming approach based on cloud computing. A cloud system includes servers and client devices. The core of the game application and the core of the game screen presentation are separate; the storage and execution of the file update method are completed on the server. The game screen presentation is completed on the client, which is mainly used for receiving and sending game data and displaying game screens (such as the game download screen). For example, the client can be a display device with data transmission capabilities located close to the player, such as a mobile terminal, television, computer, PDA, personal digital assistant, or head-mounted display device. However, the terminal device for processing game data is the server in the cloud. During download, the player uses the client to send an update command to the server. The server executes the file update method according to the command, encodes and compresses the differential file data, returns it to the client via the network, and finally, the client decodes it to assemble a complete update file.

[0028] It should be noted that in the embodiments of this application, the executing entity of the file update method can be a terminal device or a server, and the embodiments of this application do not limit the type of executing entity.

[0029] It is understood that in the specific implementation of this application, user object data, context data and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0030] For example, in conjunction with the above description, Figure 1 This application illustrates a file update system 1000 for implementing a file update method, as provided in an embodiment of this application. The file update system 1000 may include at least one terminal 1001, at least one server 1002, at least one database 1003, and a network. The terminal 1001 can connect to different servers via the network. The terminal is any device with computing hardware capable of supporting and executing software application tools corresponding to the game.

[0031] In the aforementioned file update system 1000, terminal 1001 is used to download, install, and run applications such as games. After the game update is complete, players can log in to the game application using their registered game accounts and control the virtual character corresponding to those accounts to participate in the game. When a player updates the game application, terminal 1001 can send an update request to server 1002. Server 1002 verifies the game account used by the player and, based on the update request, begins executing the file update method. The terminal receives differential file data sent by the server and combines it with locally reused file data to form a complete update file, achieving incremental updates.

[0032] In possible application scenarios, different terminals 1001 may be served by different servers 1002. Therefore, in order to distinguish the servers 1002 corresponding to different game terminals 1001, the embodiments of this application will use the terms "first" and "second" to describe them. In fact, the servers 1002 corresponding to different game terminals 1001 can be the same server 1002. Therefore, without distinguishing between "first" and "second", it can be understood that the terminals 1001 corresponding to virtual characters in the same game scene are served by the same server 1002.

[0033] Furthermore, when the file update system 1000 includes multiple terminals, multiple servers, and multiple networks, different terminals can connect to each other through different networks and different servers. The network can be a wireless network or a wired network; for example, wireless networks include Wi-Fi, LAN, cellular networks, 2G networks, 3G networks, 4G networks, 5G networks, etc. Additionally, different terminals can also connect to other terminals or to servers using their own Bluetooth networks or hotspot networks. Furthermore, the system 100 can include multiple databases coupled to different servers, and can continuously store game-related information in the databases while different users are playing multiplayer games online.

[0034] It should be noted that, Figure 1 The illustrated file update system diagram is merely an example. The file update system 1000 described in this application embodiment is intended to more clearly illustrate the technical solutions of this application embodiment and does not constitute a limitation on the technical solutions provided in this application embodiment. As those skilled in the art will know, with the evolution of file update systems and the emergence of new business scenarios, the technical solutions provided in this application embodiment are also applicable to similar technical problems.

[0035] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0036] Please see Figure 2 and Figure 3 It should be noted that the steps shown may be executed in a logical order different from that shown in the flowchart of this method. The document update method of this application may include the following steps: Step 011: Obtain the first index information of the current file and the second index information of the corresponding updated file. The first index information includes the block indexes of multiple first blocks of the current file, and the second index information includes the block indexes of multiple second blocks of the updated file. The block indexes of the same first block and second block are the same.

[0037] The current file refers to the file to be updated within the local application, and its version is earlier than the version of the file to be updated. It's understandable that only some files in the local application may have been updated; therefore, during the update process, only the files to be updated within the application need to be updated.

[0038] The updated file is a file stored in the cloud, and its version is newer than the current file's version. The updated file is used to update the current file, such as generating a file that differs from the current file after fixing bugs in the current file.

[0039] Each file has specific identification information (such as the filename). By comparing the identification information, the corresponding current file on the local machine can be determined. For example, if the identification information of the updated file and the current file are the same...

[0040] The first index information includes block indices for multiple first blocks of the current file. Hash values ​​representing the corresponding first blocks can be obtained by hashing each of the multiple first blocks in the current file, and then block indices can be generated based on the hash values ​​of each first block. It can be understood that the first index information can be downloaded to the local machine along with the current file during the last update.

[0041] The second index information includes block indices for multiple second blocks of the updated file. Hash values ​​representing the corresponding second blocks can be obtained by hashing each of the multiple second blocks in the updated file, and then block indices can be generated based on the hash values ​​of each second block.

[0042] It is understandable that the second index information is obtained by comparing the current file with historical versions in advance in the cloud, thereby dividing it into multiple second blocks (including second blocks that are the same as the first block, and second blocks that do not have the same first block) and the block index of the second blocks.

[0043] It is understandable that the first and second blocks have the same block index. Therefore, compared to directly comparing the first and second blocks, comparing the block index, which has a smaller data volume, requires less computation. Furthermore, the block index is reusable. Compared to incremental updates for different terminals, where the current file may differ, resulting in different difference blocks and requiring each terminal to compare the first and second blocks during updates, leading to a large computational burden, the block index of the updated file in this application can be calculated only once and used for incremental updates on all terminals, further reducing the computational burden of incremental updates.

[0044] Step 012: Compare the first index information and the second index information to determine that there is a third index information in the second index information that matches the first index information.

[0045] The third index information is the index information in the second index information of the updated file that matches the first index information of the current file. It contains the block indices of all second blocks in the updated file that can reuse the first block of the current file. In other words, the second block that matches the third index information is a reuse block that does not need to be updated and can be directly reused from the local first block, while the block that does not match the third index information is a difference block that needs to be updated.

[0046] Step 013: Obtain the first block in the current file that matches the third index information, and download the second block in the update file that does not match the third index information from the cloud to update the current file.

[0047] After obtaining the third index information, incremental updates can begin. During incremental updates, the reuse block (i.e., the first block in the current file that matches the third index information) is obtained from the local machine, while the difference block is downloaded from the cloud. Finally, the reuse block and the difference block (i.e., the second block that does not match the third index information) are combined locally to obtain the complete updated file, thus achieving incremental updates.

[0048] The file update method provided in this application establishes a first index information for the current file (i.e., the historical version of the file to be updated) and a second index information for the updated file in advance. The first index information includes block indices of multiple first blocks of the current file, and the second index information includes block indices of multiple second blocks of the updated file. The block indexes can represent the corresponding blocks, and the first and second blocks with the same block index are the same blocks.

[0049] Each time a user updates, they not only download the file but also its index information. When an update is needed, the system retrieves the first index information of the current file locally and the second index information of the updated file stored in the cloud. Then, it compares the first and second index information to obtain the third index information in the updated file that matches the first index information. For example, the third index information may include multiple block indices of the second block that share the same first block.

[0050] It can be understood that each second block corresponding to the third index information is a reused block of the corresponding first block locally; while other second blocks that do not match the third index information are difference blocks. Therefore, after determining the third index information, the difference blocks can be downloaded from the cloud to achieve incremental updates, and then the reused blocks can be obtained from the current file locally and combined to form a complete update file to complete the update of the current file.

[0051] In this way, the difference blocks can be quickly determined by matching the block index. The determination of the difference blocks requires less computing power, which reduces the computational pressure on the server to implement incremental updates and helps to reduce the cost of the server.

[0052] Please see Figure 4 In some embodiments, the file update method further includes: Step 014: Generate preset index information for the updated file. The preset index information includes block index and / or cross-file index. The block index is used to represent the block information of the corresponding block in the updated file, and the cross-file index is used to represent the blocks that the corresponding block matches across files in the historical version of the file.

[0053] The preset index information includes block indexes and / or cross-file indexes. Block indexes are used for block matching within the same file and represent the block information of the corresponding block in the updated file. Cross-file indexes are used for block matching across different files and represent the cross-file matching blocks of the corresponding block in historical versions of the file (such as other local files). For example, the cross-file index of the second block of the updated file can determine the same block in other local files.

[0054] It's understandable that the file being updated can be a file that needs updating every time it's updated, and each time the file is updated, a corresponding preset index information is generated. Therefore, the corresponding preset index information also exists in the current file on the local machine.

[0055] In one optional embodiment, the block index includes first block location information and block verification information, wherein the first block location information is used to characterize the position of the block in the file and the block verification information is used to perform block matching; the cross-file index includes second block location information, wherein the second block location information is used to characterize the position of the cross-file matched block in the file.

[0056] The first block of location information represents the position of the block within the file, facilitating the subsequent assembly of the correct file based on its position. The block verification information represents the information of the corresponding block; for example, it can be a hash value obtained by hashing the block. Different blocks require different verification information, which can be used for block matching.

[0057] The second location information represents the position of the matched block within the file. This second location information may include the file ID and block offset, allowing for quick location of the corresponding file and block. Updating the second location information of a file can locate the corresponding block within that file, thus enabling rapid cross-file block reuse.

[0058] In this way, not only can block indexes be built for block matching of the same file (such as the current file and the updated file), enabling block reuse within the same file, but cross-file indexes can also be built for block matching of different files (such as other local files and the updated file), enabling cross-file block reuse, further reducing the update size of incremental updates and improving update speed.

[0059] In one optional embodiment, the block index further includes the block size and block length. Therefore, during block matching, not only the block check information but also the block length and block size need to be matched, improving matching accuracy.

[0060] In an optional embodiment, the second index information further includes updating the cross-file index of each third block of the file, step 013, which includes: Step 0131: Obtain the blocks in the current file that match the third index information, and the blocks in other local files that match the cross-file index, and download the blocks in the update file that do not match the third index information and do not have a cross-file index from the cloud to update the current file.

[0061] In other words, updating files can not only reuse blocks of the same file, but also reuse some third blocks across files. By establishing a cross-file index for the third block in advance, the block that matches the cross-file index can be quickly located in other local files (such as files corresponding to the application, files other than the current file).

[0062] Therefore, during incremental updates, only blocks in the update file that do not match the third index information and do not exist across file indexes need to be downloaded from the cloud to update the current file.

[0063] In one alternative embodiment, if the cross-file index cannot locate the corresponding block in other local files, it can be determined that the block matched by the cross-file index has been lost. In this case, the third block corresponding to the cross-file index still needs to be downloaded from the cloud to ensure the integrity of the update.

[0064] Please see Figure 5 In one optional embodiment, step 014 includes: Step 0141: Perform block matching between the updated file and the target file of the historical version to determine the block index corresponding to each first matching block of the updated file. The target file includes at least the current file. Step 0142: Perform block matching between the updated file and other files in the historical versions, excluding the target file, to determine the cross-file index corresponding to each second matching block of the updated file.

[0065] The target file is the file corresponding to the file being updated, such as a file with the same identifier information, to ensure efficient block matching. The target file must at least be the current file to ensure that incremental updates can be achieved through block index matching.

[0066] The target file for the historical version can include at least one version of the file preceding the updated file, thus meeting the incremental update needs of users with different historical versions. When users with different historical versions perform incremental updates, block index comparison and cross-file indexing can quickly determine the difference blocks without requiring file block comparison. It can be understood that the historical version includes at least the version preceding the updated file.

[0067] When generating the block index of the updated file, the updated file is matched with the target file of the historical version to obtain the same reused blocks and different difference blocks in the updated file and the target file, thereby generating a corresponding block index for each second block of the updated file.

[0068] When generating a cross-file index for an updated file, the updated file is matched with other files in the historical version (excluding the target file) to obtain the same reused blocks as the other files. This allows the generation of a corresponding cross-file index for each third block (i.e., a block that can be reused across files) of the updated file.

[0069] It is understandable that there is no restriction on the execution order between steps 0141 and 0142. The block index can be determined first, the cross-file index can be determined first, or both the block index and the cross-file index can be determined simultaneously.

[0070] In an optional embodiment, step 0141 includes: Step 0141: Obtain the binary stream of the updated file and the first block index of each block of the target file. The first block index includes the first block check value and the corresponding second block check value. Step 0142: Perform a rolling hash calculation on the binary stream based on a preset rolling window to obtain the rolling hash value corresponding to the binary stream within the rolling window; Step 0143: Match the rolling hash value with the first block check value to obtain the first matching result. The first matching result includes whether there is a first block check value that matches the rolling hash value. Step 0144: If there is a first block check value that matches the rolling hash value, then based on the first target block in the target file corresponding to the matching first block check value, the binary stream is pre-divided into blocks to obtain a second target block of the same size as the first target block. Step 0145: Calculate the third block check value of the second target block, and match the third block check value with the second block check value of the first target block to obtain the second matching result. The second matching result includes whether the first target block and the second target block match. Step 0146: If the first target block and the second target block match, then the second target block is taken as the first matching block, and a block index of the first matching block is generated based on the position of the first matching block in the updated file, the rolling hash value, and the third block check value.

[0071] Specifically, the binary stream of the file to be updated and the first block index of each block of the target file can be obtained first to realize the block division and block matching of the updated file. The first block index includes the first block check value for weak verification and the second block check value for strong verification. The first block check value is generally generated by hash calculation based only on a part of the data in the block (such as the first few bytes of the block), while the second block check value is hashed based on the data of the entire block.

[0072] Then, a rolling hash calculation is performed on the binary stream based on a preset rolling window to obtain the rolling hash value corresponding to the binary stream within the rolling window. The size of the rolling window is the same as the number of bytes used to generate the first checksum, ensuring that the rolling hash value can match the first checksum. For example, the size of both the rolling window and the first checksum is 700 bytes.

[0073] The rolling hash value is matched with the first check value to obtain the first matching result, which includes whether there is a first check value that matches the rolling hash value. If a first checksum that matches the rolling hash value exists, it can be preliminarily determined that the data in the rolling window has a matching block in the target file. At this time, based on the first target block corresponding to the first checksum in the target file, the binary stream is pre-divided into blocks to obtain a second target block of the same size as the first target block. Then, a more precise match is performed on the first target block and the second target block. The third check value of the second target block (such as the value obtained by hashing the second target block) can be calculated, and the third check value is matched with the second check value of the first target block to obtain the second matching result. The second matching result includes whether the first target block and the second target block match.

[0074] If the third checksum is the same as the second checksum of the first target block, it means that the first and second target blocks match (the first target block can reuse the second target block). In this case, the second target block in the binary stream can be separated as the first matching block. Based on the position of the first matching block in the updated file (generating the first block position information), the rolling hash value, and the third checksum (generating block checksum information), a block index for the first matching block is generated. Then, the rolling window restarts the rolling hash calculation from the end of the first matching block.

[0075] If the third check value is different from the second check value of the first target block, it means that the first target block and the second target block do not match (the first target block cannot reuse the second target block).

[0076] If the rolling hash value does not match the first block check value or the first target block and the second target block do not match, it means that the current rolling hash value cannot achieve block matching within the same file, but it does not rule out the possibility that the rolling hash value can achieve block matching across files.

[0077] Therefore, in an optional embodiment, step 0142 includes: Step 01421: Obtain the second block index of each block of the historical versions of files other than the target file. The second block index includes the fourth block check value and the fifth block check value. Step 01422: If there is no first block check value that matches the rolling hash value, or if the first target block and the second target block do not match, the rolling hash value is matched with the fourth block check value to obtain a third matching result. The third matching result includes whether there is a fourth block check value that matches the rolling hash value. Step 01423: If there is a fourth block check value that matches the rolling hash value, then based on the third target block corresponding to the matching fourth block check value in other files, the binary stream is pre-divided into blocks to obtain a fourth target block of the same size as the third target block. Step 01424: Calculate the sixth check value of the fourth target block and match the sixth check value with the fifth check value of the third target block to obtain the fourth matching result. The fourth matching result includes whether the third target block and the fourth target block match. Step 01425: If the third target block and the fourth target block match, then the fourth target block is taken as the second matching block, and a cross-file index of the second matching block is generated based on the position of the third target block in other files.

[0078] Specifically, when performing cross-file block matching, the second block index of each block of the historical versions of other files besides the target file can be obtained first. The second block index includes the fourth block check value and the fifth block check value. The second block index includes the fourth block check value for weak verification and the fifth block check value for strong verification. The fourth block check value is generally generated by hash calculation based only on part of the data in the block (such as the first few bytes of the block), while the fifth block check value is generated by hash calculation based on the data of the entire block.

[0079] If there is no first checksum that matches the rolling hash value, or if the first target block and the second target block do not match, the rolling hash value can be matched with the fourth checksum to obtain a third matching result. The third matching result includes whether there is a fourth checksum that matches the rolling hash value. If a fourth checksum that matches the rolling hash value exists, it can be preliminarily determined that there are cross-file matching blocks in the data within the rolling window. At this time, based on the third target block that matches across files, the binary stream is pre-divided into blocks to obtain a fourth target block of the same size as the third target block. Next, a more precise match is performed on the third and fourth target blocks. The sixth check value of the fourth target block (obtained by hashing the fourth target block) can be calculated, and the sixth check value is matched with the fifth check value of the third target block to obtain the fourth matching result. The fourth matching result includes whether the third and fourth target blocks match.

[0080] If the sixth checksum is the same as the fifth checksum of the third target block, it means that the third and fourth target blocks match (the fourth target block can reuse the third target block across files). At this point, the binary stream corresponding to the fourth target block can be divided into two parts as the second matching block. Based on the position of the third target block in other files (i.e., the position information of the second block), a cross-file index for the second matching block is generated. Then, the rolling window restarts the rolling hash calculation from the end of the divided second matching block.

[0081] If the sixth checksum is different from the fifth checksum of the third target block, it means that the third target block and the fourth target block do not match (the fourth target block cannot reuse the third target block across files).

[0082] If the rolling hash value fails to achieve cross-file matching (corresponding to steps 01411 to 01416) or cross-file block matching (corresponding to steps 01421 to 01425), it indicates that the division of the second and fourth target blocks is inaccurate. The rolling window needs to continue sliding along its current position to calculate a new rolling hash value. Each slide will perform a cross-file block matching and a cross-file block matching until the rolling window slides to the end of the binary stream, completing the rolling hash calculation for the entire binary stream, thereby dividing the first matching block and the second matching block.

[0083] In one optional embodiment, if the rolling hash value does not match either the first block checksum or the fourth block checksum, the binary stream within the rolling window is determined to be differential data; or, if the rolling hash value matches the first block checksum and the first target block and the second target block do not match, the binary stream within the rolling window is determined to be differential data; or, if the rolling hash value matches the fourth block checksum and the third target block and the fourth target block do not match, the binary stream within the rolling window is determined to be differential data.

[0084] If the number of bytes of consecutive difference data reaches the preset block size (such as the pre-configured maximum block size, which can be determined based on the file size; the larger the file size, the larger the maximum block size, to avoid too many file blocks), then the consecutive difference data can be divided into a single difference block; or, if the rolling hash value matches the target file or other files again after the previous match, the consecutive difference data between the two matches can be divided into a single difference block.

[0085] In other words, if the difference between two adjacent matching blocks is less than or equal to the preset number of blocks in bytes, they can be divided into one difference block. If the difference between two adjacent matching blocks is greater than the preset number of blocks in bytes, they can be divided into multiple difference blocks. Finally, a corresponding block index is generated for each difference block.

[0086] In this way, the preset index information of the updated file can be established, thereby obtaining the block index of the first matching block that can be reused for the same file, the cross-file index of the second matching block that can be reused across files, and the block index of the difference block that cannot be reused and needs to be downloaded in its entirety.

[0087] In one alternative embodiment, the block indices of all blocks of all other files in the historical version besides the target file can form an index set. When performing cross-file block matching, the updated file (such as the rolling hash value and the sixth block check value) can be block matched against the index set to determine the cross-file index corresponding to each second matching block of the updated file.

[0088] In an optional embodiment, after obtaining the fourth matching result, it can also be determined whether the file information of the fourth target block has changed; if so, it is determined that the fourth target block does not match the third target block.

[0089] It is understandable that if the file information of the file containing the third target block (such as MD5 checksum information representing file integrity) has changed relative to the file information of the corresponding file in the updated file version, it indicates that the file containing the third target block has also been updated. Continuing to reuse this file across files may result in errors. Therefore, at this time, it can be directly determined that the fourth target block does not match the third target block, avoiding the reuse of the third target block in the updated file and ensuring the accuracy of the update.

[0090] In one alternative embodiment, if the number of bytes in any fifth target block of the updated file is less than a preset number of bytes, the fifth target block and the adjacent blocks are merged to generate a difference block.

[0091] After updating the file into blocks, fragmented blocks (the fifth target block whose size is less than the preset size) may exist, which can affect update efficiency. Therefore, fragmented blocks can be merged with adjacent blocks (which may be difference blocks, first matching blocks, or second matching blocks). Since the data in the merged block has changed, it can be directly used as a difference block and needs to be downloaded completely from the cloud to ensure update accuracy and efficiency.

[0092] In an optional embodiment, if any sixth target block of the updated file is a feature block, the sixth target block is used as a difference block. The feature block is a block with low encoding cost, such as a block of all zeros or a block with a large amount of duplicate data. The bandwidth required for transmitting feature blocks is low, and it has virtually no impact on update efficiency.

[0093] In one optional embodiment, multiple difference blocks of the updated file are merged, and the merged blocks and the preset index information of the updated file are uploaded to the cloud.

[0094] It is understandable that this application achieves dynamic block segmentation through block matching. The blocks may be small and scattered, with varying lengths, which is detrimental to cloud storage and download performance. Therefore, multiple difference blocks of the updated file can be merged, and the merged block can be uploaded to the cloud. The terminal can then directly and quickly download the merged block from the cloud and then split it to obtain the individual difference blocks. This improves cloud storage utilization and file update efficiency. Please see Figure 6 In some embodiments, the second index information further includes updating the first cross-file index of the file, and the method further includes: Step 015: If the first cross-file index does not correspond to the first version of the current file, determine whether the second version of the file corresponding to the first cross-file index is the same as the file corresponding to the first version. The second version is the version between the first version and the third version of the updated file. Step 016, if yes, then generate a second cross-file index corresponding to the first version based on the first cross-file index. The second cross-file index is used to characterize the cross-file matching blocks of the corresponding block in other local files. Step 013 includes: Step 0132: Obtain the blocks in the current file that match the third index information, and the blocks in other local files that match the second cross-file index, and download the blocks in the update file that do not match the third index information and do not have the second cross-file index from the cloud, so as to update the current file.

[0095] Specifically, the current file may be undergoing a cross-version update. If the first cross-file index of the updated file is not based on the first version of the current file, then the first cross-file index cannot be reused across files.

[0096] Therefore, in order to achieve cross-file reuse as much as possible, if the first cross-file index does not correspond to the first version of the current file, we can first determine whether the second version of the file corresponding to the first cross-file index is the same as the current file. The second version is the version between the first version and the third version of the updated file.

[0097] If they are the same, it means that the current file has not changed from the first version to the second version. Therefore, the block position information in the second block of the first cross-file index can be reused, except that the file is different. Thus, a second cross-file index corresponding to the first version of the current file can be generated based on the first cross-file index. This allows the file to be adjusted to the corresponding file in the first version while reusing the block positions of the first cross-file index, making the second cross-file index used to represent the corresponding block's cross-file matching blocks in other local files.

[0098] At this point, the difference blocks that need to be downloaded from the cloud include blocks in the update file that do not match the third index information and do not have a second cross-file index, in order to achieve incremental download. Then, the matching blocks in the current file are reused using the third index information, and the cross-file matching blocks in other local files are reused using the second cross-file index, thus achieving incremental update of the current file.

[0099] All of the above technical solutions can be combined in any way to form optional embodiments of this application, and will not be described in detail here.

[0100] To facilitate better implementation of the file update method of this application, this application also provides a file update apparatus. Please refer to... Figure 7 , Figure 7 This is a schematic diagram of the structure of a file update device provided in an embodiment of this application. The file update device 200 can provide a graphical user interface through a terminal device. The graphical user interface includes at least a partial virtual scene and at least one virtual character. The file update device 200 may include: The first acquisition module 201 is used to acquire the first index information of the current file and the second index information of the corresponding updated file. The first index information includes the block indexes of multiple first blocks of the current file, and the second index information includes the block indexes of multiple second blocks of the updated file. The block indexes of the same first block and the same second block are the same. The comparison module 202 is used to compare the first index information and the second index information to determine that there is a third index information in the second index information that matches the first index information; The second acquisition module 203 is used to acquire the first block in the current file that matches the third index information and download the second block in the update file that does not match the third index information from the cloud to update the current file.

[0101] Each module or unit in the aforementioned file update device can be implemented entirely or partially through software, hardware, or a combination thereof. Each of these units can be embedded in or independent of the processor in the electronic device in hardware form, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to each of these units.

[0102] The file update device 200 can be integrated into a terminal or server that has storage and a processor and thus computing power, or the file update device 200 can be the terminal or server.

[0103] Optionally, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0104] Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may be a terminal or a server. Figure 8 As shown, the electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0105] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it executes various functions of the electronic device 300 and processes data, thereby performing overall processing of the electronic device 300.

[0106] Optional, such as Figure 8 As shown, the electronic device 300 also includes: a display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0107] The display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program. Optionally, the touch panel may include a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 301, and can receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel according to the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the display screen 303 can also be used as part of the input unit 306 to achieve input functions.

[0108] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.

[0109] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.

[0110] The input unit 306 can be used to receive input numbers, characters, or object feature information (such as fingerprints, irises, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.

[0111] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0112] although Figure 8 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.

[0113] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to an electronic device, and the computer program causes the electronic device to execute the corresponding process in the file update method of the embodiments of this application; for the sake of brevity, further details are omitted here.

[0114] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the corresponding process in the file update method of the embodiments of this application. For simplicity, further details are omitted here.

[0115] It should be understood that the processor in this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0116] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0117] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0118] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0119] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0120] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0122] In addition, the functional units in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0123] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer or a server) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0124] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A file update method, characterized in that, include: Obtain the first index information of the current file and the second index information of the corresponding updated file. The first index information includes the block indexes of multiple first blocks of the current file, and the second index information includes the block indexes of multiple second blocks of the updated file. The block indexes of the same first block and the same second block are the same. By comparing the first index information and the second index information, it is determined that there is a third index information in the second index information that matches the first index information; The system retrieves a first block in the current file that matches the third index information and downloads a second block in the updated file from the cloud that does not match the third index information, in order to update the current file.

2. The file update method according to claim 1, characterized in that, Also includes: Generate preset index information for the updated file. The preset index information includes block index and / or cross-file index. The block index is used to characterize the block information of the corresponding block in the updated file, and the cross-file index is used to characterize the blocks that the corresponding block matches across files in the historical version of the file.

3. The file update method according to claim 2, characterized in that, The second index information also includes cross-file indexes of each third block of the updated file. The step of obtaining the first block in the current file that matches the third index information and downloading the second block in the updated file that does not match the third index information from the cloud to update the current file includes: Obtain blocks in the current file that match the third index information, and blocks in other local files that match the cross-file index, and download blocks in the update file from the cloud that do not match the third index information and do not have the cross-file index, in order to update the current file.

4. The file update method according to claim 2, characterized in that, The block index includes first block location information and block verification information. The first block location information is used to characterize the position of the block in the file, and the block verification information is used for block matching. The cross-file index includes second block location information, which is used to characterize the position of the cross-file matched block in the file.

5. The file update method according to any one of claims 2-4, characterized in that, The step of generating preset index information for the updated file includes: The updated file is matched with the target file of the historical version to determine the block index corresponding to each first matching block of the updated file, and the target file includes at least the current file; The updated file is block-matched with other files in historical versions besides the target file to determine the cross-file index corresponding to each second matching block of the updated file.

6. The file update method according to claim 5, characterized in that, The step of performing block matching between the updated file and the target file of the historical version to determine the block index corresponding to each first matching block of the updated file, wherein the target file includes at least the current file, including: Obtain the binary stream of the updated file and the first block index of each block of the target file, wherein the first block index includes a first block check value and a corresponding second block check value; A scrolling hash calculation is performed on the binary stream based on a preset scrolling window to obtain the scrolling hash value corresponding to the binary stream within the scrolling window; The rolling hash value is matched with the first block check value to obtain a first matching result, the first matching result including whether there is a first block check value that matches the rolling hash value; If a first block check value that matches the rolling hash value exists, the binary stream is pre-divided based on the first target block corresponding to the matching first block check value in the target file to obtain a second target block of the same size as the first target block. Calculate the third block check value of the second target block, and match the third block check value with the second block check value of the first target block to obtain a second matching result. The second matching result includes whether the first target block and the second target block match. If the first target block and the second target block match, the second target block is taken as the first matching block, and a block index of the first matching block is generated based on the position of the first matching block in the updated file, the rolling hash value, and the third block check value.

7. The file update method according to claim 6, characterized in that, The step of performing block matching between the updated file and other files from historical versions, excluding the target file, to determine the cross-file indexes corresponding to each second matching block of the updated file includes: Obtain the second block index of each block of the historical versions of files other than the target file, the second block index including the fourth block check value and the fifth block check value; If there is no first block check value that matches the rolling hash value, or if the first target block and the second target block do not match, the rolling hash value is matched with the fourth block check value to obtain a third matching result. The third matching result includes whether there is a fourth block check value that matches the rolling hash value. If a fourth block check value that matches the rolling hash value exists, the binary stream is pre-divided based on the third target block corresponding to the matching fourth block check value in the other files to obtain a fourth target block of the same size as the third target block. Calculate the sixth check value of the fourth target block, and match the sixth check value with the fifth check value of the third target block to obtain a fourth matching result. The fourth matching result includes whether the third target block and the fourth target block match. If the third target block and the fourth target block match, the fourth target block is used as the second matching block, and a cross-file index of the second matching block is generated based on the position of the third target block in the other files.

8. The file update method according to claim 7, characterized in that, After obtaining the fourth matching result, the step of performing block matching between the updated file and other files in historical versions besides the target file to determine the cross-file index corresponding to each second matching block of the updated file further includes: Determine whether the file information of the third target block has changed; If so, then it is determined that the third target block and the fourth target block do not match.

9. The file update method according to claim 7 or 8, characterized in that, Also includes: If the rolling hash value does not match either the first block checksum or the fourth block checksum, the binary stream within the rolling window is determined to be differential data; or, if the rolling hash value matches the first block checksum and the first target block and the second target block do not match, the binary stream within the rolling window is determined to be differential data; or, if the rolling hash value matches the fourth block checksum and the third target block and the fourth target block do not match, the binary stream within the rolling window is determined to be differential data. If the number of bytes of consecutive difference data reaches a preset block size or the rolling hash value matches the target file or other files again, the consecutive difference data will be divided into a difference block.

10. The file update method according to any one of claims 2-9, characterized in that, Also includes: If the number of bytes in any fifth target block of the updated file is less than the preset number of bytes, the fifth target block and the adjacent blocks are merged to generate a difference block; and / or The multiple difference blocks in the updated file are merged, and the merged blocks and the preset index information of the updated file are uploaded to the cloud.

11. The file update method according to claim 5, characterized in that, The block indices of each block of all the other files form an index set. The step of performing block matching between the updated file and other files from historical versions (excluding the target file) to determine the cross-file indexes corresponding to each second matching block of the updated file includes: The updated file is block-matched with the index set to determine the cross-file index corresponding to each second matching block of the updated file.

12. The file update method according to claim 1, characterized in that, The second index information also includes the first cross-file index of the updated file, and the method further includes: If the first cross-file index does not correspond to the first version of the current file, it is determined whether the second version of the file corresponding to the first cross-file index is the same as the file corresponding to the first version, wherein the second version is a version between the first version and the third version of the updated file; If so, a second cross-file index corresponding to the first version is generated based on the first cross-file index. The second cross-file index is used to characterize the cross-file matching blocks of the corresponding block in other local files. The step of obtaining the first block in the current file that matches the third index information and downloading the second block in the updated file that does not match the third index information from the cloud to update the current file includes: Obtain blocks in the current file that match the third index information, and blocks in other local files that match the second cross-file index, and download blocks in the update file from the cloud that do not match the third index information and do not have the second cross-file index, in order to update the current file.

13. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing a computer program, and the processor executing the file update method according to any one of claims 1-12 by calling the computer program stored in the memory.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the file update method as described in any one of claims 1-12.