Differential data synchronization method and device based on hierarchical version control and electronic equipment

Through the differential data synchronization method of hierarchical version control, the problem of low update efficiency of rule-class data sets is solved, and more efficient data synchronization and accurate version management are achieved, adapting to version differences comparison and incremental updates at different levels.

CN120407682APending Publication Date: 2025-08-01BEIJING FULE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510506668.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the update method of rule-type data sets is relatively low, the incremental update dependence history is not efficient enough, and the full coverage update is inefficient when the data volume is large or the rules are frequently changed.

Method used

The differential data synchronization method of hierarchical version control is adopted. By obtaining the version number of the rule data set, it is divided into the main version number and the sub-version number, the difference data between the main version number and the sub-version number is calculated, the target difference data is determined, and the difference comparison is made based on the current version number of the client, and the difference update data is dynamically generated.

Benefits of technology

It realizes finer-grained version management, reduces data transmission and storage overhead, improves the synchronization efficiency and real-time nature of regular data sets, and ensures the accuracy of the data set and the rapidity of incremental updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407682A_ABST
    Figure CN120407682A_ABST
Patent Text Reader

Abstract

The invention discloses a differential data synchronization method and device based on hierarchical version control and electronic equipment, and relates to the field of data processing. The method comprises the following steps: acquiring a version number of a rule data set; dividing the version number into a plurality of main version numbers and a plurality of sub-version numbers; calculating difference data between the first main version number and the second main version number to obtain first difference data, and calculating difference data between the first sub-version number and the second sub-version number to obtain second difference data; obtaining a current version number from the client, and comparing the difference between the current version number and the target version number; determining target differential data in the first differential data and the second differential data according to the difference; and sending the target differential data to the client, so that the client merges the target differential data with the original data to generate a rule data set corresponding to the target version number. By implementing the technical scheme provided by the invention, the updating efficiency of the rule data set is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a differential data synchronization method, apparatus, and electronic device based on hierarchical version control. Background Art

[0002] Rule-based data sets, such as virus definition libraries, DNS rule libraries, and firewall rule sets, are an indispensable part of network security and network management. These data sets are widely used for quickly matching, detecting, or processing a large amount of dynamic information, such as network security threats, domain name resolution, and access control. To ensure that the system can respond in real time to changing threats and traffic, frequent updates and full-network synchronization of the rule set are crucial. In terms of technical implementation, the currently mainstream methods for distributing and synchronizing rule-based data sets in the industry mainly include incremental updates and full-coverage updates. Incremental updates reduce the amount of data transferred by only transmitting the data that has been newly added or modified since the last update. This method is suitable for scenarios where the rule changes are not particularly large but need to be updated frequently, and can significantly improve the update efficiency. Full-coverage updates are used when there are significant changes in the rule library or when the update strategy is relatively complex. It ensures complete consistency between the client and the server by transmitting the entire data set. The advantage of full-coverage updates is that they are simple and reliable to implement, do not depend on the previous version state, and are suitable for major updates or version reconstructions.

[0003] Although incremental updates and full-coverage updates each have their advantages, they also have some deficiencies in practical applications. Although incremental updates can reduce the amount of data transferred, they rely on historical update records, which may not be efficient enough when dealing with cross-version updates. In addition, if some of the intermediate updates fail to be applied successfully, it may lead to data inconsistency problems. Although full-coverage updates are simple and reliable, due to the need to transmit the entire data set, their efficiency is low in cases where the data volume is large or the rules change frequently. Therefore, the rule data set update methods of the prior art have the problem of low efficiency.

[0004] Therefore, there is an urgent need for a differential data synchronization method, apparatus, and electronic device based on hierarchical version control. Summary of the Invention

[0005] The present application provides a differential data synchronization method, apparatus, and electronic device based on hierarchical version control, which improves the update efficiency of the rule data set.

[0006] In the first aspect of the present application, a differential data synchronization method based on hierarchical version control is provided. The method includes: obtaining the version number of a rule data set, where the rule data set includes a virus definition library, a DNS rule set, and firewall rules; dividing the version number into multiple major version numbers and multiple minor version numbers, where the minor version numbers are the version numbers under each major version number level, and one major version number level includes one or more minor version numbers; calculating the difference data between a first major version number and a second major version number to obtain first differential data, and calculating the difference data between a first minor version number and a second minor version number to obtain second differential data, where the first major version number and the second major version number are any two major version numbers among the multiple major version numbers, and the first minor version number and the second minor version number are any two third minor version numbers among the multiple third minor version numbers, and the third minor version number is the minor version number under the first major version number level; obtaining the current version number from a client, and comparing the difference between the current version number and the target version number, where the target version number is the version number that the client needs to synchronize to; determining target differential data from the first differential data and the second differential data according to the difference; sending the target differential data to the client, so that the client can merge the target differential data with the original data to generate the rule data set corresponding to the target version number, and the original data is the rule data set corresponding to the current version number.

[0007] By adopting the above technical solution, by obtaining the version number of the rule data set and dividing the version number into major version numbers and minor version numbers, hierarchical version management of the rule data set is realized. The hierarchical version management method can control the version evolution of the rule data set with finer granularity, which is convenient for differential comparison and incremental update for different levels of versions. At the same time, the method calculates the difference data between different major version numbers and minor version numbers to obtain the first differential data and the second differential data, realizing the differential comparison and extraction between different versions of the rule data set. This way of extracting differential data can greatly reduce the overhead of data transmission and storage, and improve the synchronization efficiency of the rule data set. In addition, the method also obtains the current version number of the client, compares it with the target version number, and determines the target differential data that the client needs to synchronize, realizing the function of dynamically generating differential update data according to the actual version status of the client, and avoiding the inefficiency problem of full-scale update. Finally, the method sends the target differential data to the client and completes the merging of the differential data locally on the client to generate the rule data set of the target version, realizing the incremental update and rapid upgrade of the rule data set, and improving the real-time performance, accuracy, and efficiency of the rule data set synchronization.

[0008] Optionally, calculating the difference data between the first major version number and the second major version number to obtain the first differential data specifically includes: obtaining the first major version data corresponding to the first major version number and the second major version data corresponding to the second major version number; comparing the differences between the first major version data and the second major version data to generate the first differential data, where the first differential data includes the newly added data, modified data, and deleted data of the second major version data relative to the first major version data.

[0009] By adopting the above technical solution, in the process of calculating the difference data between major version numbers, by obtaining the complete major version data corresponding to two major version numbers and comparing the differences between the two major version data, the first differential data is generated, where the first differential data includes newly added data, modified data, and deleted data. This way of difference comparison can comprehensively and accurately identify the data changes between two major versions, including data addition, modification, and deletion, ensuring the integrity and reliability of the differential data. At the same time, by directly comparing the major version data instead of the minor version data, the number of difference comparisons and the calculation amount can be significantly reduced, improving the efficiency of generating differential data. In addition, by dividing the differential data into three types: newly added, modified, and deleted, it is convenient to compress and encode the differential data, reducing the transmission volume of the differential data and improving the network transmission efficiency. After receiving the differential data, the client can also adopt different merging strategies according to the data type to quickly complete the merging and updating of the differential data, reducing the complexity and error rate of the merging process.

[0010] Optionally, dividing the version number into multiple major version numbers and multiple minor version numbers specifically includes: dividing the version number into multiple digital segments according to a preset rule; taking the first digital segment as the major version number, and taking the second digital segment as the minor version numbers under each major version number level in a preset order, where the first digital segment is a digital segment with a preset length after dividing the version number according to the preset rule, and the second digital segment is the digital segments other than the first digital segment among the multiple digital segments; establishing a version number index table according to the major version number and the minor version number, and the version number index table records the corresponding relationship between each major version number and one or more minor version numbers under each major version number level.

[0011] By adopting the above technical solution, in the process of dividing the version number into a major version number and a minor version number, the version number is divided into multiple digital segments according to a preset rule, and the first digital segment is used as the major version number, and the other digital segments are used as the minor version number, realizing the automatic division and structured management of the version number. This version number division method can adapt to version numbers of different lengths and formats, and has strong flexibility and versatility. At the same time, by presetting the length of the digital segment of the major version number, the quantity and range of the major version number can be controlled, avoiding the increase in management complexity caused by too many major version numbers. Taking the other digital segments as the minor version numbers in the preset order successively can form a linearly ordered minor version sequence under each major version number, facilitating the comparison and management of the minor version numbers. In addition, this method also establishes a version number index table based on the major version number and the minor version number, records the corresponding relationship between the major version number and the minor version number, and realizes the quick search and positioning of the version number. Through the version number index table, all minor version numbers under a major version can be quickly obtained according to any major version number, or the major version number to which any minor version number belongs can be quickly located, greatly improving the retrieval efficiency of version management.

[0012] Optionally, the obtaining of the current version number from the client and the comparison of the differences between the current version number and the target version number specifically include: receiving a version query request sent by the client, where the current version number of the client is carried in the version query request; parsing the version query request to obtain the current version number, and extracting the current major version number and the current minor version number corresponding to the current version number from the current version number according to a preset rule; obtaining the target version number, and extracting the target major version number and the target minor version number corresponding to the target version number from the target version number according to the preset rule; determining whether the current major version number is the same as the target major version number; if it is determined that the current major version number and the target major version number are the same, then comparing the current minor version number with the target minor version number to obtain the range of minor version numbers that need to be synchronized; if it is determined that the current major version number and the target major version number are not the same, then determining that the client needs to perform cross-major-version synchronization, and obtaining the range of major version numbers that need to be synchronized and the range of minor version numbers that need to be synchronized within each major version; according to the range of major version numbers and the range of minor version numbers, determining the target differential data corresponding to the difference.

[0013] By adopting the above technical solution, in the process of obtaining the current version number of the client and the target version number and comparing the version number differences, the current version number of the client is obtained by receiving the version query request sent by the client, and the major version number and the minor version number are extracted from the current version number, realizing the automatic acquisition and parsing of the client version number. At the same time, by comparing the major version number and the minor version number of the current version number and the target version number, it is possible to accurately determine whether the client needs to perform version synchronization and the specific version range that needs to be synchronized. According to whether the major version numbers are the same, it can be determined whether the client only needs to synchronize the minor version number or needs to perform cross-major version synchronization, realizing the adaptive adjustment of the synchronization granularity. In the case where the major version numbers are different, by calculating the synchronization range of the major version number and the minor version number, all the differential data that the client needs to synchronize can be determined at one time, reducing the overhead of multiple differential data requests and transmissions and improving the synchronization efficiency. In addition, determining the target differential data according to the version number difference can avoid unnecessary generation and transmission of differential data, reducing the transmission volume and storage space of data synchronization.

[0014] Optionally, determining the target differential data from the first differential data and the second differential data according to the difference specifically includes: if the difference indicates that the current major version number is the same as the target major version number, then in the second differential data, determine the difference data between the current minor version number and the target minor version number as the target differential data; if the difference indicates that the current major version number is different from the target major version number, then determine the version span between the current major version number and the target major version number; according to the version span, in the first differential data, determine the difference data between the current major version number and the target major version number as the first part of the target differential data; in the second differential data, determine the difference data between the initial minor version number at the target major version number level and the target minor version number as the second part of the target differential data, where the initial minor version number is the smallest minor version number at the target major version number level; merge the first part of the target differential data with the second part of the target differential data to obtain the target differential data.

[0015] By adopting the above technical solution, in the process of determining the target differential data according to the version number difference, by judging whether the current version number and the target version number are consistent at the major version number level, different differential data determination strategies are respectively adopted, realizing the adaptive optimization of differential data generation. When the major version numbers are consistent, by determining the difference data between the current sub-version number and the target sub-version number in the second differential data as the target differential data, unnecessary processing of major version number difference data can be avoided, reducing the generation time and data volume of the differential data. When the major version numbers are inconsistent, by first calculating the major version number difference data, then calculating the sub-version number difference data, and merging the two parts of the difference data to form the complete target differential data. This way of generating and merging differential data in stages can make full use of the existing first differential data and second differential data, reducing repeated calculations and data transmissions. At the same time, by synchronizing the major version number first and then the sub-version number, the orderliness and integrity of cross-major version synchronization are ensured, avoiding data loss and inconsistency during the version synchronization process. In addition, when calculating the sub-version number difference data, by using the minimum sub-version number under the target major version as the starting version, the existing sub-version number difference data can be reused to the maximum extent, improving the efficiency of differential data generation.

[0016] Optionally, the sending the target differential data to the client specifically includes: obtaining the data volume size of the target differential data; if the data volume size is greater than or equal to a preset threshold, using a first compression algorithm to compress the target differential data to obtain the compressed target differential data, and sending the compressed target differential data to the client; if the data volume size is less than the preset threshold, using a second compression algorithm to compress the target differential data to obtain the compressed target differential data, and sending the compressed target differential data to the client, where the compression rate of the first compression algorithm is higher than that of the second compression algorithm.

[0017] By adopting the above technical solution, during the process of sending the target differential data to the client, by obtaining the size of the target differential data and comparing it with a preset threshold, different data compression algorithms are adaptively selected, achieving efficient compression and optimization of differential data transmission. When the data volume is greater than or equal to the preset threshold, the first compression algorithm with a higher compression ratio is used to compress the target differential data, which can significantly reduce the transmission volume of the differential data and save network bandwidth resources. When the data volume is less than the preset threshold, the second compression algorithm with a lower compression ratio but faster compression speed is used, which can improve the compression efficiency of the differential data and reduce the compression delay while ensuring a certain compression effect. This adaptive data compression strategy can dynamically adjust the compression algorithm according to the actual data volume size, giving priority to the compression ratio when the data volume is large and giving priority to the compression speed when the data volume is small, so as to achieve the best balance between reducing the network transmission volume and improving the transmission efficiency. After receiving the compressed target differential data, the client only needs to perform the corresponding decompression operation to restore the original target differential data and use it for subsequent version merging and upgrading, reducing the computing and storage overhead of the client.

[0018] Optionally, after sending the target differential data to the client, the method further includes: receiving a differential data merging result sent by the client, where the differential data merging result includes a merging success status and a merging failure status; if the differential data merging result is a merging failure status, sending the target rule data set corresponding to the target version number to the client, so that the client can use the target rule data set to replace the original data.

[0019] By adopting the above technical solution, after sending the target differential data to the client, the merging process is also monitored and verified by receiving the differential data merging result sent by the client, achieving the reliability guarantee and exception handling of version synchronization. By distinguishing between the two states of merging success and failure, it is possible to accurately determine whether the version synchronization of the client is successfully completed, avoiding the uncertainty of the synchronization result. In the case of a merging failure, by sending the complete target version rule data set to the client instead of the differential data, the version state of the client can be quickly restored, and the client can be directly synchronized to the target version, avoiding the inconsistency and risks of the intermediate state. This fault-tolerant mechanism of sending the complete target version data set can effectively handle the exception of differential data merging failure and improve the stability of version synchronization.

[0020] In a second aspect of the present application, a differential data synchronization device based on hierarchical version control is provided. The device includes a version number acquisition module, a version number division module, a differential data calculation module, and a differential data sending module, where: The version number acquisition module is configured to acquire the version number of a rule data set, and the rule data set includes a virus definition library, a DNS rule set, and a firewall rule; The version number division module is configured to divide the version number into a plurality of major version numbers and a plurality of minor version numbers. Among them, the minor version number is the version number under each major version number level, and one major version number level includes one or more minor version numbers; The differential data calculation module is configured to calculate the difference data between a first major version number and a second major version number to obtain first differential data, and calculate the difference data between a first minor version number and a second minor version number to obtain second differential data. The first major version number and the second major version number are any two major version numbers among the plurality of major version numbers, and the first minor version number and the second minor version number are any two third minor version numbers among the plurality of third minor version numbers. The third minor version number is the minor version number under the first major version number level; The version number acquisition module is further configured to acquire the current version number from the client and compare the difference between the current version number and the target version number. The target version number is the version number that the client needs to synchronize to; The differential data calculation module is further configured to determine the target differential data from the first differential data and the second differential data according to the difference; The differential data sending module is configured to send the target differential data to the client, so that the client merges the target differential data with the original data to generate the rule data set corresponding to the target version number. The original data is the rule data set corresponding to the current version number.

[0021] In a third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, and both the user interface and the network interface are used to communicate with other devices. The processor is configured to execute the instructions stored in the memory so that the electronic device executes the method described in any one of the above.

[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions, and when the instructions are executed, the method described in any one of the above is executed.

[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. This technical solution introduces the concepts of major version number and minor version number, allowing for a more detailed versioning of the data set. The major version number is used to identify larger or structural changes, while the minor version number is used to track minor updates within the major version. This hierarchical management enables the differences between versions to be more precisely controlled and managed, thus providing more flexible update options.

[0024] 2. By calculating the difference data between different major and minor version numbers, this solution can accurately determine the data parts that need to be synchronized. For each update request, the system only needs to synchronize the data that has changed since the last update, rather than the entire data set. This differential update greatly reduces the amount of data that must be transferred each time, effectively reducing bandwidth consumption and increasing the synchronization speed, thereby enhancing the update efficiency.

[0025] 3. This solution provides the ability to directly jump to any target version based on the current state of the client. It allows the client to select the most suitable update path according to its own needs. Whether it is a step-by-step update or a jump update, it can be flexibly handled according to the actual situation. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a flowchart of the differential data synchronization method based on hierarchical version control disclosed in the embodiments of the present application; Figure 2 is a module diagram of the differential data synchronization device based on hierarchical version control disclosed in the embodiments of the present application; Figure 3 is a structural diagram of an electronic device disclosed in the embodiments of the present application.

[0027] Description of the reference numerals: 201, version number acquisition module; 202, version number division module; 203, differential data calculation module; 204, differential data sending module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0028] In order to enable those skilled in the art to better understand the technical solutions in this specification, the following will clearly and completely describe the technical solutions in the embodiments of this specification in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments.

[0029] In the description of the embodiments of the present application, words such as "for example" or "for instance" are used to give examples, illustrations or explanations. Any embodiment or design solution described as "for example" or "for instance" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0030] In the description of the embodiments of the present application, the term "plurality" means two or more. For example, a plurality of systems means two or more systems, and a plurality of screen terminals means two or more screen terminals. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0031] The present application provides a differential data synchronization method based on hierarchical version control, with reference to Figure 1 , Figure 1 is a schematic flowchart of the differential data synchronization method based on hierarchical version control provided by the embodiments of the present application. This method is applied to a server, where the server is a server that executes a differential data synchronization program based on hierarchical version control. The server can be a single server, a server cluster composed of multiple servers, or a cloud computing service center. This method includes steps S101 to S106, and the above steps are as follows: Step S101: Obtain the version number of the rule data set, where the rule data set includes a virus definition library, a DNS rule set, and a firewall rule.

[0032] In step S101, the server obtains the version number of the rule data set. The rule data set is a set of key data for network security protection, including a virus definition library, a DNS rule set, and a firewall rule. The rule data set can help the server identify and prevent various network threats, such as malware, phishing attacks, illegal intrusions, etc.

[0033] The server can obtain the version number of the rule data set in various ways. One way is to regularly obtain each version of the rule data set from the rule data set provider. The provider usually assigns a unique version number to each version of the rule data set to identify and distinguish different versions of the rule data set. The server can obtain each version of the rule data set and its corresponding version number by accessing the provider's server or website.

[0034] Another way to obtain the version number is for the server to locally maintain a record of the version number of the rule data set. Whenever the server obtains a new version of the rule data set, it records the new version number and stores the new version of the rule data set in the local database. In this way, the server can quickly learn the version number of the rule data set currently in use by querying the local version number record.

[0035] For example, assume that the server obtains the latest version of the rule data set from the rule data set provider at 2:00 am every day. The provider uses the date as part of the version number. For example, "20230415" represents the version released on April 15, 2023. After the server obtains the rule data set, it records the version number "20230415" and stores the rule data set in the local database. When the server needs to obtain the version number of the rule data set, it only needs to query the local version number record.

[0036] Step S102: Divide the version number into multiple major version numbers and multiple minor version numbers. Among them, the minor version numbers are the version numbers under each major version number level, and one major version number level includes one or more minor version numbers.

[0037] In step S102, dividing the version number into multiple major version numbers and multiple minor version numbers specifically includes: dividing the version number into multiple digital segments according to a preset rule; taking the first digital segment as the major version number, and sequentially taking the second digital segment as the minor version numbers under each major version number level. The first digital segment is the digital segment with a preset length after dividing the version number according to the preset rule, and the second digital segment is the digital segments other than the first digital segment among the multiple digital segments; establishing a version number index table based on the major version number and the minor version number. The version number index table records the correspondence between each major version number and one or more minor version numbers under each major version number level.

[0038] Specifically, the server divides the version number of the obtained rule data set into multiple major version numbers and multiple minor version numbers. This hierarchical version control method can better manage and track the change history of the rule data set, and at the same time provides convenience for subsequent differential data synchronization.

[0039] First, the server divides the version number into multiple digital segments according to a preset rule. The preset rule can be designed according to actual needs. For example, the version number is divided into multiple digital segments according to a fixed length, or the version number is divided into multiple digital segments with a specific character (such as ".") as the separator. The divided digital segments are arranged in a preset order. The first digital segment represents the major version number, and the subsequent digital segments represent the minor version numbers.

[0040] Next, the server takes the first digital segment with a preset length as the major version number, and takes the remaining digital segments as sub-version numbers under each major version number level in the preset order. The major version number usually represents the major version of the rule dataset, such as 1.0, 2.0, etc., which is used to identify major updates or improvements to the rule dataset. The sub-version number represents minor version iterations based on the major version number, such as 1.1, 1.2, etc., which are used to identify minor adjustments or optimizations to the rule dataset.

[0041] For example, assume that the version number of the rule dataset obtained by the server is "2.3.1". According to the preset rules, the server divides the version number into three digital segments: "2", "3", and "1". Among them, "2" is used as the major version number, indicating the second major version of the rule dataset; "3" and "1" are used as sub-version numbers, representing the third and first minor versions under the major version number "2" respectively.

[0042] Finally, the server establishes a version number index table based on the divided major version number and sub-version number. The version number index table records the corresponding relationship between each major version number and one or more sub-version numbers under its corresponding level. Through the version number index table, the server can quickly search for and locate the rule dataset corresponding to any version number, and can also conveniently track and manage the version evolution history of the rule dataset.

[0043] Continuing with the above example, the server enters the major version number "2" and the sub-version numbers "3" and "1" into the version number index table. The version number index table will record that there are two sub-version numbers, "3" and "1", corresponding to the major version number "2". If a new version of the rule dataset is released later, such as "2.3.2", the server can add the new sub-version number "2" under the level of the major version number "2" and update the version number index table.

[0044] Step S103: Calculate the difference data between the first major version number and the second major version number to obtain the first differential data, and calculate the difference data between the first sub-version number and the second sub-version number to obtain the second differential data. The first major version number and the second major version number are any two major version numbers among multiple major version numbers, and the first sub-version number and the second sub-version number are any two third sub-version numbers among multiple third sub-version numbers. The third sub-version number is the sub-version number under the first major version number level.

[0045] In step S103, the difference data between the first major version number and the second major version number is calculated to obtain the first differential data, which specifically includes: obtaining the first major version data corresponding to the first major version number and the second major version data corresponding to the second major version number; comparing the differences between the first major version data and the second major version data to generate the first differential data, and the first differential data includes the newly added data, modified data, and deleted data of the second major version data relative to the first major version data.

[0046] Specifically, the server calculates the difference data between different version numbers, including the difference data between major version numbers (the first differential data) and the difference data between minor version numbers (the second differential data). This step is the core of the differential data synchronization method based on hierarchical version control. By calculating the difference data, the server can quickly identify the changed content between different versions, thereby achieving incremental data synchronization and reducing the overhead of data transmission.

[0047] First, the server determines any two major version numbers from multiple major version numbers as the first major version number and the second major version number for calculating the difference data at the major version number level. Then, the server obtains the first major version data corresponding to the first major version number and the second major version data corresponding to the second major version number. The major version data usually contains the complete content of the rule data set corresponding to all minor version numbers under this major version number.

[0048] Next, the server compares the differences between the first major version data and the second major version data to generate the first differential data. Specifically, the server will compare each rule in the two major version data one by one to identify the newly added rules, modified rules, and deleted rules of the second major version data relative to the first major version data. The newly added rules refer to the rules that appear in the second major version data but do not exist in the first major version data; the modified rules refer to the rules that exist in both major version data but have different contents; the deleted rules refer to the rules that appear in the first major version data but are deleted in the second major version data.

[0049] For example, assume that the first major version number is "1", and the corresponding first major version data contains rules A, B, and C; the second major version number is "2", and the corresponding second major version data contains rules B, C, and D. After the server compares the two major version data, it is found that rule D is a newly added rule, rule A is a deleted rule, and rules B and C remain unchanged. Therefore, the first differential data will contain the newly added rule D and the deleted rule A, indicating the changed content from the first major version to the second major version.

[0050] Similarly, the server also calculates the difference data between sub-version numbers to obtain the second differential data. The server selects any two sub-version numbers (the third sub-version number) from multiple sub-version numbers under the first major version number as the first sub-version number and the second sub-version number, then compares the corresponding rule data sets of the two sub-version numbers, identifies the newly added rules, modified rules, and deleted rules, and generates the second differential data.

[0051] Continuing with the above example, assume that there are two sub-version numbers "1.1" and "1.2" under the first major version number "1", and the corresponding rule data sets are {A, B} and {A, B, C} respectively. After the server compares the rule data sets of the two sub-version numbers, it finds that rule C is a newly added rule. Therefore, the second differential data will include the newly added rule C, indicating the changes from sub-version "1.1" to sub-version "1.2".

[0052] Step S104: Obtain the current version number from the client and compare the difference between the current version number and the target version number, where the target version number is the version number that the client needs to synchronize to.

[0053] In step S104, obtaining the current version number from the client and comparing the difference between the current version number and the target version number specifically includes: receiving a version query request sent by the client, where the version query request carries the current version number of the client; parsing the version query request to obtain the current version number, and extracting the current major version number and the current sub-version number corresponding to the current version number from the current version number according to a preset rule; obtaining the target version number, and extracting the target major version number and the target sub-version number corresponding to the target version number from the target version number according to a preset rule; determining whether the current major version number is the same as the target major version number; if it is determined that the current major version number and the target major version number are the same, then compare the current sub-version number with the target sub-version number to obtain the range of sub-version numbers that need to be synchronized; if it is determined that the current major version number and the target major version number are different, then determine that the client needs to perform cross-major version synchronization, and obtain the range of major version numbers that need to be synchronized and the range of sub-version numbers that need to be synchronized within each major version; according to the range of major version numbers and the range of sub-version numbers, determine the target differential data corresponding to the difference.

[0054] Specifically, the server obtains the version number of the rule dataset currently used by the client (the current version number), and compares it with the target version number that the client needs to synchronize to, to determine the range of differential data that the client needs to synchronize. First, the server receives a version query request sent by the client, and the version query request carries the version number of the rule dataset currently used by the client (the current version number). The server parses this request, extracts the current version number, and extracts the current major version number and the current minor version number from the current version number according to a preset rule (such as a fixed length or a specific delimiter). Next, the server obtains the target version number that the client needs to synchronize to, and also extracts the target major version number and the target minor version number from the target version number according to the preset rule.

[0055] Then, the server determines whether the current major version number and the target major version number are the same. If they are the same, it means that the client only needs to synchronize the minor version within the current major version; if they are different, it means that the client needs to perform cross-major-version synchronization, that is, first synchronize the major version and then synchronize the minor version.

[0056] When the current major version number and the target major version number are the same, the server compares the current minor version number with the target minor version number to obtain the range of minor version numbers that need to be synchronized. For example, if the current minor version number is "1.2" and the target minor version number is "1.5", the range of minor version numbers that need to be synchronized is from "1.3" to "1.5".

[0057] When the current major version number and the target major version number are different, the server determines that the client needs to perform cross-major-version synchronization, and respectively obtains the range of major version numbers that need to be synchronized and the range of minor version numbers that need to be synchronized within each major version. For example, if the current version number is "1.2.3" and the target version number is "2.1.1", the range of major version numbers that need to be synchronized is from "1" to "2", the range of minor version numbers that need to be synchronized within the major version "1" is from "1.2.3" to "1.x.x" (where "x" represents the latest minor version number), and the range of minor version numbers that need to be synchronized within the major version "2" is from "2.0.0" to "2.1.1".

[0058] Finally, the server selects the corresponding differential data from the previously calculated first differential data and second differential data according to the determined range of major version numbers and minor version numbers, and combines them into the target differential data that the client needs to synchronize.

[0059] For example, assume that the current version number of the client is "1.2.3" and the target version number is "2.1.1". After the server parses the version numbers, it determines that the range of major version numbers to be synchronized is from "1" to "2". The range of minor version numbers to be synchronized within major version "1" is from "1.2.3" to "1.9.9" (assuming "1.9.9" is the latest minor version of major version "1"), and the range of minor version numbers to be synchronized within major version "2" is from "2.0.0" to "2.1.1". The server selects the difference data from major version "1" to major version "2" from the first differential data, and then selects the difference data from minor version "1.2.3" to minor version "1.9.9" and the difference data from minor version "2.0.0" to minor version "2.1.1" from the second differential data, and combines these difference data into the target differential data that the client needs to synchronize.

[0060] Step S105: Determine the target differential data from the first differential data and the second differential data according to the differences.

[0061] In step S105, determining the target differential data from the first differential data and the second differential data according to the differences specifically includes: If the difference indicates that the current major version number is the same as the target major version number, then in the second differential data, determine the difference data between the current minor version number and the target minor version number as the target differential data; If the difference indicates that the current major version number is different from the target major version number, then determine the version span between the current major version number and the target major version number; According to the version span, in the first differential data, determine the difference data between the current major version number and the target major version number as the first part of the target differential data; In the second differential data, determine the difference data between the initial minor version number and the target minor version number under the target major version number as the second part of the target differential data, where the initial minor version number is the smallest minor version number under the target major version number; Combine the first part of the target differential data with the second part of the target differential data to obtain the target differential data.

[0062] Specifically, the server determines the target differential data that the client needs to synchronize from the first differential data and the second differential data calculated previously according to the difference between the current version number and the target version number of the client. First, the server determines whether the current major version number of the client is the same as the target major version number.

[0063] If the two are the same, it means that the client only needs to synchronize the sub-versions within the current major version. At this time, the server determines the difference data between the client's current sub-version number and the target sub-version number in the second differential data (i.e., the sub-version number difference data), and uses it as the target differential data. For example, if the client's current version number is "2.1.1" and the target version number is "2.3.2", the server selects the difference data between sub-version "2.1.1" and sub-version "2.3.2" from the second differential data as the target differential data.

[0064] If the client's current major version number and the target major version number are different, it means that the client needs to perform cross-major version synchronization, that is, synchronize the major version first and then the sub-version. At this time, the server first determines the version span between the client's current major version number and the target major version number, that is, the difference between the two major version numbers.

[0065] Then, according to the version span, the server determines the difference data between the client's current major version number and the target major version number in the first differential data (i.e., the major version number difference data), and uses it as the first part of the target differential data. For example, if the client's current version number is "1.3.2" and the target version number is "3.1.1", the version span is 2, and the server selects the difference data between major version "1" and major version "3" from the first differential data as the first part of the target differential data.

[0066] Next, the server determines the difference data between the initial sub-version number and the target sub-version number at the target major version number level in the second differential data, and uses it as the second part of the target differential data. Among them, the initial sub-version number is the smallest sub-version number at the target major version number level, usually "0.0.0" or "0.0", etc. Continuing with the above example, the server selects the difference data between sub-version "3.0.0" and sub-version "3.1.1" from the second differential data as the second part of the target differential data. Finally, the server combines the first part and the second part of the target differential data to obtain the complete target differential data.

[0067] For example, assume that the current version number of the client is "1.2.3" and the target version number is "2.1.1". The server first determines that the current major version number "1" is different from the target major version number "2", and cross-major version synchronization is required. Then, the server determines that the version span is 1, and selects the difference data between major version "1" and major version "2" from the first differential data as the first part of the target differential data. Next, the server selects the difference data between sub-version "2.0.0" and sub-version "2.1.1" from the second differential data as the second part of the target differential data. Finally, the server merges these two parts of difference data to obtain the complete target differential data required for the client to synchronize from version "1.2.3" to version "2.1.1".

[0068] Step S106: Send the target differential data to the client so that the client can merge the target differential data with the original data to generate a rule data set corresponding to the target version number, where the original data is the rule data set corresponding to the current version number.

[0069] In step S106, sending the target differential data to the client specifically includes: obtaining the data volume size of the target differential data; if the data volume size is greater than or equal to a preset threshold, using a first compression algorithm to compress the target differential data to obtain the compressed target differential data, and sending the compressed target differential data to the client; if the data volume size is less than the preset threshold, using a second compression algorithm to compress the target differential data to obtain the compressed target differential data, and sending the compressed target differential data to the client, where the compression rate of the first compression algorithm is higher than that of the second compression algorithm.

[0070] Specifically, the server sends the determined target differential data to the client so that the client can merge the target differential data with the rule data set of the current version to generate a rule data set of the target version. To improve the efficiency and security of data transmission, before sending the target differential data, the server compresses the target differential data using different compression algorithms according to the data volume size, thereby reducing the volume and time of data transmission, and at the same time reducing the risk of the data being intercepted or tampered with in the network.

[0071] First, the server obtains the data volume size of the target differential data, that is, the number of bytes or megabytes of the target differential data, etc. Then, the server compares the data volume size of the target differential data with a preset threshold. The preset threshold is a data volume limit set according to factors such as network bandwidth and data security requirements, and is used to determine which compression algorithm to adopt. If the data volume size of the target differential data is greater than or equal to the preset threshold, it indicates that the data volume is large, the transmission time is long, and the data security risk is high. At this time, the server uses the first compression algorithm to compress the target differential data. The first compression algorithm is an algorithm with a high compression ratio, such as ZIP, RAR, etc., which can compress a large amount of data into a smaller volume, reducing the data transmission time and traffic. After the server compresses the target differential data, it obtains the compressed target differential data and then sends it to the client.

[0072] If the data volume size of the target differential data is less than the preset threshold, it indicates that the data volume is small, the transmission time is short, and the data security risk is low. At this time, the server uses the second compression algorithm to compress the target differential data. The second compression algorithm is an algorithm with a lower compression ratio but a faster compression speed, such as GZIP, LZO, etc., which can complete data compression in a shorter time and improve the data transmission efficiency. After the server compresses the target differential data, it obtains the compressed target differential data and then sends it to the client.

[0073] It should be noted that the compression ratio of the first compression algorithm is usually higher than that of the second compression algorithm, that is, the first compression algorithm can compress the data into a smaller volume. However, the compression time of the first compression algorithm is usually also longer than that of the second compression algorithm. Therefore, a trade-off needs to be made between the data volume size and the compression efficiency.

[0074] For example, assume the preset threshold is 10MB. If the size of the target differential data is 15MB, the server uses the first compression algorithm (such as ZIP) to compress it to 3MB and then sends the compressed data to the client. If the size of the target differential data is 5MB, the server uses the second compression algorithm (such as GZIP) to compress it to 2MB and then sends the compressed data to the client.

[0075] After step S106, the method further includes: receiving the differential data merging result sent by the client, where the differential data merging result includes a merge success status and a merge failure status; if the differential data merging result is a merge failure status, sending the target rule data set corresponding to the target version number to the client so that the client can use the target rule data set to replace the original data.

[0076] Specifically, after the server sends the target differential data to the client, the method further includes some subsequent processing steps to ensure that the client can successfully merge the target differential data with the original data to generate a rule data set of the target version. The server determines whether the merge is successful by receiving the differential data merge result sent by the client, and takes corresponding measures according to the merge result to ensure that the rule data set of the client can be correctly updated to the target version.

[0077] First, the server receives the differential data merge result sent by the client. The differential data merge result includes two states: the merge success state and the merge failure state. The merge success state indicates that the client has successfully merged the target differential data with the original data to generate a rule data set of the target version. The merge failure state indicates that the client has encountered an error or exception during the merge process and cannot successfully generate a rule data set of the target version. The server determines whether the merge is successful based on the received differential data merge result.

[0078] If the differential data merge result is the merge success state, it means that the client has successfully completed the update of the rule data set, and the server does not need to perform any additional operations and can directly enter the next processing flow. If the differential data merge result is the merge failure state, it means that the client has encountered a problem during the merge process and cannot generate a rule data set of the target version through the target differential data. At this time, in order to ensure that the rule data set of the client can be correctly updated to the target version, the server needs to take remedial measures.

[0079] Specifically, the server sends the complete target rule data set corresponding to the target version number to the client, rather than the target differential data. The target rule data set is the complete rule data set of the target version and contains all the rule data of the target version. By sending the target rule data set, the server enables the client to directly use the target rule data set to replace the original rule data set, thereby quickly updating the rule data set of the client to the target version and avoiding the version inconsistency problem caused by the merge failure.

[0080] Refer to Figure 2, this application also provides a differential data synchronization device based on hierarchical version control. This device is a server, and the server includes a version number acquisition module 201, a version number division module 202, a differential data calculation module 203, and a differential data sending module 204, where: The version number acquisition module 201 is used to acquire the version number of the rule data set. The rule data set includes a virus definition library, a DNS rule set, and a firewall rule; The version number division module 202 is used to divide the version number into multiple major version numbers and multiple minor version numbers. Among them, the minor version number is the version number under each major version number level. There is one or more minor version numbers under the level of one major version number; The differential data calculation module 203 is used to calculate the difference data between the first major version number and the second major version number to obtain the first differential data, and calculate the difference data between the first minor version number and the second minor version number to obtain the second differential data. The first major version number and the second major version number are any two major version numbers among the multiple major version numbers, and the first minor version number and the second minor version number are any two third minor version numbers among the multiple third minor version numbers. The third minor version number is the minor version number under the level of the first major version number; The version number acquisition module 201 is also used to acquire the current version number from the client and compare the difference between the current version number and the target version number. The target version number is the version number that the client needs to synchronize to; The differential data calculation module 203 is also used to determine the target differential data from the first differential data and the second differential data according to the difference; The differential data sending module 204 is used to send the target differential data to the client, so that the client can merge the target differential data with the original data to generate a rule data set corresponding to the target version number. The original data is the rule data set corresponding to the current version number.

[0081] In a possible implementation manner, the differential data calculation module 203 calculates the difference data between the first major version number and the second major version number to obtain the first differential data, specifically including: The differential data calculation module 203 acquires the first major version data corresponding to the first major version number and the second major version data corresponding to the second major version number; The differential data calculation module 203 compares the difference between the first major version data and the second major version data to generate the first differential data. The first differential data includes the new data, modified data, and deleted data of the second major version data relative to the first major version data.

[0082] In a possible implementation, the version number division module 202 divides the version number into multiple major version numbers and multiple minor version numbers, specifically including: the version number division module 202 divides the version number into multiple digital segments according to a preset rule; the version number division module 202 uses the first digital segment as the major version number, and sequentially uses the second digital segment as the minor version numbers under each major version number level in a preset order. The first digital segment is a digital segment with a preset length after dividing the version number according to the preset rule, and the second digital segment is the digital segments other than the first digital segment among the multiple digital segments; the version number division module 202 establishes a version number index table according to the major version number and the minor version number. The version number index table records the correspondence between each major version number and one or more minor version numbers under each major version number level.

[0083] In a possible implementation, the version number acquisition module 201 acquires the current version number from the client and compares the differences between the current version number and the target version number, specifically including: the version number acquisition module 201 receives a version query request sent by the client, and the version query request carries the current version number of the client; the version number acquisition module 201 parses the version query request to obtain the current version number, and extracts the current major version number and the current minor version number corresponding to the current version number from the current version number according to a preset rule; the version number acquisition module 201 acquires the target version number, and extracts the target major version number and the target minor version number corresponding to the target version number from the target version number according to a preset rule; the version number acquisition module 201 determines whether the current major version number is consistent with the target major version number; if the version number acquisition module 201 determines that the current major version number and the target major version number are consistent, it compares the current minor version number with the target minor version number to obtain the range of minor version numbers that need to be synchronized; if the version number acquisition module 201 determines that the current major version number and the target major version number are inconsistent, it determines that the client needs to perform cross-major version synchronization, and obtains the range of major version numbers that need to be synchronized and the range of minor version numbers that need to be synchronized within each major version; the version number acquisition module 201 determines the target differential data corresponding to the difference according to the range of major version numbers and the range of minor version numbers.

[0084] In a possible implementation manner, the differential data calculation module 203 determines target differential data from the first differential data and the second differential data according to the difference. Specifically, it includes: If the difference indicates that the current major version number is the same as the target major version number, the differential data calculation module 203 determines the difference data between the current minor version number and the target minor version number in the second differential data as the target differential data; If the difference indicates that the current major version number is different from the target major version number, the differential data calculation module 203 determines the version span between the current major version number and the target major version number; The differential data calculation module 203 determines the difference data between the current major version number and the target major version number in the first differential data as the first part of the target differential data according to the version span; The differential data calculation module 203 determines the difference data between the initial minor version number and the target minor version number at the target major version number level in the second differential data as the second part of the target differential data, where the initial minor version number is the smallest minor version number at the target major version number level; The differential data calculation module 203 combines the first part of the target differential data with the second part of the target differential data to obtain the target differential data.

[0085] In a possible implementation manner, the differential data sending module 204 sends the target differential data to the client. Specifically, it includes: The differential data sending module 204 obtains the data volume size of the target differential data; If the data volume size is greater than or equal to the preset threshold, the differential data sending module 204 compresses the target differential data using the first compression algorithm to obtain the compressed target differential data, and sends the compressed target differential data to the client; If the data volume size is less than the preset threshold, the differential data sending module 204 compresses the target differential data using the second compression algorithm to obtain the compressed target differential data, and sends the compressed target differential data to the client. The compression rate of the first compression algorithm is higher than that of the second compression algorithm.

[0086] In a possible implementation manner, after the differential data sending module 204 sends the target differential data to the client, the method further includes: The differential data sending module 204 receives the differential data merging result sent by the client. The differential data merging result includes a merge success status and a merge failure status; If the differential data merging result is a merge failure status, the differential data sending module 204 sends the target rule data set corresponding to the target version number to the client, so that the client can use the target rule data set to replace the original data.

[0087] It should be noted that when the device provided in the above embodiments realizes its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.

[0088] This application also provides an electronic device. Referring to Figure 3 , Figure 3 FIG. is a schematic structural diagram of an electronic device provided in an embodiment of this application. The electronic device 300 may include: at least one processor 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.

[0089] Among them, the communication bus 302 is used to realize the connection and communication between these components.

[0090] Among them, the user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may further include a standard wired interface and a wireless interface.

[0091] Among them, the network interface 304 may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface).

[0092] Among them, the processor 301 may include one or more processing cores. The processor 301 connects various parts within the entire server through various interfaces and lines, and executes various functions of the server and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and by calling the data stored in the memory 305. Optionally, the processor 301 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 301 may integrate a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 301 and may be implemented separately by a single chip.

[0093] Among them, the memory 305 may include random access memory (RAM) and may also include read-only memory. Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store the data involved in the above-mentioned method embodiments. Optionally, the memory 305 may further be at least one storage device located far from the aforementioned processor 301. Refer to Figure 3 , as a computer storage medium, the memory 305 may include an operating system, a network communication module, a user interface module, and an application program based on the differential data synchronization method of hierarchical version control.

[0094] In Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an interface for the user to input and obtain the data input by the user; and the processor 301 can be used to call the application program stored in the memory 305 that stores the differential data synchronization method based on hierarchical version control. When executed by one or more processors 301, the electronic device 300 is caused to execute one or more of the methods as described in the above embodiments. It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be adopted in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0095] This application also provides a computer-readable storage medium storing instructions. When executed by one or more processors 301, the electronic device 300 is caused to execute one or more of the methods as described in the above embodiments.

[0096] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0097] In several implementation manners provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some service interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

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

[0099] In addition, in each embodiment of this application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0100] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The aforementioned memory includes various media that can store program codes, such as USB flash drives, mobile hard disks, magnetic disks, or optical discs.

[0101] The above are only exemplary embodiments of the present disclosure, and the scope of the present disclosure cannot be limited thereby. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure still fall within the scope covered by the present disclosure. After considering the specification and the disclosure of the practical truth, those skilled in the art will easily think of other implementation schemes of the present disclosure.

[0102] The present application aims to cover any variations, uses, or adaptive changes of the present disclosure. These variations, uses, or adaptive changes follow the general principles of the present disclosure and include the common general knowledge or conventional technical means in the technical field not recorded in the present disclosure. The specification and the embodiments are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A differential data synchronization method based on hierarchical version control, characterized in that The method includes: Obtaining the version number of a rules dataset, where the rules dataset includes a virus definition library, a DNS rule set, and firewall rules; Dividing the version number into multiple major version numbers and multiple minor version numbers, where the minor version numbers are the version numbers under each major version number level, and one major version number level includes one or more of the minor version numbers; Calculating the difference data between a first major version number and a second major version number to obtain first differential data, and calculating the difference data between a first minor version number and a second minor version number to obtain second differential data, where the first major version number and the second major version number are any two of the multiple major version numbers, and the first minor version number and the second minor version number are any two of the multiple third minor version numbers, and the third minor version number is the minor version number under the first major version number level; Obtaining the current version number from a client, and comparing the difference between the current version number and a target version number, where the target version number is the version number that the client needs to synchronize to; Determining target differential data from the first differential data and the second differential data according to the difference; Sending the target differential data to the client, so that the client merges the target differential data with the original data to generate the rules dataset corresponding to the target version number, where the original data is the rules dataset corresponding to the current version number.

2. The method according to claim 1, wherein The calculating the difference data between a first major version number and a second major version number to obtain first differential data specifically includes: Obtaining first major version data corresponding to the first major version number and second major version data corresponding to the second major version number; Comparing the difference between the first major version data and the second major version data to generate the first differential data, where the first differential data includes the newly added data, modified data, and deleted data of the second major version data relative to the first major version data.

3. The method according to claim 1, characterized in that The dividing the version number into multiple major version numbers and multiple minor version numbers specifically includes: Dividing the version number into multiple digital segments according to a preset rule; Taking the first digital segment as the major version number, and taking the second digital segment as the minor version numbers under each major version number level in a preset order, where the first digital segment is a digital segment with a preset length after dividing the version number according to the preset rule, and the second digital segment is the digital segments other than the first digital segment among the multiple digital segments; Establishing a version number index table according to the major version number and the minor version number, where the version number index table records the corresponding relationship between each major version number and one or more minor version numbers under each major version number level.

4. The method according to claim 1, wherein The obtaining the current version number from a client, and comparing the difference between the current version number and a target version number specifically includes: Receiving a version query request sent by the client, where the version query request carries the current version number of the client; Parse the version query request to obtain the current version number, and extract the current major version number and the current minor version number corresponding to the current version number from the current version number according to a preset rule; Obtain the target version number, and extract the target major version number and the target minor version number corresponding to the target version number from the target version number according to the preset rule; Determine whether the current major version number is the same as the target major version number; If it is determined that the current major version number is the same as the target major version number, then compare the current minor version number with the target minor version number to obtain the range of minor version numbers that need to be synchronized; If it is determined that the current major version number is different from the target major version number, then determine that the client needs to perform cross-major version synchronization, and obtain the range of major version numbers that need to be synchronized and the range of minor version numbers that need to be synchronized within each major version; Determine the target differential data corresponding to the difference according to the range of major version numbers and the range of minor version numbers; 5. The method according to claim 4, wherein The determining the target differential data from the first differential data and the second differential data according to the difference specifically includes: If the difference indicates that the current major version number is the same as the target major version number, then determine the difference data between the current minor version number and the target minor version number in the second differential data as the target differential data; If the difference indicates that the current major version number is different from the target major version number, then determine the version span between the current major version number and the target major version number; According to the version span, determine the difference data between the current major version number and the target major version number in the first differential data as the first part of the target differential data; Determine the difference data between the initial minor version number at the target major version number level and the target minor version number in the second differential data as the second part of the target differential data, where the initial minor version number is the smallest minor version number at the target major version number level; Merge the first part of the target differential data with the second part of the target differential data to obtain the target differential data; 6. The method according to claim 1, characterized in that, The sending the target differential data to the client specifically includes: Obtain the data volume size of the target differential data; If the data volume size is greater than or equal to a preset threshold, then perform data compression on the target differential data using a first compression algorithm to obtain the compressed target differential data, and send the compressed target differential data to the client; If the data volume size is less than the preset threshold, then perform data compression on the target differential data using a second compression algorithm to obtain the compressed target differential data, and send the compressed target differential data to the client, where the compression rate of the first compression algorithm is higher than the compression rate of the second compression algorithm; 7. The method according to claim 1, characterized in that, After sending the target differential data to the client, the method further includes: Receive the differential data merging result sent by the client, where the differential data merging result includes a merge success status and a merge failure status; If the differential data merging result is a merging failure state, send the target rule data set corresponding to the target version number to the client, so that the client can use the target rule data set to replace the original data.

8. Differential data synchronization device based on hierarchical version control, characterized in that, The device includes a version number acquisition module (201), a version number division module (202), a differential data calculation module (203), and a differential data sending module (204), where: The version number acquisition module (201) is configured to acquire the version number of the rule data set, and the rule data set includes a virus definition library, a DNS rule set, and a firewall rule; The version number division module (202) is configured to divide the version number into a plurality of major version numbers and a plurality of minor version numbers, where the minor version numbers are the version numbers under each major version number level, and one major version number level includes one or more of the minor version numbers; The differential data calculation module (203) is configured to calculate the difference data between a first major version number and a second major version number to obtain first differential data, and calculate the difference data between a first minor version number and a second minor version number to obtain second differential data, where the first major version number and the second major version number are any two major version numbers among the plurality of major version numbers, and the first minor version number and the second minor version number are any two third minor version numbers among the plurality of third minor version numbers, and the third minor version numbers are the minor version numbers under the first major version number level; The version number acquisition module (201) is further configured to acquire the current version number from the client, and compare the difference between the current version number and the target version number, where the target version number is the version number that the client needs to synchronize to; The differential data calculation module (203) is further configured to determine target differential data from the first differential data and the second differential data according to the difference; The differential data sending module (204) is configured to send the target differential data to the client, so that the client can merge the target differential data with the original data to generate the rule data set corresponding to the target version number, and the original data is the rule data set corresponding to the current version number.

9. An electronic device, characterized in that, It includes a processor (301), a memory (305), a user interface (303), and a network interface (304). The memory (305) is used to store instructions. The user interface (303) and the network interface (304) are used to communicate with other devices. The processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1-7 is executed.