A data synchronization method, apparatus, transmitting device, and storage medium

By traversing the Redis database and converting it into a network byte sequence through the sending device of the data synchronization device, the data synchronization problem in the isolated device environment is solved, and data synchronization between the two ends of the isolated device is realized.

CN116489173BActive Publication Date: 2026-01-30XEMC WINDPOWER CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310617852.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-29
Publication Date
2026-01-30
Estimated Expiration
2043-05-29

AI Technical Summary

Technical Problem

In a network environment dominated by isolation devices, existing technologies cannot achieve data synchronization between devices at both ends of the isolation device.

Method used

The sending device, through the data synchronization device, recursively traverses the data in the Redis database, converts it into a network byte sequence, determines the sending order, and sends it to the isolation device. The isolation device then forwards it to the receiving device, which deserializes and stores it.

Benefits of technology

This enables data synchronization between devices at both ends of the isolation device in a network environment controlled by the isolation device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116489173B_ABST
    Figure CN116489173B_ABST
Patent Text Reader

Abstract

This application provides a data synchronization method, apparatus, sending device, and storage medium, relating to the field of data processing technology. The method includes: a sending device, based on a data synchronization apparatus, recursively traverses data in a Redis database to obtain multiple data to be synchronized; converts each data to be synchronized into a network byte sequence; determines the sending order of each network byte sequence to obtain a target network byte sequence string; and sends the target network byte sequence string to an isolation device. The sending device includes a Redis database. The isolation device receives the target network byte sequence string and forwards it to a receiving device. The receiving device receives the target network byte sequence string, deserializes it, and stores it. This enables data synchronization between devices at both ends of the isolation device in a network environment controlled by the isolation device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a data synchronization method, apparatus, transmitting device, and storage medium. Background Technology

[0002] Isolation devices, through physical isolation, strictly control the data flow between the two networks at their ends. No link can be established between the two isolated networks; data can only be transmitted unidirectionally through the isolation device, and any reverse data packets are discarded. While controlling network flow and ensuring data security, isolation devices also impose limitations on network throughput and interactivity.

[0003] In a network environment dominated by isolation devices, no cross-isolation interaction mechanism can function effectively. Therefore, existing technologies cannot achieve data synchronization between devices at both ends of an isolation device in a network environment dominated by isolation devices. Summary of the Invention

[0004] The purpose of this application is to provide a data synchronization method, apparatus, transmitting device, and storage medium, which enables data synchronization between devices at both ends of an isolation device in a network environment controlled by an isolation device.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:

[0006] In a first aspect, embodiments of this application provide a data synchronization method applied to a data synchronization device, the data synchronization device including a receiving device, an isolation device, and a transmitting device, the method comprising:

[0007] The sending device recursively traverses the data in the Redis database to obtain multiple data to be synchronized, converts each data to be synchronized into a network byte sequence, determines the sending order of each network byte sequence, obtains a target network byte sequence string, and sends the target network byte sequence string to the isolation device; wherein, the sending device includes a Redis database;

[0008] The isolation device receives the target network byte sequence string and forwards the target network byte sequence string to the receiving device;

[0009] The receiving device receives the target network byte sequence string, deserializes the target network byte sequence string, and stores it.

[0010] In an optional implementation, the step of the sending device recursively traversing the data in the Redis database to obtain multiple data to be synchronized includes:

[0011] Retrieve the key-value pairs corresponding to the basic unit data of each level in the Redis database; wherein, the data in the Redis database is stored in a hierarchical manner;

[0012] Retrieve key-value pairs corresponding to nested data of different levels in the Redis data;

[0013] The key-value pairs corresponding to each of the basic unit data and the key-value pairs corresponding to each of the nested data are used as multiple data to be synchronized.

[0014] In an optional implementation, the step of converting each of the data to be synchronized into a network byte sequence includes:

[0015] For each key-value pair corresponding to the basic unit data, determine the first type of the key-value pair corresponding to the basic unit data;

[0016] Based on the first type, a first preset value of a first preset number is added to the header bytes of the key-value pairs of the basic unit data to obtain serialized basic unit data, wherein different first types correspond to different first preset values ​​of a first preset number;

[0017] For each key-value pair of nested data, determine the second type and level of the key-value pair corresponding to the nested data;

[0018] Based on the second type, a second preset number of second preset values ​​are added to the header bytes of the key-value pairs of the nested data, and based on the level, a third preset number of third preset values ​​are added to the end of the key-value pairs of the nested data. Different second types correspond to different second preset numbers of second preset values, and different levels correspond to different third preset numbers of third preset values, thus obtaining serialized nested data.

[0019] In an optional implementation, the step of determining the transmission order of each of the network byte sequences to obtain the target network byte sequence string includes:

[0020] The network byte sequences are pushed onto a stack to obtain the sending order of the network byte sequences;

[0021] Based on the sending order, the target byte sequence string is obtained.

[0022] In an optional implementation, the step of determining the transmission order of each of the network byte sequences to obtain the target network byte sequence string includes:

[0023] The sending order of each network byte sequence is obtained by performing binary sort on each network byte sequence;

[0024] Based on the sending order, the target byte sequence string is obtained.

[0025] In an optional implementation, the step of receiving the target network byte sequence string, deserializing the target network byte sequence string, and storing it includes:

[0026] The receiving device receives the target network byte sequence string;

[0027] Determine each network byte sequence in the target byte sequence string;

[0028] For each of the aforementioned network byte sequences, determine the header byte and the tail byte in the network byte sequence;

[0029] Based on the header bytes and the tail bytes, determine the type and level corresponding to the network byte sequence;

[0030] Based on the type and the level, reconstruct the data structure of each network byte sequence;

[0031] Each of the aforementioned data structures is stored.

[0032] In an optional implementation, the method further includes:

[0033] The isolation device receives debugging operations on the operating parameters;

[0034] Based on the debugging operation, the bandwidth of the operating parameters of the isolation device is set to the target bandwidth, wherein the target bandwidth is greater than the product of the data to be synchronized and the synchronization frequency.

[0035] Secondly, embodiments of this application provide a data synchronization device, which includes a receiving device, an isolation device, and a transmitting device;

[0036] The sending device is used to recursively traverse the data in the Redis database to obtain multiple data to be synchronized, convert each of the data to be synchronized into a network byte sequence, determine the sending order of each of the network byte sequences, obtain a target network byte sequence string, and send the target network byte sequence string to the isolation device. The sending device includes the Redis database.

[0037] The isolation device is used to receive the target network byte sequence string and forward the target network byte sequence string to the receiving device;

[0038] The receiving device is used to receive the target network byte sequence string, deserialize the target network byte sequence string, and then store it.

[0039] Thirdly, embodiments of this application provide a transmitting device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data synchronization method.

[0040] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data synchronization method.

[0041] This application has the following beneficial effects:

[0042] This application utilizes a sending device based on a data synchronization device to recursively traverse data in a Redis database, obtaining multiple data sets to be synchronized. Each set of data is converted into a network byte sequence, the sending order of these sequences is determined, and a target network byte sequence string is obtained. This target network byte sequence string is then sent to an isolation device. The sending device includes the Redis database. The isolation device receives the target network byte sequence string and forwards it to a receiving device. The receiving device receives the target network byte sequence string, deserializes it, and stores it. This enables data synchronization between devices at both ends of the isolation device within a network environment controlled by the isolation device. Attached Figure Description

[0043] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A block diagram of a transmitting device provided in an embodiment of this application;

[0045] Figure 2 One of the flowcharts of a data synchronization method provided in this application embodiment;

[0046] Figure 3 A second schematic flowchart illustrating a data synchronization method provided in an embodiment of this application;

[0047] Figure 4 The third schematic flowchart of a data synchronization method provided in this application embodiment;

[0048] Figure 5 The fourth flowchart illustrates a data synchronization method provided in this application embodiment;

[0049] Figure 6Fifth of a flowchart illustrating a data synchronization method provided in an embodiment of this application;

[0050] Figure 7 This is a structural block diagram of a data synchronization device provided in an embodiment of this application. Detailed Implementation

[0051] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0052] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0053] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0054] In the description of this application, it should be noted that if terms such as "upper," "lower," "inner," or "outer" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of the invention is usually placed during use, they are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.

[0055] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0056] In the description of this application, it should also be noted that, unless otherwise expressly specified and limited, the terms "set up," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0057] Through extensive research, the inventors discovered that the isolation device, through physical isolation, strictly controls the data flow between the two networks. No link can be established between the two isolated networks; data can only be transmitted unidirectionally through the isolation device, and any reverse data packets are discarded. While controlling network flow and ensuring data security, the isolation device also imposes limitations on network throughput and interactivity.

[0058] In a network environment dominated by isolation devices, no cross-isolation interaction mechanism can function effectively. Therefore, existing technologies cannot achieve data synchronization between devices at both ends of an isolation device in a network environment dominated by isolation devices.

[0059] In view of the above-mentioned problems, this embodiment provides a data synchronization method, apparatus, sending device, and storage medium. It enables the sending device, based on the data synchronization apparatus, to recursively traverse data in a Redis database to obtain multiple data to be synchronized. Each data to be synchronized is converted into a network byte sequence, the sending order of each network byte sequence is determined, and a target network byte sequence string is obtained. This target network byte sequence string is then sent to an isolation device. The sending device includes a Redis database. The isolation device receives the target network byte sequence string and forwards it to a receiving device. The receiving device receives the target network byte sequence string, deserializes it, and stores it. This enables data synchronization between devices at both ends of the isolation device in a network environment controlled by the isolation device. The solution provided in this embodiment is described in detail below.

[0060] This embodiment provides a data transmission device capable of synchronizing data. In one possible implementation, the transmission device can be a user terminal, such as, but not limited to, a server, smartphone, personal computer (PC), tablet computer, personal digital assistant (PDA), mobile internet device (MID), etc.

[0061] Please refer to Figure 1 , Figure 1 This is a schematic diagram of the structure of the transmitting device 100 provided in an embodiment of this application. The transmitting device 100 may further include a... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.

[0062] The transmitting device 100 includes a data synchronization device 110, a memory 120, and a processor 130.

[0063] The components of the memory 120 and processor 130 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The data synchronization device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware or embedded in the operating system (OS) of the transmitting device 100. The processor 130 is used to execute executable modules stored in the memory 120, such as the software function modules and computer programs included in the data synchronization device 110.

[0064] The memory 120 may be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory 120 is used to store programs, and the processor 130 executes the programs after receiving execution instructions.

[0065] Please refer to Figure 2 , Figure 2 For application Figure 1 The following is a flowchart of a data synchronization method for a transmitting device 100, and the method includes a detailed description of each step.

[0066] This method is applied to a data synchronization device, which includes a receiving device, an isolation device, and a transmitting device.

[0067] Step 201: The sending device recursively traverses the data in the Redis database to obtain multiple data to be synchronized, converts each data to be synchronized into a network byte sequence, determines the sending order of each network byte sequence, obtains the target network byte sequence string, and sends the target network byte sequence string to the isolation device.

[0068] The sending device includes a Redis database.

[0069] Step 202: The isolation device receives the target network byte sequence string and forwards it to the receiving device.

[0070] Step 203: The receiving device receives the target network byte sequence string, deserializes the target network byte sequence string, and stores it.

[0071] The above data synchronization method, in a network environment controlled by the isolation device, synchronizes the data in the Redis database of the sending device to the receiving device.

[0072] Because the data volume in the Redis database is large, it is necessary to retrieve the data from the Redis database on the sending device, process it, and then send it to the receiving device so that the receiving device can synchronize the data in the Redis database on the sending device.

[0073] Specifically, the sending device iterates through the data in its Redis database to obtain multiple data to be synchronized. It converts the data to be synchronized into a network byte sequence, processes each network byte into a target network byte sequence string, and sends it to the isolation device. The isolation device forwards the target network byte sequence string to the receiving device. The receiving device deserializes the received target network byte sequence string to obtain the data in the Redis database of the sending device, and stores the deserialized data. This enables the devices at both ends of the isolation device to complete data synchronization in the network environment controlled by the isolation device.

[0074] There are several ways to iterate through the data in a Redis database to obtain multiple sets of data to be synchronized. In one implementation, such as... Figure 3 As shown, it includes the following steps:

[0075] Step 201-1: Obtain the key-value pairs corresponding to the basic unit data of each level in the Redis database.

[0076] In Redis, data is stored in a hierarchical manner.

[0077] Step 201-2: Obtain the key-value pairs corresponding to nested data consisting of different levels in Redis data.

[0078] Step 201-3: Take the key-value pairs corresponding to each basic unit data and the key-value pairs corresponding to each nested data as multiple data to be synchronized.

[0079] For example, a Redis database contains A, B, and C, where A represents the first level of data, B represents the second level, and C represents the third level. Retrieve the basic unit data for each level, where A, B, and C are the basic unit data, and determine the key-value pairs for A, B, and C. Retrieve nested data composed of different levels, i.e., nested data including AB, ABC, and BC. Determine the key-value pairs corresponding to the nested data AB, ABC, and BC.

[0080] The key-value pairs corresponding to the basic unit data of each level obtained from the Redis database, as well as the key-value pairs corresponding to the nested data composed of different levels, will be used as the data to be synchronized.

[0081] There are several ways to convert the data to be synchronized into a network byte sequence. In one implementation, such as... Figure 4 As shown, it includes the following steps:

[0082] Step 201-4: For each key-value pair corresponding to the basic unit data, determine the first type of the key-value pair corresponding to the basic unit data.

[0083] Step 201-5: Based on the first type, add a first preset value of a first preset number to the header bytes of the key-value pairs of the basic unit data to obtain serialized basic unit data.

[0084] Among them, different first types correspond to different first preset quantities of first preset values.

[0085] Step 201-6: For each key-value pair of nested data, determine the second type and level of the key-value pair corresponding to the nested data.

[0086] Step 201-7: Based on the second type, add a second preset number of second preset values ​​to the header bytes of the key-value pairs of the nested data; based on the hierarchy, add a third preset number of third preset values ​​to the end of the key-value pairs of the nested data.

[0087] Different second types correspond to different second preset values ​​with different second preset quantities, and different levels correspond to different third preset values ​​with different third preset quantities, resulting in serialized nested data.

[0088] In one example, for each key-value pair corresponding to each basic unit of data, the data type of each key-value pair is determined, which is the first type. Different first preset values ​​are set for different first preset quantities corresponding to different first types.

[0089] The first preset quantity can be one byte, and the first preset value can be 0.

[0090] That is, by adding a first preset number of first preset values ​​to the header bytes of the key-value pairs of basic unit data, serialized basic unit data is obtained. The type of basic unit data can be determined based on the number of first preset values ​​in the header bytes.

[0091] In another example, serialized basic unit data is obtained by appending a first preset number of first preset values ​​to the end of the key-value pairs of basic unit data. The type of basic unit data can be determined based on the number of first preset values ​​at the end.

[0092] For each key-value pair of nested data, determine the data type of each key-value pair, which is the second type. Set different preset values ​​for different second types, corresponding to different preset quantities.

[0093] In one example, when a first preset value is added to the header byte of the key-value pair of basic unit data to distinguish the first type of the key-value pair of basic unit data, the key-value pair of nested data is also processed by adding a second preset value to the header byte of the key-value pair of nested data to distinguish the second type of the corresponding key-value pair of nested data.

[0094] In another example, when a first preset value is added to the end of the key-value pairs of basic unit data to distinguish the first type of the key-value pairs of basic unit data, the processing method for the key-value pairs corresponding to nested data is also to add a second preset value to the end of the key-value pairs corresponding to nested data to distinguish the second type of the key-value pairs of nested data.

[0095] Furthermore, for each key-value pair of nested data, the hierarchy of each key-value pair is determined, and different third preset values ​​are set for different levels.

[0096] It should be noted that the first, second, and third preset values ​​can all be set to 0.

[0097] Based on the hierarchy of key-value pairs in nested data, a third preset number of third preset values ​​are added to the end of the key-value pairs in the nested data.

[0098] In one example, when the header bytes of the key-value pairs of basic unit data are added with a first preset value to distinguish the first type, and the header bytes of the key-value pairs of nested data are added with a second preset value to distinguish the second type, then a third preset value to distinguish the hierarchy is added to the end of the nested data pairs.

[0099] In another example, when a first preset value for a first preset quantity to distinguish a first type is added to the end of the key-value pairs of basic unit data, and a second preset value for a second preset quantity to distinguish a second type is added to the end of the key-value pairs of nested data, then a third preset value for a third preset quantity to distinguish the hierarchy is added to the head byte of the nested data pairs.

[0100] There are multiple ways to determine the sending order of each network byte sequence and obtain the target network byte sequence string. In one implementation, such as... Figure 5 As shown, it includes the following steps:

[0101] Step 201-8: Push each network byte sequence onto the stack to obtain the sending order of each network byte sequence.

[0102] Step 201-9: Obtain the target byte sequence string based on the sending order.

[0103] After pushing each network byte sequence onto a stack, the sending order of each network byte sequence can be determined based on the last-in-first-out principle of the stack, and the target byte sequence string can be obtained based on the sending order.

[0104] In another example, the network byte sequences are sorted by binary number to obtain the sending order of the network byte sequences, and the target byte sequence string is obtained based on the sending order.

[0105] There are several ways to implement receiving a target network byte sequence string, deserializing it, and then storing it. One such implementation is... Figure 6 As shown, it includes the following steps:

[0106] Step 301: The receiving device receives the target network byte sequence string.

[0107] Step 302: Determine the network byte sequences in the target byte sequence string.

[0108] Step 303: For each network byte sequence, determine the head byte and tail byte in the network byte sequence.

[0109] Step 304: Determine the type and level corresponding to the network byte sequence based on the header and tail bytes.

[0110] Step 305: Based on type and level, restore the data structure of each network byte sequence.

[0111] Step 306: Store each data structure.

[0112] The receiving device deserializes the received target network byte sequence. It then restores the basic unit data and nested data by popping data from the stack.

[0113] For example, based on different preset values ​​corresponding to the different number of header bytes and tail bytes of each network byte sequence in the target network byte sequence string, the type and level of each network byte sequence are deserialized, thereby restoring the key-value combination structure contained in the network byte sequence, as well as the key-value combination structure nested within the value, and storing the deserialized data structures, thereby enabling the receiving device to synchronize the data in the Redis database of the sending device.

[0114] To ensure that the isolation device can forward the target network byte sequence, the isolation device needs to be debugged. The debugging process includes: the isolation device receiving debugging operations on its operating parameters; and based on the debugging operations, setting the bandwidth of the isolation device's operating parameters to the target bandwidth, where the target bandwidth is greater than the product of the data to be synchronized and the synchronization frequency.

[0115] Furthermore, the network address and communication port of the link from the sending device to the isolation device are configured, as well as the network address and communication port of the link from the isolation device to the receiving device, thereby constructing a "one-way data transmission channel" on the isolation device.

[0116] Please refer to Figure 7 This application embodiment also provides a data synchronization device 110110, the data synchronization device 110 comprising:

[0117] It includes a transmitting device 111, an isolation device 112, and a receiving device 113;

[0118] The sending device 111 is used to recursively traverse the data in the Redis database to obtain multiple data to be synchronized, convert each of the data to be synchronized into a network byte sequence, determine the sending order of each of the network byte sequences, obtain a target network byte sequence string, and send the target network byte sequence string to the isolation device. The sending device includes the Redis database.

[0119] The isolation device 112 is used to receive the target network byte sequence string and forward the target network byte sequence string to the receiving device;

[0120] The receiving device 113 is used to receive the target network byte sequence string, deserialize the target network byte sequence string, and then store it.

[0121] This application also provides a transmitting device 100, which includes a processor 130 and a memory 120. The memory 120 stores computer-executable instructions, which, when executed by the processor 130, implement the data synchronization method.

[0122] This application embodiment also provides a storage medium storing a computer program, which, when executed by the processor 130, implements the data synchronization method.

[0123] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0124] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. If the function is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0125] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

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

Claims

1. A data synchronization method, characterized by, The application is applied to a data synchronization device, the data synchronization device comprises a receiving device, an isolation device and a sending device, and the method comprises the following steps: The sending device traverses data in a redis database in a recursive manner to obtain a plurality of to-be-synchronized data, converts each to-be-synchronized data into a network byte sequence, determines a sending order of each network byte sequence, obtains a target network byte sequence string, and sends the target network byte sequence string to the isolation device; wherein the sending device comprises a redis database; The isolation device receives the target network byte sequence string and forwards the target network byte sequence string to the receiving device; The receiving device receives the target network byte sequence string, stores the target network byte sequence string after deserialization; the step of the sending device traversing data in a redis database in a recursive manner to obtain a plurality of to-be-synchronized data comprises the following steps: Obtain a key-value pair corresponding to each basic unit data at each level in the redis database; wherein the data in the redis database is stored in a hierarchical manner; Obtain a key-value pair corresponding to nested data composed of different levels in the redis data; Take each key-value pair corresponding to the basic unit data and each key-value pair corresponding to the nested data as a plurality of to-be-synchronized data; the step of converting each to-be-synchronized data into a network byte sequence comprises the following steps: For each key-value pair corresponding to the basic unit data, determine a first type of the key-value pair corresponding to the basic unit data; Based on the first type, add a first preset number of first preset values to the head byte of the key-value pair of the basic unit data to obtain serialized basic unit data, wherein different first types correspond to different first preset numbers of first preset values; For each key-value pair of the nested data, determine a second type and a level of the key-value pair corresponding to the nested data; Based on the second type, add a second preset number of second preset values to the head byte of the key-value pair of the nested data, and based on the level, add a third preset number of third preset values to the end of the key-value pair of the nested data, wherein different second types correspond to different second preset numbers of second preset values, and different levels correspond to different third preset numbers of third preset values, to obtain serialized nested data.

2. The method of claim 1, wherein, The step of determining the sending order of each network byte sequence to obtain a target network byte sequence string comprises the following steps: Stack processing is performed on each network byte sequence to obtain the sending order of each network byte sequence; Based on the sending order, a target byte sequence string is obtained.

3. The method of claim 1, wherein, The step of determining the sending order of each network byte sequence to obtain a target network byte sequence string comprises the following steps: Binary number sorting is performed on each network byte sequence to obtain the sending order of each network byte sequence; Based on the sending order, a target byte sequence string is obtained.

4. The method of claim 1, wherein, The step of the receiving device receiving the target network byte sequence string and storing the target network byte sequence string after deserialization comprises the following steps: The receiving device receives the target network byte sequence string; determining each network byte sequence in the target byte sequence string; for each network byte sequence, determining a head byte and a tail byte in the network byte sequence; based on the head byte and the tail byte, determining a type and a level corresponding to the network byte sequence; based on the type and the level, restoring a data structure of each network byte sequence; storing each data structure.

5. The method of claim 1, wherein, The method further comprises: The isolation device receives a debugging operation on the running parameter; based on the debugging operation, setting a bandwidth of the running parameter of the isolation device as a target bandwidth, wherein the target bandwidth is greater than a product of the to-be-synchronized data and the synchronization frequency.

6. A data synchronization apparatus, characterized by comprising: The data synchronization device comprises a receiving device, an isolation device, and a sending device; The sending device is configured to traverse data in a redis database in a recursive manner to obtain a plurality of to-be-synchronized data, convert each to-be-synchronized data into a network byte sequence, determine a sending order of each network byte sequence, obtain a target network byte sequence string, and send the target network byte sequence string to the isolation device, wherein the sending device comprises the redis database. The isolation device is configured to receive the target network byte sequence string and forward the target network byte sequence string to the receiving device. The receiving device is configured to receive the target network byte sequence string and store the target network byte sequence string after deserialization. The sending device is specifically configured to: obtain a key-value pair corresponding to each basic unit data of each level in the redis database; wherein the data in the redis database is stored in a hierarchical manner. obtain a key-value pair corresponding to nested data composed of different levels in the redis data; for each key-value pair corresponding to a basic unit data, determine a first type of the key-value pair corresponding to the basic unit data; based on the first type, add a first preset number of first preset values to a head byte of the key-value pair of the basic unit data to obtain a serialized basic unit data, wherein different first types correspond to different first preset numbers of first preset values; for each key-value pair of the nested data, determine a second type and a level of the key-value pair corresponding to the nested data; based on the second type, add a second preset number of second preset values to a head byte of the key-value pair of the nested data, and based on the level, add a third preset number of third preset values to the end of the key-value pair of the nested data, wherein different second types correspond to different second preset numbers of second preset values, and different levels correspond to different third preset numbers of third preset values, to obtain a serialized nested data.

7. A transmitting device, comprising: The computer program is executed by the processor to implement the steps of the method of any one of claims 1-5.

8. A storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Hierarchical synchronization method and system for reverse data under physical isolation condition

    CN110300120A