File synchronization, information generation method, device, computer equipment and storage medium

By receiving and comparing file index information, quickly searching and syncing update files, the problem of low file synchronization efficiency in the existing technology is solved, and efficient file synchronization is achieved.

CN114647630BActive Publication Date: 2025-05-13KINGDEE NOTES CLOUD TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210334800.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2025-05-13
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

After updating files, existing file synchronization technology requires scanning all files to find update files, resulting in high server resources consumption and low efficiency.

Method used

By receiving update file index information, obtaining original file index information, performing node comparison, obtaining different leaf node information, and writing it to a preset queue, and updating file synchronization is performed based on the information in the queue.

Benefits of technology

It realizes rapid search and update files, reduces server resource consumption, and improves file synchronization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647630B_ABST
    Figure CN114647630B_ABST
Patent Text Reader

Abstract

The present application relates to a file synchronization, information generation method, device, and computer equipment. The method includes: the server updates the original file index information in the server according to the update information to obtain the updated file index information. When the server detects the file synchronization request sent by the terminal, the updated file index information is sent to the terminal. The terminal receives the updated file index information sent by the server, compares the updated file index information with the original file index information in the terminal, and obtains the difference leaf node information. The original file is synchronized according to the file index and file status in the difference leaf node information. The use of this method can improve the efficiency of file synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, storage medium and computer program product for file synchronization and information generation. Background Art

[0002] With the development of the computer field, file synchronization technology has emerged. This technology is to synchronize the changed files to various devices when the files change, so as to maintain the integrity and unity of the files. However, existing file synchronization technologies, such as cloud storage tools, synchronize files stored in the cloud to the local computer. Every time a user updates a file on the cloud server, the cloud server scans all files to find the updated file, and then synchronizes the updated file to the local computer. This causes the server to take a long time to scan the files to find the updated file, and each scan consumes server resources, resulting in low file synchronization efficiency. Summary of the invention

[0003] Based on this, it is necessary to provide a file synchronization, information generation method, device, computer equipment, computer-readable storage medium and computer program product that can quickly find updated files and improve file synchronization efficiency in response to the above technical problems.

[0004] In a first aspect, the present application provides a file synchronization method. The method comprises:

[0005] receiving updated file index information, where the updated file index information is obtained by updating the original file index information according to the updated information, and the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0006] Obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0007] Write the update file index and update file status in the difference leaf node information into the preset difference leaf node information queue;

[0008] The updated file is synchronized based on the updated file index and the updated file status in the preset difference leaf node information queue, and the original file index information is replaced with the updated file index information.

[0009] In a second aspect, the present application provides an information generation method. The method comprises:

[0010] Obtaining an update instruction, the update instruction carries an update file identifier and update operation information;

[0011] Generate an update file index and an update file status based on the update file identifier and the update operation information;

[0012] Obtaining an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0013] Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0014] Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status;

[0015] When a file synchronization request is received from the update end, the updated file index information is returned to the update end, so that the update end compares the updated file index information with the original file index information in the terminal to obtain the difference leaf node information, and uses the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0016] In a third aspect, the present application also provides a file synchronization device. The device comprises:

[0017] A receiving module, used for receiving updated file index information, the updated file index information is obtained by updating the original file index information according to the updated information, the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated by using the original file index and the original file status corresponding to each original file;

[0018] A comparison module is used to obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0019] A writing module, used to write the update file index and update file status in the difference leaf node information into a preset difference leaf node information queue;

[0020] A synchronization module, used to synchronize updated files based on the updated file index and updated file status in the preset difference leaf node information queue, and replace the original file index information with the updated file index information;

[0021] In a fourth aspect, the present application also provides an information generating device. The device comprises:

[0022] An instruction acquisition module is used to acquire an update instruction, where the update instruction carries an update file identifier and update operation information;

[0023] A generation module, used for generating an update file index and an update file status based on the update file identifier and the update operation information;

[0024] An index acquisition module is used to acquire an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0025] A calculation module, used for performing an update root node index calculation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0026] An index information generating module, used for generating updated file index information based on original file index information, updated root node index, updated file index and updated file status;

[0027] The sending module is used to return the updated file index information to the update end when a file synchronization request is received from the update end, so that the update end can compare the updated file index information with the original file index information in the update end to obtain the difference leaf node information, and use the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0028] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0029] receiving updated file index information, where the updated file index information is obtained by updating the original file index information according to the updated information, and the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0030] Obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0031] Write the update file index and update file status in the difference leaf node information into the preset difference leaf node information queue;

[0032] The updated file is synchronized based on the updated file index and the updated file status in the preset difference leaf node information queue, and the original file index information is replaced with the updated file index information.

[0033] In a sixth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0034] Obtaining an update instruction, the update instruction carries an update file identifier and update operation information;

[0035] Generate an update file index and an update file status based on the update file identifier and the update operation information;

[0036] Obtaining an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0037] Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0038] Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status;

[0039] When a file synchronization request is received from the update end, the updated file index information is returned to the update end, so that the update end compares the updated file index information with the original file index information in the terminal to obtain the difference leaf node information, and uses the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0040] In a seventh aspect, the present application further 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 following steps are implemented:

[0041] receiving updated file index information, where the updated file index information is obtained by updating the original file index information according to the updated information, and the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0042] Obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0043] Write the update file index and update file status in the difference leaf node information into the preset difference leaf node information queue;

[0044] The updated file is synchronized based on the updated file index and the updated file status in the preset difference leaf node information queue, and the original file index information is replaced with the updated file index information.

[0045] In an eighth aspect, the present application further 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 following steps are implemented:

[0046] Obtaining an update instruction, the update instruction carries an update file identifier and update operation information;

[0047] Generate an update file index and an update file status based on the update file identifier and the update operation information;

[0048] Obtaining an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0049] Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0050] Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status;

[0051] When a file synchronization request is received from the update end, the updated file index information is returned to the update end, so that the update end compares the updated file index information with the original file index information in the terminal to obtain the difference leaf node information, and uses the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0052] In a ninth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0053] receiving updated file index information, where the updated file index information is obtained by updating the original file index information according to the updated information, and the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0054] Obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0055] Write the update file index and update file status in the difference leaf node information into the preset difference leaf node information queue;

[0056] The updated file is synchronized based on the updated file index and the updated file status in the preset difference leaf node information queue, and the original file index information is replaced with the updated file index information.

[0057] In a tenth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0058] Obtaining an update instruction, the update instruction carries an update file identifier and update operation information;

[0059] Generate an update file index and an update file status based on the update file identifier and the update operation information;

[0060] Obtaining an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0061] Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0062] Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status;

[0063] When a file synchronization request is received from the update end, the updated file index information is returned to the update end, so that the terminal compares the updated file index information with the original file index information in the update end to obtain the difference leaf node information, and uses the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0064] In the above-mentioned file synchronization method, device, computer equipment, storage medium and computer program product, the terminal compares the updated file index information with the original file index information in the update terminal, and the update terminal can quickly find the difference leaf node information according to the difference between the nodes of the updated file index information and the original file index information. Then the terminal writes the updated file index and file status in the difference leaf node information into the preset difference leaf node information queue, so that the update terminal can synchronize the updated file with the original file in the update terminal according to the updated file index and file status in the preset difference leaf node information queue, thereby improving the efficiency of file synchronization.

[0065] The above-mentioned information generation method, apparatus, computer equipment, storage medium and computer program product, when the server obtains the update instruction, generates the update file index and update file status according to the update file identifier and update operation information carried in the update instruction. The server performs the update root node index operation on the update file index and update file status and the original root node index in the original file index information in the server, and generates the update file index information, which can improve the generation efficiency of the update file index information. Then, after receiving the update request from the terminal, the server sends the update file index information to the terminal, thereby improving the efficiency of file synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 It is an application environment diagram of a file synchronization and information generation method in an embodiment;

[0067] Figure 2 A schematic diagram of a process flow of a file synchronization method in an embodiment;

[0068] Figure 3 A schematic diagram of a process flow of a node comparison step in an embodiment;

[0069] Figure 4 is a flow chart of an information generating method in one embodiment;

[0070] Figure 5 is a flowchart of a file synchronization method in another embodiment;

[0071] Figure 6 A schematic diagram of generating original file index information in one embodiment;

[0072] Figure 7 A schematic diagram of generating update file index information in one embodiment;

[0073] Figure 8 A schematic diagram of generating update file index information in another embodiment;

[0074] Fig. 9 A schematic diagram of generating update file index information in another embodiment;

[0075] Fig.10 A schematic diagram of a process for retrieving difference leaf node information in one embodiment;

[0076] Fig.11 is a structural block diagram of a file synchronization device in an embodiment;

[0077] Fig.12 is a structural block diagram of an information generating device in one embodiment;

[0078] Fig.13is an internal structure diagram of a computer device in one embodiment;

[0079] Fig.14 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0080] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0081] The file synchronization and information generation method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server data storage system can store the data that the server 104 needs to process. The server data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server data storage system may include a file synchronization tool server. The local data storage system may store the data that the terminal 102 needs to process, and the local data storage system may be a local file system, a local object storage system, etc. The local data storage system may include a file synchronization tool client. Terminal 102 receives updated file index information sent by server 104. The updated file index information is obtained after server 104 updates the original file index information according to the updated information. The updated information includes an updated file index and an updated file status. The original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file. Terminal 102 obtains the original file index information, performs node comparison between the original file index information and the updated file index information, and obtains the difference leaf node information corresponding to the updated file index information. Terminal 102 writes the updated file index and the file status in the difference leaf node information into a preset difference leaf node information queue. Terminal 102 synchronizes the updated file based on the updated file index and the updated file status in the preset difference leaf node information queue, and replaces the original file index information with the updated file index information. Server 104 obtains an update instruction, which carries an update file identifier and update operation information; server 104 generates an update file index and an update file status based on the update file identifier and the update operation information; server 104 obtains the original root node index in the original file index information, and the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file; server 104 performs an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index; server 104 generates an update file index information based on the original file index information, the update root node index, the update file index and the update file status; when server 104 receives a file synchronization request sent by terminal 102, server 104 sends the update file index information to terminal 102, so that terminal 102 compares the update file index information with the original file index information in the terminal, obtains differential leaf node information, and uses the update file index and the update file status in the differential leaf node information to synchronize the update files. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc.The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or may be a cloud server.

[0082] In one embodiment, Figure 2 As shown, a file synchronization method is provided, which is applied to Figure 1 The terminal in the example is used for explanation. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the following steps are included:

[0083] Step 202, receiving updated file index information, the updated file index information is obtained by updating the original file index information according to the updated information, the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file.

[0084] Among them, the updated file index information refers to the tree structure after the original file index information is updated. The file index is the information that can obtain the corresponding file. The file status is the information used to indicate the processing method of the file, including the operation of adding a new file, deleting a file, and updating the file content. The original file refers to the original data stored in the form of a file, which can be updated.

[0085] Specifically, the terminal sends a file synchronization request to the server, and then obtains updated file index information returned by the server according to the file synchronization request.

[0086] Step 204, obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information.

[0087] The difference leaf node information refers to the node information corresponding to the leaf node with differences between the original file index information and the updated file index information. The leaf node refers to the node without branches. The original file index information refers to the index information corresponding to the original file.

[0088] Specifically, the terminal obtains the original file index information in the local storage space, and then performs consistency comparison between the nodes in the original file index information and the nodes in the updated file index information. The terminal searches for difference nodes from the updated file index information according to the comparison result, and then searches for difference leaf nodes according to the difference nodes, and obtains the node information corresponding to the difference leaf nodes.

[0089] Step 206, write the updated file index and file status in the differential leaf node information into the preset differential leaf node information queue.

[0090] The preset difference leaf node information queue is a queue set up to record updated file indexes and file statuses. The preset difference leaf node information queue can record multiple different updated file indexes and file statuses.

[0091] Specifically, the terminal can generate a preset difference leaf node information queue before performing node comparison between the original file index information and the updated file index information, or can generate a preset difference leaf node information queue after the node comparison between the original file index information and the updated file index information is completed. For example, when the terminal detects that there is difference leaf node information in the updated file index information, it generates a preset difference leaf node information queue, and writes the updated file index and file status in the difference leaf node information into the preset difference leaf node information queue.

[0092] Step 208: perform update file synchronization based on the update file index and update file status in the preset difference leaf node information queue, and replace the original file index information with the update file index information.

[0093] Specifically, the terminal obtains the corresponding file according to the updated file index in the preset difference leaf node information queue, and then updates the file according to the updated file status to complete the updated file synchronization, and then replaces the original file index information with the updated file index information.

[0094] In a specific embodiment, the terminal checks the update file index and update file status in the preset difference leaf node information queue. When the terminal detects that the update file status is a new file operation, the terminal searches and obtains the corresponding new file from the server data storage system according to the update file index, and saves the new file in the local storage system; when the terminal detects that the update file status is a file deletion operation, the terminal searches and deletes the corresponding deletion file in the local storage system according to the update file index; when the terminal detects that the update file status is a file content update operation, the terminal searches and obtains the corresponding update file from the server data storage system according to the update file index, and then searches the local data storage system for the corresponding original file according to the original file index corresponding to the updated original file in the update file status, and replaces the original file with the update file. The terminal can delete the corresponding original file after finding it in the local data storage system, and then save the update file to the local data storage system. The terminal can also directly overwrite the updated original file with the acquired update file in the local data storage system.

[0095] In the above file synchronization method, the terminal compares the updated file index information sent by the server with the original file index information in the terminal, and the terminal can quickly find the difference leaf node information according to the difference in nodes between the updated file index information and the original file index information. Then the terminal writes the updated file index and file status in the difference leaf node information into a preset difference leaf node information queue, so that the terminal can synchronize the updated file with the original file in the terminal according to the updated file index and file status in the preset difference leaf node information queue, thereby improving the efficiency of file synchronization.

[0096] In one embodiment, Figure 3 As shown, step 204, the original file index information is compared with the updated file index information to obtain the difference leaf node information corresponding to the updated file index information, including:

[0097] Step 302, obtaining the original root node index in the original file index information and the updated root node index in the updated file index information;

[0098] Step 304, comparing the original root node index and the updated root node index, when the original root node index is not the same as the updated root node index, and the updated root node index is non-leaf node information, dividing the updated file index information into first sub-update file index information and second sub-update file index information based on the updated root node index;

[0099] Step 306: when the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is leaf node information, the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information;

[0100] Among them, the root node index refers to the index corresponding to the root node in the tree structure of the file index information. Non-leaf node information refers to the node information corresponding to the non-leaf node. Non-leaf nodes have branch nodes. The first sub-update file index information refers to the left branch tree structure under the root node in the tree structure of the update file index information. The second sub-update file index information refers to the right branch tree structure under the root node in the tree structure of the update file index information.

[0101] Specifically, the terminal obtains the original root node index in the original file index information and the updated root node index in the updated file index information, and compares the original root node index and the updated root node index for consistency. When the original root node index is inconsistent with the updated root node index, it is determined whether the updated root node index is leaf node information. When the updated root node index is non-leaf node information, the partial tree structure other than the root node in the tree structure of the updated file index information is divided into a left branch tree structure and a right branch tree structure, and the left branch tree structure and the right branch tree structure are used as the first sub-update file index information and the second sub-update file index information, respectively.

[0102] Then the terminal obtains the root node index in the first sub-update file index information. When the root node index in the first sub-update file index information is the same as the original root node index, it means that the first sub-update file index information is the original file index information. At this time, there is no need to process the first sub-update file index information. Then when the terminal detects that the second sub-update file index information is a single-node tree structure, it means that the second sub-update file index information is only composed of leaf node information, and the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information. The original root node index and the updated root node index can be hash values. The original file index information can be a Merkle tree generated by the original file hash value and the original file status. The updated file index information can be a Merkle tree generated by the original file index information, the updated file hash value and the updated file status.

[0103] In this embodiment, when the original root node index and the updated root node index are inconsistent, it indicates that there is differential leaf node information in the updated file index information. Then the updated file index information is divided into the first sub-update file index information and the second sub-update file index information. When the root node index in the first sub-update file index information is the same as the original root node index, it indicates that there is no differential leaf node information in the first sub-update file index information. Therefore, there is no need to search for the differential leaf node difference in the first sub-update file index information, which can save terminal resources. And when the terminal detects that the second sub-update file index information is the leaf node information, it indicates that the second sub-update file index information is the differential leaf node information, and the differential leaf node information can be quickly determined, so that the terminal can synchronize the update file according to the differential leaf node information, thereby improving the efficiency of file synchronization.

[0104] In one embodiment, the method further comprises:

[0105] When the root node index in the first sub-update file index information is not the same as the original root node index, the first sub-update file index information is used as the update file index information, and the step of comparing the original root node index with the update root node index is returned to be executed until the original root node index is the same as the update root node index, thereby obtaining each second sub-update file index information;

[0106] When each second sub-update file index information is leaf node information, each second sub-update file index information is used as the difference leaf node information corresponding to the update file index information.

[0107] Specifically, after executing the step of dividing the update file index information into the first sub-update file index information and the second sub-update file index information based on the update root node index, the terminal uses the first sub-update file index information as the update file index information, and returns to the step of comparing the original root node index and the update root node index until the original root node index is the same as the update root node index, and each second sub-update file index information is obtained. In a specific embodiment, when the root node index in the first sub-update file index information is different from the original root node index, and the root node index in the first sub-update file index information is non-leaf node information, the first sub-update file index information is divided as the update file index information to obtain the first sub-update file index information and the second sub-update file index information of different structures. Then, the root node index in the first sub-update file index information of different structures is compared with the original root node index for consistency until the root node index in the first sub-update file index information of different structures is the same as the original root node index. At this time, each second sub-update file index information is obtained.

[0108] When the terminal detects that each second sub-update file index information is leaf node information, each second sub-update file index information is used as the difference leaf node information corresponding to the update file index information. Leaf node information and non-leaf node information may exist simultaneously in each second sub-update file index information. When the terminal detects that part of the second sub-update file index information in each second sub-update file index information is leaf node information, part of the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information. Then, when the terminal detects that another part of the second sub-update file index information in each second sub-update file index information is non-leaf node information, the sub-leaf node information in the other part of the second sub-update file index information is obtained, and the sub-leaf node information is used as the difference leaf node information.

[0109] In this embodiment, when the root node index in the first sub-update file index information is not the same as the update root node index, it indicates that there is also differential leaf node information in the first sub-update file index information. Then, the first sub-update file index information is used as the update file index information to continue to be divided into first sub-update file index information and second sub-update file index information of different structures, until the update file index information is divided into a partial tree structure identical to the original file index information and each second sub-update file index information, each second sub-update file index information contains differential leaf nodes. Thus, all differential leaf node information can be found, so that the terminal can synchronize the update file according to all the differential leaf node information found, thereby improving the efficiency of file synchronization.

[0110] In one embodiment, the method further comprises:

[0111] When the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is non-leaf node information, obtain the sub-leaf node information in the second sub-update file index information and use the sub-leaf node information as the difference leaf node information.

[0112] The sub-leaf node information refers to the node information corresponding to the leaf node in the second sub-update file index information.

[0113] Specifically, when the terminal detects that the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is non-leaf node information, it searches for each sub-leaf node in the second sub-update file index information and obtains the node information corresponding to each sub-leaf node. The terminal uses the node information corresponding to each sub-leaf node as the difference leaf node information.

[0114] In this embodiment, when the second sub-update file index information is non-leaf node information, it indicates that the second sub-update file index information is a tree structure generated by each difference leaf node, which can meet the needs of the terminal to synchronize the update files of multiple files updated by the user, thereby improving the efficiency of file synchronization.

[0115] In one embodiment, Figure 4 As shown, a method for generating information is provided, which is applied to Figure 1 The server in the example is used for explanation. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the following steps are included:

[0116] Step 402: Acquire an update instruction, where the update instruction carries an update file identifier and update operation information.

[0117] The update instruction refers to the instruction generated after the user performs an update operation in the server. The update file identifier refers to the identifier of the file that the user performs an update operation on, which is used by the server to find the identifier information of the update file. The update operation information refers to the update operation method performed by the user on the file, including the operation of adding a new file, deleting a file, and updating the file content.

[0118] Specifically, the server receives an update instruction in response to a user's update operation on a file in the server.

[0119] Step 404: Generate an update file index and an update file status based on the update file identifier and the update operation information.

[0120] Specifically, the server searches for the update file in the data storage system according to the update file identifier in the update instruction, and performs an index operation on the update file to obtain an update file index. The server then generates an update file status corresponding to the update file index according to the update operation information, including but not limited to newly added files, deleted files, and updated files. The server then associates and saves the update file index, the update file status, and the update file.

[0121] Step 406, obtaining the original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file.

[0122] Step 408: Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index.

[0123] The root node update operation refers to the operation process of calculating the index corresponding to the root node in the tree structure.

[0124] Specifically, the server obtains the original file index information in the data storage system, and obtains the original root node index from the original file index information. The server may perform an update root node index operation on the new file index, the updated file status, and the original root node index to obtain an updated root node index. The server may also first perform a root node index operation on the updated file index and the updated file status to obtain a corresponding root node index operation result, and then perform a root node index operation on the root node index operation result and the original root node index to obtain an updated root node index.

[0125] Step 410: Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status.

[0126] Step 412, when a file synchronization request is received from the update end, the updated file index information is returned to the update end, so that the update end compares the updated file index information with the original file index information in the update end to obtain the difference leaf node information, and uses the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0127] The update end is the device end that needs to perform file update, which can be a server or a terminal.

[0128] Specifically, the server can use the update file index and the update file status as the leaf node information of the update file index information, and then the server establishes a connection relationship with the original root node index and the leaf node information in the original file index information according to the update root node index, and generates the update file index information. When the server detects the file synchronization request sent by the terminal, the update file index information is sent to the terminal. The update file index can also be sent to the server when the file synchronization request sent by the server is detected. In the above file synchronization method, when the server obtains the update instruction, it generates the update file index and the update file status according to the update file identifier and update operation information carried by the update instruction. The server performs an update root node index operation on the update file index and the update file status with the original root node index in the original file index information in the server, and generates the update file index information, which can improve the generation efficiency of the update file index information. Then, after receiving the update request from the terminal, the server sends the update file index information to the terminal, thereby improving the efficiency of file synchronization.

[0129] It is understandable that the file synchronization method and information generation method can realize that the server generates an update file and the terminal synchronously updates the update file of the server; it can also realize that the terminal generates an update file and the server synchronously updates the update file of the terminal.

[0130] In one embodiment, Figure 5 As shown, the update instruction carries at least two update file identifiers and at least two update operation information, and the method further includes:

[0131] Step 502, generating at least two update file indexes and at least two update file states based on at least two update files in at least two update instructions and at least two update operation information;

[0132] Step 504, performing node index operations based on at least two update file indexes and at least two update file states to obtain at least two child node indexes;

[0133] Step 506, generating sub-update file index information based on at least two sub-node indexes;

[0134] Step 508, performing a root node index operation on the root node index in the sub-update file index information and the original root node index to obtain a target update root node index, and generating target update file index information based on the target update root node index, the original file index information and the sub-update file index information.

[0135] Among them, the node index operation is the operation process of calculating the index corresponding to each node in the tree structure. The child node index refers to the index corresponding to each node in the tree structure. The sub-update file index information refers to the tree structure generated using at least two child node indexes. The target update file index information refers to the tree structure generated by the target update root node index, the original file index information and the child update file index information. The target update root node index is the root node index in the target update file index information.

[0136] Specifically, the server responds to the user's update operation on at least two files and receives an update instruction. The server performs index operations on at least two update files in the update instruction to obtain at least two sub-node indexes, and then establishes connection relationships between the at least two sub-node indexes to generate sub-update file index information. The root node index in the sub-update file index information is subjected to a root node index operation with the original root node index to obtain a target update root node index; then the server establishes association relationships with the original root node index in the original file index information and the root node index in the sub-update file index information according to the target update root node index to generate the target update file index information.

[0137] In a specific embodiment, the index operation, the node index operation and the root node index operation may be hash operations. The update file index may be a hash value obtained after performing a hash operation on the update file. The child node index may be a hash value corresponding to each node in the child update file index information. The server may use a Merkle tree to generate the child update file index information and the target update file index information.

[0138] In a specific embodiment, Figure 6 As shown, a schematic diagram of generating original file index information is provided;

[0139] The leaf node information of the original file index information is {Hash 1, add (new operation)}, {Hash 2, add}, {Hash 3, add}, {Hash 4, add}. Hash 1, Hash 2, Hash 3 and Hash 4 are obtained by hashing the original files as document 1, document 2, document 3 and document 4 respectively. Hash 12 is a discrete value obtained by hashing the leaf node information as {Hash 1, add} and {Hash 2, add}, and Hash 34 is a discrete value obtained by hashing the leaf node information as {Hash 3, add} and {Hash 4, add}. Hash 1234 is a discrete value obtained by hashing the discrete values ​​Hash 12 and Hash 34. Hash 1234 is the original root node index of the original file index information, and the original file index information is generated according to Hash 1234, Hash 12, Hash 34 and the leaf node information as {Hash 1, add}, {Hash 2, add}, {Hash 3, add}, {Hash 4, add}.

[0140] In a specific embodiment, Figure 7 As shown, a schematic diagram of generating update file index information is provided;

[0141] When the server detects that the update operation information is a new file addition operation, the updated file status generated according to the new file addition operation is: add, and then the corresponding new file is found as document 5 according to the updated file identifier and document 5 is hashed, and the generated updated file index is hash 5. The server then uses hash 5 and add as a new leaf node information {hash 5, add}. The server obtains the original root node index in the original file index information as hash 1234. The server then performs a hash operation on the original root node index as hash 1234 and the new leaf node information {hash 5, add} to obtain hash 12345. Hash 12345, the original file index information and {hash 5, add} are used to generate updated file index information, and hash 12345 is the updated root node index of the updated file index information.

[0142] In a specific embodiment, Figure 8 As shown, another schematic diagram of generating update file index information is provided;

[0143] When the server detects that the update operation information is a file deletion operation, the update file status generated according to the file deletion operation is: delete (deletion operation), and then the corresponding deletion file is found as document 4 according to the update file identifier and document 4 is hashed, and the generated update file index is hash 4. After generating the update file index hash 4, the server deletes the corresponding file as document 4 in the data storage system. The server then uses hash 4 and delete as a new leaf node information {hash 4, delete}, and hashes the new leaf node information {hash 4, delete} with the original root node index hash 1234 in the original file index information to obtain hash 12345. The server generates the update file index information using hash 12345, the original file index information, and {hash 5, add}.

[0144] In a specific embodiment, Fig. 9 As shown, another schematic diagram of generating update file index information is provided;

[0145] When the server detects that the update operation information is a file content update operation, and detects that the content of document 4 is updated to generate document 5, the corresponding update file state is generated according to the file content update operation and the original file index (hash 4) corresponding to the updated original file: {replace (file content replacement operation), hash 4}, and then the server searches for the corresponding update file according to the update file identifier as document 5, which is obtained after the content of document 4 is updated. Document 5 is hashed to obtain hash 5. The server uses hash 5 and {replace, hash 4} as a new leaf node information {hash 5, {replace, hash 4}}, and hashes the new leaf node information {hash 5, {replace, hash 4}} with the original root node index hash 1234 in the original file index information to obtain hash 12345. The server combines hash 12345, the original file index information and {hash 5, {replace, hash 4}} into updated file index information.

[0146] In this embodiment, the server generates target update file index information through the user's operations on multiple update files, so that the terminal can synchronize the update files of multiple update files according to the target update file index information, thereby meeting the user's file synchronization requirements for multiple update files and improving the efficiency of file synchronization and user experience.

[0147] In one embodiment, step 402, before detecting the update instruction, further includes:

[0148] Obtain each original file, and generate a corresponding original file status based on each original file;

[0149] Perform node indexing operations on each original file and the original file status corresponding to each original file to obtain original file index information;

[0150] The original file index information is sent to the terminal, so that the terminal can obtain each original file according to the original file index information.

[0151] The original file refers to the file that the user stores in the data storage system for the first time.

[0152] Specifically, the server obtains each original file, generates a corresponding original file status according to each original file, and the original file status corresponding to each original file is a newly added file. The server performs an index operation on each original file to obtain an original file index corresponding to each original file. Then the server performs a node index operation on the original file index corresponding to each original file and the original file status to obtain an index corresponding to each node. The original file index information is generated according to the index corresponding to each node.

[0153] When the server detects the file synchronization request sent by the terminal, it sends the original file index information to the terminal. The file synchronization request sent by the terminal can be a full backup request, which is used for the terminal to receive the original file index information without node comparison, and then the terminal can obtain all original files according to the original file index information.

[0154] In this embodiment, the server generates original file index information according to the original file, and sends the original file index information to the terminal, so that the terminal can accurately obtain the original file according to the original index information, thereby improving the accuracy of file synchronization.

[0155] In a specific embodiment, Fig.10 As shown, a schematic diagram of a process for retrieving differential leaf node information is provided; the terminal obtains the updated file index information sent by the server, and then obtains the original file index information from the local data storage system. The terminal compares the updated root node index in the updated file index information with the original root node index in the original file index information for root node consistency. When the updated root node index is the same as the original root node index, it indicates that the updated file index information is the same as the original file index information.

[0156] When the updated root node index is different from the original root node index, determine whether the updated root node index is leaf node information. When the updated root node index is leaf node information, it means that the updated file index information is a single-node tree structure generated by only leaf node information, and the updated file index information is used as differential leaf node information and recorded in the differential leaf node information queue. When the updated root node index is non-leaf node information, the updated file index information is divided into first updated file index information and second updated file index information according to the updated root node index. Then enter the loop branches corresponding to the first updated file index information and the second updated file index information respectively.

[0157] The loop branch corresponding to the first updated file index information includes: taking the first updated file index information as the first new updated file index information, and returning to the step of comparing the updated root node index in the updated file index information with the original root node index in the original file index information for consistency until the updated root node index is the same as the original root node index.

[0158] The loop branch corresponding to the second update file index information includes: judging whether the second update file index information is leaf node information, and when the second update file index information is leaf node information, taking the second update file index information as differential leaf node information and recording it in the differential leaf node information queue. When the second update file index information is non-leaf node information, traverse each subtree in the second update file index information, judge whether the node index in each subtree is leaf node information in turn, and when the node index in each subtree is leaf node information, take the leaf node information in each subtree as differential leaf node information and record it in the differential leaf node information queue. When the node information in each subtree is non-leaf node information, take each subtree as the second update file index information, return to the step of traversing each subtree in the second update file index information, and judge whether the node index in each subtree is leaf node information in turn, until the node information in each subtree is leaf node information, the loop ends.

[0159] In another specific embodiment, Fig.10 As shown, the server obtains a single original file, performs a hash operation based on the single original file, and obtains a single original file index. Then, a single original file status is generated based on the single original file. The single original file index and the single original file status are used as single leaf node information, and the original file index information is generated based on the single leaf node information. When the server detects a full backup request sent by the terminal, the original file index information is sent to the terminal as updated file index information.

[0160] After the terminal receives the updated file index information, it compares the updated file index information with the original file index information for root node consistency. If the original file index information is empty at this time, the updated root node index is different from the original root node index, and the updated root node index is the leaf node information. The updated file index information is used as the difference leaf node information and recorded in the difference leaf node information queue. Then, according to the updated file index information in the difference leaf node information queue, the full file is obtained from the server and saved.

[0161] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0162] Based on the same inventive concept, the embodiment of the present application also provides a file synchronization device and an information generation device for implementing the file synchronization and information generation methods involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more file synchronization devices and information generation device embodiments provided below can refer to the limitations of the file synchronization and information generation methods above, and will not be repeated here.

[0163] In one embodiment, Fig.11 As shown, a file synchronization device 1100 is provided, comprising: a receiving module 1102, a comparison module 1104, a writing module 1106 and a synchronization module 1108, wherein:

[0164] The receiving module 1102 is used to receive updated file index information, where the updated file index information is obtained by updating the original file index information according to the updated information, and the updated information includes the updated file index and the updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0165] The comparison module 1104 is used to obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain the difference leaf node information corresponding to the updated file index information;

[0166] A writing module 1106, used to write the update file index and the update file status in the difference leaf node information into a preset difference leaf node information queue;

[0167] The synchronization module 1108 is used to synchronize the updated files based on the updated file index and the updated file status in the preset difference leaf node information queue, and replace the original file index information with the updated file index information.

[0168] In one embodiment, the comparison module 1104 further includes:

[0169] A difference leaf node information acquisition unit, used to acquire an original root node index in the original file index information and an updated root node index in the updated file index information;

[0170] Compare the original root node index and the updated root node index, and when the original root node index is not the same as the updated root node index, and the updated root node index is non-leaf node information, divide the updated file index information into first sub-update file index information and second sub-update file index information based on the updated root node index;

[0171] When the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is leaf node information, the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information.

[0172] In one embodiment, the file device 1100 further includes:

[0173] A plurality of difference leaf node information acquisition modules, used for, when the root node index in the first sub-update file index information is not the same as the original root node index, using the first sub-update file index information as the update file index information, and returning to the step of comparing the original root node index with the update root node index until the original root node index is the same as the update root node index, to obtain each second sub-update file index information;

[0174] When each second sub-update file index information is leaf node information, each second sub-update file index information is used as the difference leaf node information corresponding to the update file index information.

[0175] In one embodiment, the file device 1100 further includes:

[0176] The difference leaf node information determination module is used to obtain the sub-leaf node information in the second sub-update file index information when the root node index in the first sub-update file index information is the same as the original root node index and the second sub-update file index information is non-leaf node information, and use the sub-leaf node information as the difference leaf node information.

[0177] In one embodiment, Fig.12 As shown, an information generating device 1200 is provided, comprising: an acquisition instruction module 1202, a generation module 1204, an acquisition index module 1206, a calculation module 1208, an index information generating module 1210 and a sending module 1212, wherein:

[0178] The instruction acquisition module 1202 is used to acquire an update instruction, where the update instruction carries an update file identifier and update operation information;

[0179] A generating module 1204, configured to generate an update file index and an update file status based on the update file identifier and the update operation information;

[0180] An index acquisition module 1206 is used to acquire an original root node index in the original file index information, where the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file;

[0181] A calculation module 1208, configured to perform an update root node index calculation based on the update file index, the update file status and the original root node index to obtain an update root node index;

[0182] An index information generating module 1210, configured to generate updated file index information based on original file index information, updated root node index, updated file index and updated file status;

[0183] The sending module 1212 is used to return the updated file index information to the update end when a file synchronization request is received from the update end, so that the update end can perform a node comparison between the updated file index information and the original file index information in the update end to obtain the difference leaf node information, and use the updated file index and updated file status in the difference leaf node information to synchronize the updated file.

[0184] In one embodiment, the information generating device 1200 further includes:

[0185] A target update file index information generation module, used to generate at least two update file indexes and at least two update file states based on at least two update files and at least two update operation information;

[0186] Perform node index operations based on at least two update files and at least two update file indexes to obtain at least two child node indexes;

[0187] Generate child update file index information based on at least two child node indexes;

[0188] The root node index in the sub-update file index information is subjected to a root node index operation with the original root node index to obtain a target update root node index, and the target update file index information is generated based on the target root node index, the original file index information and the sub-update file index information.

[0189] In one embodiment, the information generating device 1200 further includes:

[0190] The original file index information generation module is used to obtain each original file and generate a corresponding original file status based on each original file;

[0191] Perform node indexing operations on each original file and the original file status corresponding to each original file to obtain original file index information;

[0192] The original file index information is sent to the terminal, so that the terminal can obtain each original file according to the original file index information.

[0193] Each module in the above-mentioned file synchronization device and information generation device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module above.

[0194] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store original files, original file index information, updated files, and updated file index information. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an information generation method or a file synchronization method is implemented.

[0195] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a file synchronization method or a file synchronization method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0196] Those skilled in the art will understand that Figure 13-14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0197] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0198] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0199] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0200] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0201] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0202] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0203] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A file synchronization method, characterized in that: The method comprises: receiving updated file index information, wherein the updated file index information is obtained by updating the original file index information according to the updated information, wherein the updated information includes an updated file index and an updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file; Obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain differential leaf node information corresponding to the updated file index information; Writing the update file index and the update file status in the difference leaf node information into a preset difference leaf node information queue; Update file synchronization is performed based on the update file index and the update file status in the preset difference leaf node information queue, and the original file index information is replaced with the update file index information; the update file index and the update file status are generated based on the update file identifier and update operation information carried by the update instruction; the update instruction is also used to generate at least two update file indexes and at least two update file statuses based on the at least two update file identifiers and the at least two update operation information when the update instruction carries at least two update file identifiers and at least two update operation information, perform node index operations based on the at least two update file indexes and the at least two update file statuses respectively to obtain at least two child node indexes, generate child update file index information based on the at least two child node indexes, perform root node index operations on the root node index in the child update file index information and the original root node index to obtain a target update root node index, and generate target update file index information based on the target update root node index, the original file index information and the child update file index information.

2. The method according to claim 1, characterized in that The node comparison between the original file index information and the updated file index information to obtain the difference leaf node information corresponding to the updated file index information includes: Obtaining an original root node index in the original file index information and an updated root node index in the updated file index information; Comparing the original root node index with the updated root node index, when the original root node index is not the same as the updated root node index, and the updated root node index is non-leaf node information, dividing the update file index information into first sub-update file index information and second sub-update file index information based on the updated root node index; When the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is leaf node information, the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information.

3. The method according to claim 2, characterized in that The method further comprises: When the root node index in the first sub-update file index information is not the same as the original root node index, the first sub-update file index information is used as the update file index information, and the step of comparing the original root node index with the update root node index is returned to be executed until the original root node index is the same as the update root node index, thereby obtaining each second sub-update file index information; When each of the second sub-update file index information is leaf node information, each of the second sub-update file index information is used as the difference leaf node information corresponding to the update file index information.

4. The method according to claim 2, characterized in that: The method further comprises: When the root node index in the first sub-update file index information is the same as the original root node index, and the second sub-update file index information is non-leaf node information, obtain the sub-leaf node information in the second sub-update file index information, and use the sub-leaf node information as the difference node information.

5. A method for generating information, characterized in that: The method comprises: Obtaining an update instruction, wherein the update instruction carries an update file identifier and update operation information; Generate an update file index and an update file status based on the update file identifier and the update operation information; Obtaining an original root node index in the original file index information, wherein the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file; Perform an update root node index operation based on the update file index, the update file status and the original root node index to obtain an update root node index; Generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status; When receiving a file synchronization request sent by the update end, the update file index information is returned to the update end, so that the update end compares the update file index information with the original file index information in the update end to obtain differential leaf node information, and uses the update file index and the update file status in the differential leaf node information to synchronize the update file; Based on the at least two update file identifiers and the at least two update operation information carried by the update instruction, generate at least two update file indexes and at least two update file states; Perform node index operations based on the at least two update file indexes and the at least two update file states to obtain at least two child node indexes; Generate sub-update file index information based on the at least two sub-node indexes; A root node index operation is performed on the root node index in the sub-update file index information and the original root node index to obtain a target update root node index, and target update file index information is generated based on the target update root node index, the original file index information and the sub-update file index information.

6. The method according to claim 5, characterized in that Before the update instruction is detected, the method further includes: Acquire each of the original files, and generate a corresponding original file status based on each of the original files; Performing node indexing operations on the original files and the original file states corresponding to the original files to obtain the original file index information; The original file index information is sent to a terminal, so that the terminal acquires each original file according to the original file index information.

7. A file synchronization device, characterized in that: The device comprises: A receiving module, configured to receive updated file index information, wherein the updated file index information is obtained by updating the original file index information according to the updated information, wherein the updated information includes an updated file index and an updated file status; the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file; A comparison module is used to obtain the original file index information, perform node comparison between the original file index information and the updated file index information, and obtain difference leaf node information corresponding to the updated file index information; A writing module, used for writing the update file index and the update file status in the difference leaf node information into a preset difference leaf node information queue; A synchronization module, used to synchronize update files based on the update file index and the update file status in the preset difference leaf node information queue, and replace the original file index information with the update file index information; the update file index and the update file status are generated based on the update file identifier and update operation information carried by the update instruction; the update instruction is also used to generate at least two update file indexes and at least two update file statuses based on the at least two update file identifiers and the at least two update operation information when the update instruction carries at least two update file identifiers and at least two update operation information, perform node index operations based on the at least two update file indexes and the at least two update file statuses respectively to obtain at least two child node indexes, generate child update file index information based on the at least two child node indexes, perform root node index operations on the root node index in the child update file index information and the original root node index to obtain a target update root node index, and generate target update file index information based on the target update root node index, the original file index information and the child update file index information.

8. An information generating device, characterized in that: The device comprises: An instruction acquisition module is used to acquire an update instruction, wherein the update instruction carries an update file identifier and update operation information; A generation module, used for generating an update file index and an update file status based on the update file identifier and the update operation information; An index acquisition module, used to acquire an original root node index in original file index information, wherein the original file index information is a tree structure generated using the original file index and the original file status corresponding to each original file; A calculation module, used for performing an update root node index calculation based on the update file index, the update file status and the original root node index to obtain an update root node index; An index information generating module, configured to generate updated file index information based on the original file index information, the updated root node index, the updated file index and the updated file status; A sending module, for returning the updated file index information to the update end upon receiving a file synchronization request sent by the update end, so that the update end performs a node comparison between the updated file index information and the original file index information in the update end to obtain differential leaf node information, and uses the updated file index and the updated file status in the differential leaf node information to perform update file synchronization; The device is also used to: generate at least two update file indexes and at least two update file states based on at least two update file identifiers and at least two update operation information carried by the update instruction; perform node index operations based on the at least two update file indexes and the at least two update file states to obtain at least two child node indexes; generate child update file index information based on the at least two child node indexes; perform root node index operations on the root node index in the child update file index information and the original root node index to obtain a target update root node index; and generate target update file index information based on the target update root node index, the original file index information and the child update file index information.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data synchronization method and device, storage medium and computer equipment

    CN111917834A