A structured memory object attribute synchronization method, system and readable storage medium

By using structured memory objects and data modifiers for data synchronization in the C/S architecture, the problems of high complexity and high network resource consumption caused by inconsistent data structures are solved, and efficient and flexible data synchronization is achieved.

CN115617901BActive Publication Date: 2025-10-03SHENGQU INFORMATION TECH SHANGHAI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110803699.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-15
Publication Date
2025-10-03
Estimated Expiration
2041-07-15

AI Technical Summary

Technical Problem

The existing technology has problems in data synchronization in a computer network system with a C/S architecture, such as high complexity caused by inconsistent data structures, large network resource consumption, and poor scalability.

Method used

By customizing structured memory objects between the server and the client, using data modifiers to monitor attribute field modifications, and sending synchronization data in the form of binary blocks, the coupling between data synchronization and operations is reduced, and data serialization tools such as protobuf are used for initialization and expansion.

Benefits of technology

It reduces the workload of program developers, improves work efficiency, and supports the scalability and flexibility of multi-platform data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617901B_ABST
    Figure CN115617901B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for synchronizing the attributes of structured memory objects. The method includes: creating all attribute fields related to system operation in server memory, constructing a structured memory object for synchronization with a client and / or network database, and mounting the same data modifier on the attribute fields of the same structured memory object; when the attribute field of any mounted data modifier is modified, saving its position in the structured memory object corresponding to the mounted data modifier and the modified content in the data modifier as a binary block, and sending the binary block to the corresponding client or network database; the client or network database synchronously modifies the corresponding attribute fields in the local structured memory object based on the received binary block. The technical solution of the present invention implements attribute field synchronization using incremental binary blocks, reducing the coupling between attribute synchronization and operation and the workload of system development, thereby improving synchronization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The technical solution provided by the present invention relates to data synchronization in a computer network system, and in particular to data synchronization in a server-client (C / S) architecture, which can be used for web programming, apps, games, etc. Background Art

[0002] In the prior art, there are generally three methods for data synchronization in a computer network system with a C / S architecture:

[0003] 1. After the client requests the server to perform a data modification operation, the protocol writer determines in advance that certain data may be modified and defines the data that may be modified in the return protocol. The modified data is then returned to the client through the return protocol. The client synchronously modifies the local data based on the content of the received return protocol.

[0004] 2. After the client requests the server to perform a data modification operation, or after the server modifies the data through an update operation, it synchronizes by returning the full data of a certain structure. The client updates the data of the structure in the local memory based on the received full data.

[0005] 3. After the client requests the server to perform a data modification operation, or after the server modifies the data through an update operation, the server sends the modification to the client through a modification list.

[0006] Regarding Technical Solution 1, due to the lack of unified client and server data structures, the client data structure is defined by the client developer, and the server data structure is defined by the server developer. The data structures and attribute field names are named differently, and there is no logical correspondence between the attribute fields. Even if the same data changes, it is likely that notifications will be returned through different protocols. The client needs to write code to modify specific fields in multiple protocol return locations, and the programmer needs to clearly understand which data changes need to be processed for a certain operation. This greatly increases the complexity of program modification and maintenance.

[0007] Regarding the above technical solution 2, although the coupling between data synchronization and operation is reduced, sending the full amount of data consumes a lot of network resources. For example, for a complex data structure, only a small amount of data (such as a byte) may be updated, and the entire structure data (which may be several kilobytes or several megabytes) needs to be synchronized. In order to reduce the number of packets sent, it is usually necessary to split a complex structure into multiple small structures, which also increases the maintenance cost. Every time a data structure is added, the corresponding data structure synchronization code needs to be manually written.

[0008] Regarding Technical Solution 3, the server uses a modification list to return the relevant modified content during data synchronization, which increases scalability to a certain extent. However, it only works with simple structures (which contain basic data such as numerical values ​​and strings). It cannot accommodate complex nested structures or container data. Furthermore, the server needs to manually write the changed data into the list, which increases maintenance complexity. Summary of the Invention

[0009] To address the aforementioned shortcomings of existing data synchronization solutions within computer network systems, the present invention provides a structured memory object attribute synchronization solution. This solution implements incremental data synchronization between the client, network database, and client by customizing structured memory objects for attribute field synchronization between the server, network database, and client. This solution not only reduces the coupling between data synchronization and operations within computer network systems, reducing the workload for program developers and improving work efficiency, but can also be easily expanded to synchronize data between multiple data targets, adapting to different languages ​​and platforms.

[0010] The technical solution provided by the present invention is specifically implemented as follows:

[0011] A method for synchronizing structured memory object attributes comprises: creating all attribute fields related to system operation in server memory, constructing a structured memory object for synchronization with a client and / or a network database, and mounting the same data modifier corresponding to the structured memory object for attribute fields belonging to the same structured memory object; when monitoring modification of the attribute field of any mounted data modifier, saving its position in the structured memory object corresponding to the mounted data modifier and the modified content in a binary block to the mounted data modifier itself; sending the binary block to the corresponding client or network database; and the client or network database synchronously modifying the corresponding attribute fields in the local structured memory object based on the received binary block.

[0012] Furthermore, when any of the attribute fields is monitored for modification, it is determined whether a data modifier has been mounted. If so, the structured memory object is constructed in the server, and the location of the attribute field in the structured memory object corresponding to the data modifier mounted by the server is recursively found. The location of the attribute field in the structured memory object corresponding to the data modifier mounted by the server is saved in the form of a binary block along with the corresponding modified content in the order of modification time. The sending of the binary block to the corresponding client or network database specifically includes: periodically polling all data modifiers, and if the polled data modifier has a binary block saved, sending the binary block saved by the polled data modifier to the corresponding client or network database, and clearing the binary block in the polled data modifier. The client or network database synchronously modifies the corresponding attribute fields in the local structured memory object based on the received binary block, which includes: when the client and / or network database receives the binary block from the corresponding data modifier from the server, it restores the corresponding modification content in the structural form of the corresponding data modifier based on the received binary block, determines the change data corresponding to the specific attribute field based on the restored modification content, and synchronously modifies the specific attribute field in the local structured memory object by calling the corresponding operation interface.

[0013] Furthermore, the method also includes: during the interval between two adjacent packet transmissions of any of the data modifiers, the data modifier saves a unit binary block accordingly for each separate modification; when multiple attribute field modifications occur, multiple unit binary blocks are saved in the form of a binary block list according to the modification order, and the multiple unit binary blocks are combined into a combined binary block through a preset interface; when the client or network database receives the combined binary block sent by the corresponding data modifier, the combined binary block is first parsed into multiple unit binary blocks, and the corresponding modification content is restored in the structural form of the corresponding data modifier based on the unit binary blocks obtained from the parsing; the change data corresponding to the specific attribute field is determined based on the restored modification content, and the specific attribute field in the structured memory object on the local side is synchronously modified by calling the corresponding operation interface.

[0014] Furthermore, the method also includes: the network database generates a structured memory object dbproto and sends it to the server, and the server initializes and constructs a structured memory object for network database synchronization based on the structured memory object dbproto. After the server constructs the structured memory object for network database synchronization, it also constructs a structured memory object netproto and sends the structured memory object netproto to the client; the client initializes the memory structure based on the structured memory object netproto. The attribute fields in the structured memory objects dbproto and netproto are defined by the user and are part of all attribute fields related to the system operation. Preferably, the structured memory object initialization of the server and client is implemented using the data serialization tool protobuf.

[0015] Corresponding to the above method, the present invention also provides a structured memory object attribute synchronization system, which includes: a server, one or more clients, and a network database; the server is used to create all attribute fields related to system operation, construct a structured memory object for synchronization of the client and / or network database, mount the same data modifier corresponding to the structured memory object for the attribute fields belonging to the same structured memory object, and monitor whether all the attribute fields are modified; when it is monitored that the attribute field of any mounted data modifier is modified, its position in the structured memory object corresponding to the mounted data modifier and the modified content are saved in the form of a binary block to the data modifier mounted by itself; the binary block is sent to the corresponding client or network database; the client or network database synchronously modifies the corresponding attribute field in the local structured memory object according to the received binary block.

[0016] Correspondingly, the present invention also provides a computer-readable storage medium having executable code stored thereon, and a computer processor implements the above-mentioned structured memory object attribute synchronization method by executing the executable code. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic diagram of the architecture of the structured memory object attribute synchronization solution provided by the present invention. DETAILED DESCRIPTION

[0018] In order to make the technical problems, technical solutions and beneficial effects solved by the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0019] like Figure 1 As shown, in one embodiment, the structured memory object attribute synchronization method provided by the present invention is applied to a computer system including a server, one or more clients, and a network database.

[0020] The network database generates a structured memory object dbproto and sends it to the server. The server initializes and constructs a structured memory object for network database synchronization based on the structured memory object dbproto. The server creates all attribute fields related to system operation. After the server constructs the structured memory object for network database synchronization, it also constructs a structured memory object netproto and sends the structured memory object netproto to the client. The client initializes the memory structure object based on the structured memory object netproto. The attribute fields in the structured memory objects dbproto and netproto are defined by the user and are part of all attribute fields related to system operation.

[0021] The server mounts the same data modifier corresponding to the structured memory object to the attribute fields belonging to the same structured memory object, and monitors whether all the attribute fields are modified. The visible range of the field or structure can be set to determine the fields contained in different structures. In one embodiment code, the server contains all defined fields, specifically including all attribute fields defined as none, net, db, and both. Among them, the attribute fields that are not visible to the client or the network database are defined as none type; the attribute fields that are visible to both the client and the network database are defined as both type; the attribute fields that are only visible to the client are defined as net type; and the attribute fields that are only visible to the network data are defined as db type. The local structured memory object of the client contains all fields defined as net and both, and accordingly, the structured memory object netproto contains all fields defined as net and both; the attribute fields that the network database needs to obtain synchronously include all fields defined as db and both, and the structured memory object dbproto contains all fields defined as db and both. That is to say, a copy of data in the server memory can be synchronized to two data targets, the client and the network. Different data targets can use different structures (mainly with different field visibility). For the structured memory object netproto used for synchronizing attribute fields with the client, each attribute field is mounted with the same data modifier A. For the structured memory object dbproto used for synchronizing attribute fields with the client, each attribute field is mounted with the same data modifier B.

[0022] When the server detects that any of the attribute fields has been modified, it determines whether a data modifier has been mounted. If so, it traverses the server to construct the structured memory object, recursively finds the location of the attribute field in the structured memory object corresponding to the data modifier mounted by itself, and saves the location of the attribute field in the structured memory object corresponding to the data modifier mounted by itself in the form of a binary block in the order of modification. The sending of the binary block to the corresponding client or network database specifically includes: periodically polling all data modifiers, and if the polled data modifier has a binary block stored, sending the binary block stored by the polled data modifier to the corresponding client or network database, and clearing the binary block in the polled data modifier.

[0023] The client or network database synchronously modifies the corresponding attribute fields in the local structured memory object based on the received binary block, which includes: when the client and / or network database receives the binary block from the corresponding data modifier from the server, it restores the corresponding modification content in the structural form of the corresponding data modifier based on the received binary block, determines the change data corresponding to the specific attribute field based on the restored modification content, and synchronously modifies the specific attribute field in the local structured memory object by calling the relevant operation interface. In addition, if Figure 1 As shown, the client can also be configured to implement corresponding processing by calling a monitoring function when receiving a binary block corresponding to the data modifier on the server.

[0024] Furthermore, during the interval between two adjacent packet transmissions of any data modifier, the data modifier saves a unit binary block accordingly for each separate modification. When multiple attribute field modifications occur, multiple unit binary blocks are saved in the form of a binary block list in the order of modification, and the multiple unit binary blocks are combined into a combined binary block through a preset interface; when the client or network database receives the combined binary block sent by the corresponding data modifier, it first parses the combined binary block into multiple unit binary blocks, and restores the corresponding modification content in the structural form of the corresponding data modifier based on the unit binary blocks obtained from the parsing.

[0025] The structured memory object initialization of the server and client is implemented using a data serialization tool, preferably protobuf. In addition, a custom binary data stream or a serializable and deserializable structure such as json can be used to operate the data stream.

[0026] In the above embodiment of the present invention, the initial data structure is divided into network data netproto and database data dbproto. The visible range of fields and structures can be configured to customize more data visibility ranges. The structured memory objects of the client and server can be generated by data serialization tools according to the configuration, and a variety of data structures can be easily expanded. The technical solution provided by the present invention can be used not only for data synchronization in client / server architectures, but also for data synchronization in other architectures (including between servers, between servers and databases, between servers and files, etc.).

[0027] Correspondingly, the present invention also provides a computer-readable storage medium, on which executable code is stored. A computer processor implements the above-mentioned structured memory object attribute synchronization method by executing the executable code.

[0028] The technical solution provided by the present invention can not only reduce the coupling of data synchronization and operations between computer network systems, reduce the workload of program developers and improve work efficiency; it can also be easily expanded to data synchronization between multiple data targets and adaptively modified according to different languages ​​and platforms.

Claims

1. A structured memory object attribute synchronization method, characterized in that: The method comprises: creating all attribute fields related to system operation in a server memory, constructing a structured memory object for synchronization with a client and / or a network database, and attaching a same data modifier corresponding to the structured memory object to attribute fields belonging to the same structured memory object; When monitoring the modification of the attribute field of any mounted data modifier, the position of the attribute field in the structured memory object corresponding to the mounted data modifier and the modified content are saved in the form of a binary block to the data modifier mounted by itself, which is specifically implemented as follows: when any attribute field is modified, it is determined whether the data modifier has been mounted. If so, the structured memory object is constructed by traversing the server, and the position of the attribute field in the structured memory object corresponding to the data modifier mounted by itself is recursively found, and the position of the attribute field in the structured memory object corresponding to the data modifier mounted by itself is saved together with the corresponding modified content in the form of a binary block in the order of modification time to the data modifier mounted by itself; The binary block is sent to a corresponding client or network database, specifically comprising: periodically polling all data modifiers, and when the polled data modifier stores the binary block, sending the binary block stored by the polled data modifier to the corresponding client or network database, and clearing the binary block in the polled data modifier; The client or network database synchronously modifies the corresponding attribute fields in the local structured memory object based on the received binary block, which includes: when the client and / or network database receives the binary block from the corresponding data modifier from the server, the client and / or network database restores the corresponding modification content in the structural form of the corresponding data modifier based on the received binary block, determines the change data corresponding to the specific attribute field based on the restored modification content, and synchronously modifies the specific attribute field in the structured memory object on the local side by calling the corresponding operation interface.

2. The method according to claim 1, wherein The method further includes: during an interval between two adjacent packet transmissions by any of the data modifiers, any of the data modifiers saves a unit binary block corresponding to each individual modification; when multiple attribute field modifications occur, multiple unit binary blocks are saved in the form of a binary block list in the order of modification, and the multiple unit binary blocks are combined into a combined binary block through a preset interface; when the client or network database receives the combined binary block sent by the corresponding data modifier, the combined binary block is first parsed into multiple unit binary blocks, and the corresponding modified content is restored in the structural form of the corresponding data modifier based on the unit binary blocks obtained from the parsing.

3. The method according to any one of claims 1 to 2, wherein: The method further includes: the network database generates a structured memory object dbproto and sends it to the server, and the server initializes and constructs a structured memory object for network database synchronization based on the structured memory object dbproto; wherein the attribute fields in the structured memory object dbproto are defined by the user and are part of all attribute fields related to system operation.

4. The method according to claim 3, wherein The method also includes: after the server constructs a structured memory object for network database synchronization, it also constructs a structured memory object netproto and sends the structured memory object netproto to the client; the client initializes the memory structure according to the structured memory object netproto; the attribute fields in the structured memory object netproto are defined by the user and are part of all attribute fields related to system operation.

5. The method according to claim 4, wherein The method further includes: initializing the structured memory objects of the server and the client using a data serialization tool protobuf.

6. A structured memory object attribute synchronization system, characterized in that: The system includes: a server, one or more clients, and a network database; The server is used to create all attribute fields related to system operation, construct a structured memory object for synchronization with a client and / or a network database, mount the same data modifier corresponding to the structured memory object to the attribute fields belonging to the same structured memory object, and monitor whether all attribute fields are modified; when any attribute field of a mounted data modifier is modified, save its position in the structured memory object corresponding to the mounted data modifier and the modified content in the form of a binary block to the data modifier mounted by itself, and is specifically implemented as follows: when any attribute field is modified, determine whether a data modifier has been mounted for it, and if so, traverse the server to construct the structured memory object, recursively find the position of the attribute field in the structured memory object corresponding to the data modifier mounted by itself, and save it together with the corresponding modified content in the form of a binary block in the order of modification time to the data modifier mounted by itself; The binary block is sent to a corresponding client or network database, specifically comprising: periodically polling all data modifiers, and when the polled data modifier stores the binary block, sending the binary block stored by the polled data modifier to the corresponding client or network database, and clearing the binary block in the polled data modifier; The client or network database synchronously modifies the corresponding attribute fields in the local structured memory object based on the received binary block, which includes: when the client and / or network database receives the binary block from the corresponding data modifier from the server, it restores the corresponding modification content in the structural form of the corresponding data modifier based on the received binary block, determines the change data corresponding to the specific attribute field based on the restored modification content, and synchronously modifies the specific attribute field in the local structured memory object by calling the corresponding operation interface.

7. The system according to claim 6, wherein: During the interval between two adjacent packet transmissions by any data modifier in the server, the data modifier saves a unit binary block corresponding to each individual modification. When multiple attribute field modifications occur, multiple unit binary blocks are saved in the form of a binary block list in the order of modification, and the multiple unit binary blocks are combined into a combined binary block through a preset interface. When the client or network database receives the combined binary block sent by the corresponding data modifier, it first parses the combined binary block into multiple unit binary blocks, and restores the corresponding modified content in the structural form of the corresponding data modifier based on the unit binary blocks obtained from the parsing.

8. The system according to any one of claims 6 to 7, wherein: The network database generates a structured memory object dbproto and sends it to the server; the server initializes and constructs a structured memory object for network database synchronization based on the structured memory object dbproto; wherein the attribute fields in the structured memory object dbproto are defined by the user and are part of all attribute fields related to system operation.

9. The system according to claim 8, wherein After the server constructs a structured memory object for network database synchronization, it also constructs a structured memory object netproto and sends the structured memory object netproto to the client; the client initializes the memory structure according to the structured memory object netproto; the attribute fields in the structured memory object netproto are defined by the user and are part of all attribute fields related to system operation.

10. The system according to claim 9, wherein: The structured memory object initialization of the server and client is implemented using the data serialization tool protobuf.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores executable code, and the computer processor executes the executable code to implement the structured memory object attribute synchronization method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Distributed file system, computer system, and medium

    CN111290826A