Information synchronization method and device
By using a version number broadcast mechanism, the receiver can decide whether to retrieve data, while the sender only needs to generate a set of missing information. This solves the problems of complex sender logic and low efficiency in existing technologies, and achieves efficient and scalable information synchronization.
Patent Information
- Application Number
- CN202511301737.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-11
- Publication Date
- 2026-02-24
AI Technical Summary
In existing technologies, information synchronization schemes suffer from problems such as complex sender logic, limited scalability, and low efficiency. In particular, when there are many receivers or complex synchronization rules, resource consumption increases significantly and data is transmitted repeatedly.
A version number-based broadcast mechanism is adopted, where the sender broadcasts the latest version number, and the receiver decides whether to pull data based on the comparison between its local version number and the latest version number. The sender only needs to generate and send the missing information set, which simplifies the sender's state maintenance burden and improves synchronization efficiency.
It reduces the state maintenance burden on the sender during the information synchronization process, simplifies the processing logic, improves the efficiency and scalability of information synchronization, avoids duplicate data transmission, and adapts to different network conditions.
Smart Images

Figure CN121567709A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an information synchronization method, apparatus, electronic device, and computer-readable medium. Background Technology
[0002] In information synchronization scenarios involving two or more parties, existing technologies typically employ a method where the sender maintains the receiver's reception status to ensure information integrity. For example, the sender needs to record the reception progress of each receiver (such as the amount of data received, missing data, etc.) and use a retry mechanism to supplement any unreceived data. However, this approach has the following drawbacks:
[0003] question:
[0004] 1. Complex sender logic: The sender needs to maintain the reception status of each receiver, which leads to complex processing logic and high implementation cost.
[0005] 2. Limited scalability: When the number of receivers is large or the information synchronization rules are complex, the performance and resource consumption of the sender increase significantly.
[0006] 3. Inefficiency: Traditional retry mechanisms may lead to repeated data transmissions, especially when the receiver is large, resulting in significant resource waste.
[0007] Therefore, there is an urgent need for a new information synchronization method that can simplify the sender's processing logic, reduce its implementation cost, and improve the efficiency and reliability of information synchronization. Summary of the Invention
[0008] In view of this, on the one hand, embodiments of the present invention provide an information synchronization method based on a version number broadcast mechanism. During the synchronization process, this reduces the pressure on the sender to maintain the status of each receiver, simplifies the logical configuration of the sender's synchronization process, and improves synchronization efficiency. Specifically, embodiments of the present invention provide an information synchronization method applied to a sender, which stores a set of previous version information and corresponding version numbers. The method includes:
[0009] The sender broadcasts the latest version number of the information set to be synchronized to each receiver;
[0010] Receive a data retrieval request sent by the target receiver, wherein the target receiver is the receiver whose local information set version number is less than the latest version number among all receivers, and the data retrieval request includes the version number of the target receiver's local information set;
[0011] Based on the version number and latest version number of the target recipient's local information set, obtain the missing information set, and generate a pull response based on the missing information set;
[0012] Send a pull response to the target receiver so that the target receiver can generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0013] In some embodiments of the present invention, generating a pull response based on a missing information set further includes:
[0014] A first data fingerprint is generated based on the information set to be synchronized, wherein the pull response includes the first data fingerprint. The first data fingerprint is used by the target receiver to verify the latest local information set, and stores the latest local information set after successful verification.
[0015] In some embodiments of the present invention, generating a pull response based on a missing information set further includes:
[0016] The first information set is obtained according to the version number of the target receiver's local information set. The second data fingerprint is generated based on the first information set and the missing information set. The pull response includes the second data fingerprint. The second data fingerprint is used by the target receiver to verify the missing information set and generate the latest local information set after the verification is successful.
[0017] In some embodiments of the present invention, generating a second data fingerprint based on a first information set and a missing information set includes:
[0018] Generate a third data fingerprint based on the first information set;
[0019] The second data fingerprint is generated based on the third data fingerprint and the missing information set.
[0020] In some embodiments of the present invention, when there are multiple target receivers, obtaining the missing information set includes:
[0021] Obtain the priorities of multiple target receivers, and based on the priorities, obtain the missing information set corresponding to each target receiver.
[0022] In some embodiments of the present invention, obtaining the missing information set based on the version number and the latest version number of the target receiver's local information set includes:
[0023] Determine whether a missing information set exists in the local cache that corresponds to the version number of the target receiver's local information set;
[0024] When a missing information set corresponding to the version number of the target receiver's local information set exists in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is read from the local cache.
[0025] When the missing information set corresponding to the version number of the target receiver's local information set does not exist in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is obtained based on the information set corresponding to the version number of the target receiver's local information set and the information set to be synchronized, and the missing information set corresponding to the version number of the target receiver's local information set is stored in the local cache.
[0026] In some embodiments of the present invention, when there are multiple target receivers, sending a pull response to the target receivers includes:
[0027] Obtain the priority of multiple target receivers, and send pull responses to the target receivers according to their priorities.
[0028] In some embodiments of the present invention, the method further includes:
[0029] Acquire new information to be synchronized, and retain the current set of information to be synchronized and the corresponding latest version number;
[0030] Update the set of information to be synchronized based on the new information to be synchronized, and update the latest version number.
[0031] In other embodiments of the present invention, an information synchronization method is also provided, applied to a receiver, the receiver storing a local information set and a corresponding version number, the method comprising:
[0032] Listen for and obtain the latest version number of the synchronized information set broadcast by the sender;
[0033] When the latest version number is greater than the version number of the local information set, a data retrieval request containing the version number of the local information set is sent to the sender so that the sender can obtain the missing information set based on the version number of the local information set and the latest version number, and generate a retrieval response based on the missing information set.
[0034] Receive the pull response sent by the sender, generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0035] In some embodiments of the present invention, the pull response includes a first data fingerprint, which is generated by the sender based on a set of information to be synchronized; the method further includes:
[0036] The latest local information set is verified based on the first data fingerprint, and the latest local information set is stored after successful verification.
[0037] In some embodiments of the present invention, the pull response includes a second data fingerprint, which is generated by the sender based on a first information set corresponding to the version number of the local information set and a missing information set; generating the latest local information set based on the local information set and the missing information set includes:
[0038] The missing information set is verified based on the second data fingerprint, and the latest local information set is generated after the verification is successful.
[0039] In some embodiments of the present invention, verifying the missing information set based on the second data fingerprint includes:
[0040] A fourth data fingerprint is generated based on the local information set;
[0041] The fifth data fingerprint is obtained based on the fourth data fingerprint and the missing information set;
[0042] Compare the fifth data fingerprint with the second data fingerprint. If they match, the verification is successful.
[0043] Based on the above-described method embodiments, other embodiments of the present invention also provide an information synchronization device applied to a sender. The synchronization device includes a storage module, a broadcast module, a receiving module, a response generation module, and a sending module.
[0044] The storage module is configured to store the set of information about each version and the corresponding version number.
[0045] The broadcast module is configured to broadcast the latest version number of the information set to be synchronized to each receiver;
[0046] The receiving module is configured to receive data retrieval requests sent by the target receiver, wherein the target receiver is the receiver whose local information set version number is less than the latest version number among all receivers, and the data retrieval request includes the version number of the target receiver's local information set;
[0047] The pull response generation module is configured to obtain the missing information set based on the version number and the latest version number of the target receiver's local information set, and generate a pull response based on the missing information set;
[0048] The sending module is configured to send a pull response to the target receiver, so that the target receiver can generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0049] Based on the above-described method embodiments, other embodiments of the present invention also provide an information synchronization device applied to a receiver. The device includes a storage module, a monitoring module, a retrieval module, and a receiving module, wherein...
[0050] The storage module is configured to store a local information set and its corresponding version number;
[0051] The listening module is configured to listen for and obtain the latest version number of the set of information to be synchronized broadcast by the sender;
[0052] The pull module is configured to send a data pull request containing the version number of the local information set to the sender when the latest version number is greater than the version number of the local information set, so that the sender can obtain the missing information set based on the version number of the local information set and the latest version number, and generate a pull response based on the missing information set.
[0053] The receiving module is configured to receive the pull response sent by the sender, generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0054] According to another aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method of the above embodiments of the present invention.
[0055] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the above embodiments of the present invention.
[0056] One embodiment of the above invention has the following advantages or beneficial effects: In this embodiment, the sender broadcasts the version number of the information set to be synchronized to each receiver. Each receiver listens for the version number and compares it with the version number of the information set stored locally. If the local version number is less than the version number broadcast by the sender, the corresponding target receiver sends a pull request to the sender. Based on the difference between the version number of the target receiver's local information set and the version number of the information set to be synchronized in the pull request, the sender prepares the corresponding missing information set, generates a pull response, and sends it to the corresponding target receiver. The target receiver fills in the missing information set into its local information set to update the information set, thus achieving information synchronization. During the information synchronization process, the sender does not need to maintain the state of the receiver; the receiver determines whether information synchronization is necessary, reducing the state maintenance pressure on the sender during information synchronization and simplifying the information synchronization operation. It is applicable to receivers with different network conditions, reducing the pressure on the sender to maintain information synchronization tasks.
[0057] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0058] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:
[0059] Figure 1 This is a schematic diagram of a network system architecture for implementing a cross-network data synchronization method for a configuration management database according to some embodiments of the present invention;
[0060] Figure 2 This is a flowchart illustrating an information synchronization method according to some embodiments of the present invention;
[0061] Figure 3 This is a schematic diagram of the process for obtaining the latest version number according to some embodiments of the present invention;
[0062] Figure 4 This is a flowchart illustrating the process of obtaining a set of missing information according to some embodiments of the present invention;
[0063] Figure 5 This is a functional structure diagram of an information synchronization device according to some embodiments of the present invention;
[0064] Figure 6 This is a functional structure diagram of an information synchronization device according to other embodiments of the present invention;
[0065] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;
[0066] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation
[0067] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0068] In the embodiments of this invention, the “version number” refers to the sequence number indicating the version of the dataset. As the dataset changes, the version number gradually increases, and the larger the version number, the newer the version.
[0069] In existing data or information synchronization scenarios, the sender often needs to obtain the receiver's status in real time to manage information synchronization. However, as the number of receivers requiring synchronization increases, the amount of status information that the sender needs to maintain also increases, affecting the efficiency of information synchronization. This invention provides a version number-based broadcast mechanism to achieve information synchronization, allowing the receiver to decide whether to synchronize, thus reducing the burden of information maintenance on the sender.
[0070] See Figure 1This invention provides a network system 100 for implementing the methods described in this invention, including a sender 110 and one or more receivers 120. The sender 110 maintains a corresponding version number for each version of the information set; the version number is updated each time the information set is updated, increasing the version number. The receivers 120 also synchronously store the version number corresponding to the updated information after synchronizing the information. Both the sender 110 and the receivers 120 are provided with storage units for storing the information set and the corresponding version number. In some embodiments, the sender 110 also provides a cache to accommodate large-scale receiver pull requests, facilitating efficient reading of the information set.
[0071] like Figure 2 As shown, embodiments of the present invention also provide an information synchronization method, including the following steps:
[0072] S210: Sender 110 obtains the set of information to be synchronized and the corresponding latest version number V.
[0073] In this embodiment of the invention, the sender 110 stores the most recent information set and corresponding version number. When new information to be synchronized is obtained, the sender updates the information set and version number, such as... Figure 3 As shown, step S210 includes:
[0074] S211: Obtain new information to be synchronized, and retain the current set of information to be synchronized and the corresponding latest version number.
[0075] S212: Update the set of information to be synchronized based on the new information to be synchronized, and update the latest version number.
[0076] For example, if the current information set to be synchronized is Data1.01, and its latest version number is V1.01, when new information to be synchronized is available, the information set to be synchronized is updated to Data1.02, and the corresponding latest version number is updated to V1.02. In the embodiments of the present invention, the version number increases with each update of the information set; a larger version number indicates a newer information set.
[0077] In this embodiment of the invention, the sender 110 maintains a complete set of information to be synchronized and assigns it an initial version number, which is a unique string within a certain time period. Whenever the information to be synchronized is updated, the sender 110 generates a new version number, which is greater than the old version number.
[0078] S220: Sender 110 broadcasts the latest version number of the information set to be synchronized to each receiver 120; Sender 110 periodically or event-drivenly broadcasts the latest version number to all receivers. For example, Sender 110 broadcasts the latest version number once a day, or whenever the information set to be synchronized is updated.
[0079] S230: Receiver 120 listens for and obtains the latest version number of the synchronization information set broadcast by sender 110.
[0080] S240: When receiver 120 determines that the latest version number V is greater than the version number v of the local information set, it sends a data retrieval request containing the version number of the local information set to sender 110. In this embodiment of the invention, when the current receiver 120 determines that the latest version number is greater than the version number of the local information set, the current receiver 120 becomes the target receiver 120a. In some embodiments of the invention, the data retrieval request includes the version number of the target receiver's local information set.
[0081] For example, when the latest version number V is 1.03 and the version number v of the local information set is 1.01, the latest version number V is greater than the version number v of the local information set; as another example, when the latest version number V is 2.01 and the version number v of the local information set is 1.09, the latest version number V is greater than the version number v of the local information set.
[0082] S250: Sender 110 receives a data retrieval request sent by target receiver 120a.
[0083] S260: The sender 110 obtains the missing information set based on the version number and the latest version number of the target receiver 120a's local information set, and generates a pull response based on the missing information set.
[0084] In some embodiments of the present invention, the information set corresponding to each version number is different. For example, when the information set version number is 1.01, the information set is {data1, data2…datan}, and when the information set version number is 1.02, the information set is {data1, data2…datan, datan+1…datam}. When the version number v of the local information set is 1.01 and the latest version number V is 1.02, the missing information set is {datan+1…datam}.
[0085] In some embodiments of the present invention, the missing information set can be either a positive increase in information or a negative decrease in information. In the scenario of information decrease, each piece of information has a unique identifier. Information is identified based on the unique identifier. In the missing information set, the information increase / decrease symbol "+" can be used to represent information increase, and the information decrease symbol "-" can be used to represent information decrease.
[0086] In some embodiments of the present invention, when there are multiple target receivers, a synchronization priority is set for a specific receiver. When the priority is high (the lower the priority value), the sender 110 prioritizes to obtain the missing information set. In some embodiments of the present invention, the sender 110 obtains the priorities of multiple target receivers and obtains the missing information set corresponding to each target receiver according to the priority.
[0087] For example, if the priority of target receiver 120a1 is 1 and the priority of target receiver 120a2 is 2, then when sender 110 determines that target receiver 120a1 and target receiver 120a2 have not been processed, it will prioritize processing the pull request of target receiver 120a1, that is, prioritize obtaining the corresponding missing information set and prioritize generating the pull response.
[0088] In some embodiments of the present invention, since there may be multiple target receivers 120a, in scenarios with good network conditions, the local information set versions of different target receivers 120a may be the same. In order to avoid repeatedly generating missing information sets and wasting computing power, the sender 110 caches the missing information set corresponding to the local information set version number v after generating it. After receiving a pull request, the sender prioritizes reading the corresponding missing information set from the cache, which reduces the pressure of information synchronization of the sender 110 and can also maintain the information consistency between different versions of information.
[0089] In some embodiments of the present invention, such as Figure 4 As shown, based on the version number and latest version number of the target receiver's local information set, the missing information set is obtained, including:
[0090] S261: The sender 110 determines whether there is a missing information set in the local cache that corresponds to the version number of the target receiver's local information set.
[0091] S262: When a missing information set corresponding to the version number of the target receiver's local information set exists in the local cache, the sender 110 reads the missing information set corresponding to the version number of the target receiver's local information set from the local cache.
[0092] S263: When there is no missing information set in the local cache corresponding to the version number of the target receiver's local information set, the sender 110 obtains the missing information set corresponding to the version number of the target receiver's local information set based on the information set corresponding to the version number of the target receiver's local information set and the information set to be synchronized, and stores the missing information set corresponding to the version number of the target receiver's local information set in the local cache.
[0093] For example, if the latest version number is 1.05, the local cache stores the missing information set corresponding to local information set version 1.04 and the missing information set corresponding to local information set version 1.03. When the local information set version of a target receiver 120a is 1.04, the missing information set is directly obtained from the local cache. When the local information set version of a target receiver 120a is 1.02, there is no corresponding missing information set in the local cache. The missing information set needs to be generated based on the difference between versions 1.05 and 1.02 and cached at the same time.
[0094] In some embodiments of the present invention, in order to ensure the consistency of the information sets stored by each sender 110 and each receiver 120, integrity verification can also be performed by data fingerprints associated with the information sets during the information synchronization process to ensure the integrity of the information during the information synchronization process.
[0095] In some embodiments, during the generation of the pull response, the sender 110 also generates a first data fingerprint DF1 based on the information set to be synchronized, and sends it to the target receiver 120a along with the pull response. Subsequently, after the target receiver 120a synchronizes the information, it also uses the same data fingerprint algorithm to generate a data fingerprint DF1-1, compares DF1 and DF1-1, and if they are the same, it means that the data in the two information sets are consistent. In some embodiments of the present invention, the data storage rules in the information sets are the same, maintaining order.
[0096] In embodiments of the present invention, the method for generating data fingerprints can be a hash algorithm, such as the SHA-256 algorithm or the SM3 algorithm.
[0097] In some embodiments, the sender 110 obtains the corresponding first information set based on the version number of the target receiver 120a's local information set, generates a second data fingerprint based on the first information set and the missing information set, and sends it to the target receiver 120a along with the pull response. Subsequently, the target receiver 120a uses the second data fingerprint to verify the missing information set, and generates the latest local information set after successful verification.
[0098] In this embodiment of the invention, the process by which the sender 110 generates the second data fingerprint is as follows:
[0099] The sender 110 generates a third data fingerprint based on the first information set; and generates a second data fingerprint based on the third data fingerprint and the missing information set.
[0100] For example, the latest version number is 1.05, the target receiver 120a's local information set version number is 1.04, and the sender obtains the first information set Data1.04 with version number 1.04. A According to the first information set Data1.04 AGenerate a third data fingerprint DF3 based on information sets Data1.05 and Data1.04. A Obtain the missing information set Data1.05-1.04. A Then, based on the third data fingerprint DF3 and the missing information set Data1.05-1.04... A Generate the second data fingerprint DF2.
[0101] S270: Sender 110 sends a pull response to target receiver 120a.
[0102] In some embodiments of the present invention, when there are multiple target receivers, in order to accommodate the priority of synchronization information for specific receivers, the pull response can also be sent according to priority. Specifically, sending the pull response to the target receiver includes:
[0103] Obtain the priority of multiple target receivers, and send pull responses to the target receivers according to their priorities.
[0104] For example, if the priority of target receiver 120a1 is 1 and the priority of target receiver 120a2 is 2, then when sender 110 determines that the pull response of target receiver 120a1 and target receiver 120a2 has not been sent, it will send the pull response of target receiver 120a1 first.
[0105] S280: The target receiver 120a generates the latest local information set based on the local information set and the missing information set, and updates the corresponding version number to the latest version number.
[0106] For example, the latest version number of the information set to be synchronized is 1.05, the version number of the local information set before the update is 1.04, and the version number of the local information set after the update is 1.05.
[0107] In some embodiments of the present invention, during the process of supplementing missing information sets into the local information set, the supplementation can be carried out in a specific order to ensure that the information is arranged in order, which facilitates the verification of information integrity.
[0108] In some embodiments of the present invention, information can be updated based on the addition or subtraction of information symbols for each piece of information. When the symbol is "+", the information is added. When the symbol is "-", the corresponding information is indexed from the local information set according to the unique identifier, and then the information is deleted.
[0109] In some embodiments of the present invention, the target receiver 120a also verifies the integrity of the information during the process of updating the local information set. Specifically, the target receiver 120a verifies the latest local information set based on the first data fingerprint, and stores the latest local information set after the verification is successful. For example, the pull response includes the first data fingerprint DF1. The target receiver 120a fills in the missing information set into the local information set to generate the latest local information set, obtains the data fingerprint DF1-1 based on the latest local information set, compares DF1 and DF1-1, and if they match, the verification is successful, and the latest local information set and the corresponding version number are stored.
[0110] In some embodiments of the present invention, the target receiver 120a verifies the missing information set based on the second data fingerprint in the pull response, and generates the latest local information set after successful verification. Since the second data fingerprint is generated by the sender 110 based on the first information set corresponding to the version number of the local information set and the missing information set (generating a third data fingerprint based on the first information set, and generating a second data fingerprint based on the third data fingerprint and the missing information set), the target receiver 120a can not only verify the integrity of the overall dataset, but also verify whether the local information set before synchronization is consistent with the first information set, thereby verifying the consistency of the historical version information set. In some embodiments of the present invention, the verification process is as follows: the target receiver 120a generates a fourth data fingerprint based on the local information set; obtains a fifth data fingerprint based on the fourth data fingerprint and the missing information set; compares the fifth data fingerprint with the second data fingerprint; if they are consistent, the verification is successful.
[0111] For example, if the latest version number is 1.05 (corresponding to the information set to be synchronized, Data1.05), and the version number of the local information set is 1.04 (corresponding to the local information set, Data1.04), then the missing information sets are Data1.05-1.04. A (Generated based on the information set to be synchronized and the first information set), the target receiver 120a generates the fourth data fingerprint DF4 according to the local information set Data1.04, and then uses DF4 and Data1.05-1.04... A Generate the fifth data fingerprint DF5, compare DF2 and DF5. If they match, verify the local information set Data1.04 with the first information set Data1.04. A The information set Data1.05 to be synchronized is consistent with the latest local information set Data1.05 to be updated. B Consistent.
[0112] In some embodiments of the present invention, different synchronization strategies can be set to cope with different network environments. If the network environment between the sender and each receiver is always relatively good, and the latest version of the information set to be synchronized is relatively close to the previous version, the sender 110 can attach a small missing information set (the difference between the latest version and the previous version) when broadcasting the latest version number. In this way, if the version of the receiver's local information set is consistent with the previous version of the information set to be synchronized by the sender, the missing information set received by the receiver can supplement the missing information of the local information set, and there is no need to send a data retrieval request again. If the receiver determines that the difference between the version of the local information set and the latest version number is large, for example, there is a difference of one version, then it is necessary to send a retrieval request to the sender in the above manner.
[0113] In embodiments of the present invention, the sender and receiver can use a two-way authentication method to send and receive information to each other to ensure communication security. For example, TLS / SSL or mTLS (mutual transport layer security protocol) can be introduced during the version number broadcast and data retrieval stages to prevent man-in-the-middle attacks.
[0114] In this invention, the sender does not maintain the receiver's state, simplifying the sender's processing logic. Traditional information synchronization schemes require the sender to maintain the reception status of each receiver (e.g., the amount of data received, missing data, etc.), leading to high logical complexity and implementation cost. This invention introduces a version number mechanism, allowing the sender to maintain only the global latest version number without needing to concern itself with the specific reception status of each receiver, thus significantly simplifying the sender's processing logic. In this invention, the receiver compares its own version number with the sender's latest version number to proactively decide whether to fetch data. This approach transfers the initiative for information synchronization from the sender to the receiver, reducing the sender's burden and improving the system's scalability and flexibility. Through the version number mechanism, the receiver can accurately determine whether it needs to fetch data and which data to fetch, avoiding the duplicate transmission of all data, thereby improving data transmission efficiency and system resource utilization. This invention, through a version number-driven approach, achieves efficient synchronization and consistency assurance of information in a distributed system. The sender only needs to broadcast the version number, while the receiver actively pulls data based on the version number. This approach not only reduces the sender's load but also improves the scalability and fault tolerance of the entire system. The sender attaches a data fingerprint (such as SHA-256 or SM3 hash) to each version number; during single or cross-version synchronization, the overall data fingerprint of the synchronization is calculated in a certain order based on the data fingerprints of all versions to be synchronized, allowing the receiver to verify the integrity of the pulled data.
[0115] like Figure 5As shown, this embodiment of the invention also provides an information synchronization device 600, applied to the sender. The synchronization device 600 includes a first storage module 610, a broadcast module 620, a receiving module 630, a pull response generation module 640, and a sending module 650, wherein...
[0116] The first storage module 610 is configured to store the set of previous version information and the corresponding version number;
[0117] The broadcast module 620 is configured to broadcast the latest version number of the information set to be synchronized to each receiver;
[0118] The receiving module 630 is configured to receive a data retrieval request sent by a target receiver, wherein the target receiver is the receiver whose local information set version number is less than the latest version number among all receivers, and the data retrieval request includes the version number of the target receiver's local information set.
[0119] The pull response generation module 640 is configured to obtain the missing information set based on the version number and the latest version number of the target receiver's local information set, and generate a pull response based on the missing information set;
[0120] The sending module 650 is configured to send a pull response to the target receiver so that the target receiver can generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0121] In some embodiments of the present invention, the pull response generation module 640 is further configured as follows:
[0122] A first data fingerprint is generated based on the information set to be synchronized, wherein the pull response includes the first data fingerprint. The first data fingerprint is used by the target receiver to verify the latest local information set, and stores the latest local information set after successful verification.
[0123] In some embodiments of the present invention, the pull response generation module 640 is further configured as follows:
[0124] The first information set is obtained according to the version number of the target receiver's local information set. The second data fingerprint is generated based on the first information set and the missing information set. The pull response includes the second data fingerprint. The second data fingerprint is used by the target receiver to verify the missing information set and generate the latest local information set after the verification is successful.
[0125] In some embodiments of the present invention, the pull response generation module 640 is further configured as follows:
[0126] Generate a third data fingerprint based on the first information set;
[0127] The second data fingerprint is generated based on the third data fingerprint and the missing information set.
[0128] In some embodiments of the present invention, the pull response generation module 640 is further configured as follows:
[0129] Obtain the priority of the target recipient, and based on the priority, obtain the missing information set.
[0130] In some embodiments of the present invention, the pull response generation module 640 is further configured as follows:
[0131] Determine whether a missing information set exists in the local cache that corresponds to the version number of the target receiver's local information set;
[0132] When a missing information set corresponding to the version number of the target receiver's local information set exists in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is read from the local cache.
[0133] When the missing information set corresponding to the version number of the target receiver's local information set does not exist in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is obtained based on the information set corresponding to the version number of the target receiver's local information set and the information set to be synchronized, and the missing information set corresponding to the version number of the target receiver's local information set is stored in the local cache.
[0134] In some embodiments of the present invention, the sending module 650 is further configured to:
[0135] Obtain the priority of the target receiver, and send a pull response to the target receiver based on the priority.
[0136] In some embodiments of the present invention, the first storage module 610 is further configured as follows:
[0137] Acquire new information to be synchronized, and retain the current set of information to be synchronized and the corresponding latest version number;
[0138] Update the set of information to be synchronized based on the new information to be synchronized, and update the latest version number.
[0139] like Figure 6 As shown, this embodiment of the invention also provides an information synchronization device 700, applied to a receiver. The device 700 includes a second storage module 710, a monitoring module 720, a pull module 730, and a receiving module 740, wherein...
[0140] The second storage module 710 is configured to store a local information set and the corresponding version number;
[0141] The listening module 720 is configured to listen for and obtain the latest version number of the synchronized information set broadcast by the sender;
[0142] The pull module 730 is configured to send a data pull request containing the version number of the local information set to the sender when the latest version number is greater than the version number of the local information set, so that the sender can obtain the missing information set according to the version number of the local information set and the latest version number, and generate a pull response based on the missing information set.
[0143] The receiving module 740 is configured to receive the pull response sent by the sender, generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
[0144] In some embodiments of the present invention, the pull response includes a first data fingerprint, which is generated by the sender based on the set of information to be synchronized; the receiving module 740 is further configured to:
[0145] The latest local information set is verified based on the first data fingerprint, and the latest local information set is stored after successful verification.
[0146] In some embodiments of the present invention, the pull response includes a second data fingerprint, which is generated by the sender based on a first information set corresponding to the version number of the local information set and a missing information set; the receiving module 740 is further configured to:
[0147] The missing information set is verified based on the second data fingerprint, and the latest local information set is generated after the verification is successful.
[0148] In some embodiments of the present invention, the receiving module 740 is further configured to:
[0149] A fourth data fingerprint is generated based on the local information set;
[0150] The fifth data fingerprint is obtained based on the fourth data fingerprint and the missing information set;
[0151] Compare the fifth data fingerprint with the second data fingerprint. If they match, the verification is successful.
[0152] The features of the apparatus and system in the embodiments of the present invention can be referenced to the features of the methods and steps in the embodiments of the present invention, and the system embodiments can be combined with the features of the method embodiments to obtain new embodiments, and vice versa, and will not be repeated here.
[0153] An embodiment of the present invention provides an electronic device comprising: a processor and a memory storing a computer program, the processor being configured to implement any method according to an embodiment of the present invention when running the computer program. Additionally, means for implementing an embodiment of the present invention may also be provided.
[0154] Figure 7 An exemplary system architecture 1500 is shown for a system to which the methods of embodiments of the present invention can be applied.
[0155] like Figure 7 As shown, system architecture 1500 may include terminal devices 1501, 1502, and 1503, network 1504, and server 1505. Network 1504 is used as a medium to provide a communication link between terminal devices 1501, 1502, and 1503 and server 1505. Network 1504 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.
[0156] Users can use terminal devices 1501, 1502, and 1503 to interact with server 1505 via network 1504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1501, 1502, and 1503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0157] Terminal devices 1501, 1502, and 1503 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0158] Server 1505 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 1501, 1502, and 1503 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information and product information - for example only) to the terminal devices.
[0159] It should be noted that the cross-network data synchronization method for configuration management database provided in this embodiment of the invention is generally executed by server 1505, and correspondingly, the implementation device for cross-network data synchronization of configuration management database is generally set in server 1505.
[0160] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0161] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 1600 suitable for implementing terminal devices or servers of the present invention. The methods or apparatus for implementing the methods in the embodiments of the present invention can be implemented on the computer system 1600. Figure 8 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0162] like Figure 8 As shown, the computer system 1600 includes a central processing unit (CPU) 1601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1602 or programs loaded from storage portion 1608 into random access memory (RAM) 1603. The RAM 1603 also stores various programs and data required for the operation of the system 1600. The CPU 1601, ROM 1602, and RAM 1603 are interconnected via a bus 1604. An input / output (I / O) interface 1605 is also connected to the bus 1604.
[0163] The following components are connected to I / O interface 1605: an input section 1606 including a keyboard, mouse, etc.; an output section 1607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1608 including a hard disk, etc.; and a communication section 1609 including a network interface card such as a LAN card, modem, etc. The communication section 1609 performs communication processing via a network such as the Internet. A drive 1610 is also connected to I / O interface 1605 as needed. Removable media 1611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1610 as needed so that computer programs read from them can be installed into storage section 1608 as needed.
[0164] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1609, and / or installed from removable medium 1611. When the computer program is executed by central processing unit (CPU) 1601, it performs the functions defined above in the system of this invention.
[0165] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0166] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0167] The units or modules described in the embodiments of the present invention can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including a sending unit (or "module"), an acquisition unit, a determining unit, and a first processing unit. The names of these units or modules do not necessarily limit the specific unit or module itself; for example, a sending unit can also be described as "a unit that sends an image acquisition request to a connected server."
[0168] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to perform the cross-network data synchronization method for the configuration management database described in the above embodiments.
[0169] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An information synchronization method, characterized in that, Applied to the sender, which stores a set of version information and corresponding version numbers, the method includes: Broadcast the latest version number of the information set to be synchronized to each receiver; Receive a data retrieval request sent by a target receiver, wherein the target receiver is the receiver among the receivers whose local information set version number is less than the latest version number, and the data retrieval request includes the version number of the target receiver's local information set; Based on the version number of the target receiver's local information set and the latest version number, obtain the missing information set, and generate a pull response based on the missing information set; The pull response is sent to the target receiver so that the target receiver can generate a latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
2. The method according to claim 1, characterized in that, Generating a pull response based on the missing information set also includes: A first data fingerprint is generated based on the information set to be synchronized, wherein the pull response includes the first data fingerprint. The first data fingerprint is used by the target receiver to verify the latest local information set and to store the latest local information set after successful verification.
3. The method according to claim 1, characterized in that, Generating a pull response based on the missing information set also includes: The first information set is obtained according to the version number of the target receiver's local information set. A second data fingerprint is generated according to the first information set and the missing information set. The pull response includes the second data fingerprint. The second data fingerprint is used by the target receiver to verify the missing information set and generate the latest local information set after the verification is successful.
4. The method according to claim 3, characterized in that, The step of generating a second data fingerprint based on the first information set and the missing information set includes: Generate a third data fingerprint based on the first information set; The second data fingerprint is generated based on the third data fingerprint and the missing information set.
5. The method according to claim 1, characterized in that, When there are multiple target receivers, obtaining the missing information set includes: The priorities of multiple target receivers are obtained, and the missing information set corresponding to each target receiver is obtained according to the priorities.
6. The method according to claim 1, characterized in that, The step of obtaining the missing information set based on the version number of the target receiver's local information set and the latest version number includes: Determine whether a missing information set exists in the local cache that corresponds to the version number of the target receiver's local information set; When a missing information set corresponding to the version number of the target receiver's local information set exists in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is read from the local cache. When the missing information set corresponding to the version number of the target receiver's local information set does not exist in the local cache, the missing information set corresponding to the version number of the target receiver's local information set is obtained according to the information set corresponding to the version number of the target receiver's local information set and the information set to be synchronized, and the missing information set corresponding to the version number of the target receiver's local information set is stored in the local cache.
7. The method according to claim 1, characterized in that, When there are multiple target recipients, sending the pull response to the target recipients includes: The priorities of the multiple target receivers are obtained, and the pull response is sent to each target receiver according to the priority.
8. The method according to claim 1, characterized in that, The method further includes: Acquire new information to be synchronized, and retain the current set of information to be synchronized and the corresponding latest version number; The set of information to be synchronized is updated according to the new information to be synchronized, and the latest version number is also updated.
9. An information synchronization method, characterized in that, Applied to a receiver, which stores a local information set and a corresponding version number, the method includes: Listen for and obtain the latest version number of the synchronized information set broadcast by the sender; When the latest version number is greater than the version number of the local information set, a data retrieval request containing the version number of the local information set is sent to the sender, so that the sender can obtain the missing information set based on the version number of the local information set and the latest version number, and generate a retrieval response based on the missing information set. Receive the pull response sent by the sender, generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
10. The method according to claim 9, characterized in that, The pull response includes a first data fingerprint, which is generated by the sender based on the set of information to be synchronized; the method further includes: The latest local information set is verified based on the first data fingerprint, and the latest local information set is stored after successful verification.
11. The method according to claim 9, characterized in that, The pull response includes a second data fingerprint, which is generated by the sender based on the first information set corresponding to the version number of the local information set and the missing information set; The step of generating the latest local information set based on the local information set and the missing information set includes: The missing information set is verified based on the second data fingerprint, and the latest local information set is generated after the verification is successful.
12. The method according to claim 11, characterized in that, The step of verifying the missing information set based on the second data fingerprint includes: A fourth data fingerprint is generated based on the local information set; The fifth data fingerprint is obtained based on the fourth data fingerprint and the missing information set; The fifth data fingerprint is compared with the second data fingerprint. If they match, the verification is successful.
13. An information synchronization device, characterized in that, Applied to the sender, the synchronization device includes a storage module, a broadcast module, a receiving module, a pull-response generation module, and a sending module, wherein... The storage module is configured to store the set of previous version information and the corresponding version number; The broadcast module is configured to broadcast the latest version number of the information set to be synchronized to each receiver; The receiving module is configured to receive a data retrieval request sent by a target receiver, wherein the target receiver is the receiver whose local information set version number is less than the latest version number among the receivers, and the data retrieval request includes the version number of the target receiver's local information set. The pull response generation module is configured to obtain a missing information set based on the version number of the target receiver's local information set and the latest version number, and generate a pull response based on the missing information set. The sending module is configured to send the pull response to the target receiver, so that the target receiver generates the latest local information set based on the local information set and the missing information set, and updates the corresponding version number to the latest version number.
14. An information synchronization device, characterized in that, Applied to the receiver, the device includes a storage module, a listening module, a pull module, and a receiving module, wherein, The storage module is configured to store a local information set and the corresponding version number; The monitoring module is configured to monitor and obtain the latest version number of the information set to be synchronized broadcast by the sender; The pull module is configured to send a data pull request containing the version number of the local information set to the sender when the latest version number is greater than the version number of the local information set, so that the sender can obtain the missing information set according to the version number of the local information set and the latest version number, and generate a pull response according to the missing information set. The receiving module is configured to receive the pull response sent by the sender, generate the latest local information set based on the local information set and the missing information set, and update the corresponding version number to the latest version number.
15. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-12.
16. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-12.