Method, device and computer readable storage medium for multi-tree information serialization and deserialization

The serialization and deserialization of multi-way tree information are completed in a single serialization operation, which solves the problem of low efficiency in multi-way tree information processing in the existing technology and realizes efficient multi-way tree information processing.

CN115408462BActive Publication Date: 2026-05-19QI AN XIN TECHNOLOGY GROUP INC +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QI AN XIN TECHNOLOGY GROUP INC
Filing Date
2022-08-29
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing multi-way tree information serialization and deserialization methods require two operations, resulting in poor processing efficiency.

Method used

By obtaining the attribute information of the target multi-way tree, allocating memory that matches it, and sequentially writing the cache size required for the node serialization result and the total number of nodes into the memory, the node data is then written in traversal order to complete one serialization operation.

Benefits of technology

A serialization method for multi-way tree information is implemented. By obtaining the memory allocation for the attributes of the target multi-way tree and the memory allocation for serializing the attribute information of the target multi-way tree, the required cache size for the serialized result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree are written into memory in sequence. The data of each node of the target multi-way tree is written into the remaining storage space of the memory in traversal order. The serialization of multi-way tree information can be completed by performing only one serialization operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115408462B_ABST
    Figure CN115408462B_ABST
Patent Text Reader

Abstract

The application relates to a multi-ary tree information serialization and deserialization method, device and computer readable storage medium. The method comprises the following steps: obtaining attribute information of a target multi-ary tree; applying for memory conforming to the attribute information of the target multi-ary tree; sequentially writing, into the memory, a required cache size of a serialization result of each node of the target multi-ary tree after serialization and a total node number of the target multi-ary tree; traversing each node of the target multi-ary tree in a preset traversal mode, and writing, into a remaining storage space of the memory, self data of each node of the target multi-ary tree according to a traversal order. The technical scheme can efficiently process multi-ary tree information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer network security, and in particular to methods, devices and computer-readable storage media for serializing and deserializing multi-branch tree information. Background Technology

[0002] Because multi-way trees are relatively complex data structures, their node information cannot be directly stored and / or transmitted. Therefore, special processing is required for multi-way tree information, such as serialization into binary data. When this multi-way tree information is needed, the reverse operation is performed on the specially processed information, such as deserialization, to obtain the original multi-way tree information. In related technologies, multi-way tree information serialization and deserialization methods require first performing a first operation on the multi-way tree information to obtain an intermediate result, and then performing a second operation on this intermediate result to obtain the final processed result. Subsequent use of the multi-way tree information also requires two reverse operations to obtain the original multi-way tree information. In summary, related technologies suffer from poor efficiency in processing multi-way tree information. Summary of the Invention

[0003] To address or partially address the problems existing in related technologies, this application provides a method, apparatus, device, and computer-readable storage medium for serializing and deserializing multi-branch tree information, which can efficiently process multi-branch tree information.

[0004] The first aspect of this application provides a method for serializing multi-way tree information, including:

[0005] Obtain the attribute information of the target multi-way tree, including the length of the data of each node in the target multi-way tree, the total number of nodes in the target multi-way tree, and the cache size required for the serialization result of each node in the target multi-way tree after serialization;

[0006] Request memory that matches the attribute information of the target multi-way tree;

[0007] The required cache size for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree are sequentially written into the memory.

[0008] The target multi-way tree is traversed using a preset traversal method, and the data of each node of the target multi-way tree is written to the remaining storage space of the memory in the traversal order.

[0009] A second aspect of this application provides a method for deserializing multi-way tree information, including:

[0010] Obtain the starting address of the memory, where the memory is the memory allocated when serializing each node of the target multi-way tree and is consistent with the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0011] The root node address of the target multi-way tree is calculated based on the memory starting address, the total number of nodes in the target multi-way tree, the preset storage space, and the cache size required for the serialization result of each node in the target multi-way tree after serialization.

[0012] Based on the root node address of the target multi-way tree and the length of the data of each node in the target multi-way tree, the addresses of each child node of the root node are obtained. The order in which the addresses of each child node of the root node are obtained is the traversal order when the nodes of the target multi-way tree are serialized using a preset traversal method.

[0013] Read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node;

[0014] Based on the data of each child node of the root node, obtain the parent node address and child node address of each child node of the root node;

[0015] Read the parent node and child node data of each child node from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

[0016] A third aspect of this application provides a multi-way tree information serialization apparatus, comprising:

[0017] The first acquisition module is used to acquire the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0018] The application module is used to apply for memory that matches the attribute information of the target multi-way tree;

[0019] The first writing module is used to sequentially write the cache size required for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree to the memory.

[0020] The second writing module is used to traverse each node of the target multi-branch tree in a preset traversal method and write the data of each node of the target multi-branch tree to the remaining storage space of the memory in the traversal order.

[0021] A third aspect of this application provides a multi-way tree information deserialization apparatus, comprising:

[0022] The second acquisition module is used to acquire the memory starting address, wherein the memory is the memory allocated when serializing each node of the target multi-way tree and is consistent with the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0023] The calculation module is used to calculate the root node address of the target multi-way tree based on the memory starting address, the preset storage space based on the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0024] The third acquisition module is used to acquire the addresses of each child node of the root node according to the root node address of the target multi-way tree and the length of the data of each node of the target multi-way tree. The acquisition order of the addresses of each child node of the root node is the traversal order when the nodes of the target multi-way tree are serialized and traversed in a preset traversal method.

[0025] The first reading module is used to read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node;

[0026] The fourth acquisition module is used to acquire the parent node address and child node address of each child node of the root node based on the self-data of each child node of the root node.

[0027] The second reading module is used to read the parent node and the child node's own data from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

[0028] The fifth aspect of this application provides an electronic device, comprising:

[0029] Processor; and

[0030] A memory that stores executable code, which, when executed by the processor, causes the processor to perform the method described above.

[0031] A sixth aspect of this application provides a computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method described above.

[0032] The technical solution provided in this application can include the following beneficial effects: Unlike related technologies that require two serialization operations when serializing multi-way tree information, the technical solution of this application, after obtaining the attribute information of the target multi-way tree and allocating memory that matches the attribute information of the target multi-way tree, sequentially writes the required cache size of the serialized result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree into the memory, and writes the data of each node of the target multi-way tree into the remaining storage space of the memory in traversal order. That is, the technical solution of this application only needs to perform one serialization operation to complete the serialization of multi-way tree information, thus having the advantage of high serialization efficiency.

[0033] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0034] The above and other objects, features and advantages of this application will become more apparent from the following description of exemplary embodiments of this application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components.

[0035] Figure 1 This is a flowchart illustrating a multi-branch tree information serialization method according to an embodiment of this application;

[0036] Figure 2 This is a schematic diagram illustrating the required cache size and the total number of nodes in the target multi-way tree as shown in the embodiments of this application, where the serialized results of each node of the target multi-way tree are sequentially written into memory.

[0037] Figure 3 This is a schematic diagram illustrating the writing of the data of each node of the target multi-way tree into the remaining storage space of the memory in traversal order, as shown in the embodiments of this application.

[0038] Figure 4 This application's embodiments illustrate the sequential writing to the second remaining storage space in memory. Figure 3 A schematic diagram illustrating the direction of offset data in the variable-length data and fixed-length data of each node in the example multi-way tree;

[0039] Figure 5 This is a flowchart illustrating a multi-branch tree information deserialization method according to an embodiment of this application;

[0040] Figure 6 This is a schematic diagram of the structure of a multi-branch tree information serialization device shown in an embodiment of this application;

[0041] Figure 7 This is a schematic diagram of the structure of a multi-branch tree information deserialization device shown in an embodiment of this application;

[0042] Figure 8 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application. Detailed Implementation

[0043] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make this application more thorough and complete, and to fully convey the scope of this application to those skilled in the art.

[0044] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0045] It should be understood that although the terms "first," "second," "third," etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0046] Multi-way trees are relatively complex data structures, and their node information cannot be directly stored and / or transmitted. Therefore, special processing is required for multi-way tree information, such as serialization into binary data. When this multi-way tree information is needed, the reverse operation is performed on the specially processed information, such as deserialization, to obtain the original multi-way tree information. In related technologies, multi-way tree information serialization and deserialization methods require first performing a first operation on the multi-way tree information to obtain an intermediate result, and then performing a second operation on this intermediate result to obtain the final processed result. For example, the multi-way tree is first serialized into an array using serialization tools such as protobuf or JSON, and then the array is serialized into binary data again using the same tools. When the multi-way tree information is needed subsequently, the reverse operation is also required to obtain the original multi-way tree information. In summary, related technologies suffer from poor efficiency in processing multi-way tree information.

[0047] To address the aforementioned issues, this application provides a method for serializing and deserializing multi-branch tree information, which can efficiently process multi-branch tree information.

[0048] The technical solutions of the embodiments of this application are described in detail below with reference to the accompanying drawings.

[0049] See Figure 1 This is a flowchart illustrating a multi-branch tree information serialization method according to an embodiment of this application. The method mainly includes steps S101 to S104, as described below:

[0050] Step S101: Obtain the attribute information of the target multi-way tree, wherein the attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the storage space occupied by the serialized result of each node of the target multi-way tree after serialization.

[0051] In this embodiment, the target multi-way tree is the multi-way tree that needs to be serialized in this embodiment. This multi-way tree can be a binary tree, and a node in the multi-way tree can represent a process. When a node in the multi-way tree can represent a process, if the node has a parent node, then the parent node represents the parent process; if the node has child nodes, then the child nodes represent the child processes. The node information of the multi-way tree mainly includes the node identifier (e.g., process identifier), the identifier of the parent node (e.g., parent process identifier), whether the node is active (e.g., whether it is an active process), the creation time of the node (e.g., process creation time), the storage path of the node (e.g., process path), the offset address of the parent node (e.g., parent process offset address), the number of child nodes of the node, and the offset address of the child node offset address array of the node (e.g., the offset address of the child process offset address array), etc. In the above node information, since the node identifier (denoted as nID in this embodiment), the identifier of the parent node (denoted as PnID in this embodiment), whether the node is active (denoted as Is_active in this embodiment), the creation time of the node (denoted as create_time in this embodiment), the offset address of the parent node, and the number of child nodes of the node occupy a fixed amount of memory, the data in the node information that occupy a fixed amount of memory is defined as fixed-length data of the node. However, since the number of child nodes of the node (denoted as child_count in this embodiment) is variable, and the space required for the child node offset address array is also variable, the offset address of the node's storage path (denoted as offset_path in this embodiment) and the offset address of the node's child node offset address array (denoted as offset_child_node in this embodiment) change at any time. Therefore, the data that changes at any time, such as the number of child nodes of the node, the offset address of the node's storage path, and the offset address of the node's child node offset address array, are defined as variable-length data of the node. It should be noted that the data of each node in the target multi-way tree includes both fixed-length and variable-length data, with the length measured in bytes. Similarly, the storage space occupied by the serialized result of each node in the target multi-way tree is also measured in bytes. Furthermore, the information of a node's parent node includes not only the identifier of that node's parent node but also the identifier of that parent node's parent node, among other information.

[0052] Step S102: Allocate memory that matches the attribute information of the target multi-way tree.

[0053] The purpose of serialization is to store or transmit the target object. Storage is generally required before transmission. Therefore, memory matching the attribute information of the target multi-way tree is allocated as the storage unit for the serialized result. In one embodiment of this application, allocating memory matching the attribute information of the target multi-way tree can be: calculating the target storage space size; using the starting address of the first preset storage space as the starting address of the memory, allocating memory not less than the target storage space size; here, the target storage space size is the sum of the lengths of the first preset storage space, the second preset storage space, and the data of all nodes in the target multi-way tree. The first preset storage space includes memory space pre-allocated for storing the cache size required for the serialized result of each node in the target multi-way tree, and the second preset storage space includes memory space pre-allocated for storing the total number of nodes in the target multi-way tree. It should be noted that the first preset storage space does not refer to the cache size required for storing the serialized result of each node in the target multi-way tree, but rather to the amount of memory space pre-allocated for storing the cache size required for storing the serialized result of each node in the target multi-way tree. For example, the required cache size for the serialized results of each node in the target multi-way tree is 1GB (1024MB). However, to store this 1GB value, only 4 bytes of storage space need to be allocated, instead of 1GB. In the above embodiment, the required cache size for the serialized results of each node in the target multi-way tree is the number of bytes of cache needed to store the serialized results of each node in the target multi-way tree, which is numerically equal to the total number of bytes contained in the serialized results.

[0054] Step S103: Write the required cache size of the serialized result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree into memory in sequence.

[0055] Since the cache size required for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree are written to the memory allocated in step S102 first, and are written sequentially, this means that the cache size required for the serialization result of each node of the target multi-way tree is the data written to memory first, followed by the total number of nodes of the target multi-way tree. As mentioned earlier, assuming the first preset storage space is the memory space pre-allocated for the cache size required to store the serialized results of each node of the target multi-way tree, and the second preset storage space is the memory space pre-allocated for the total number of nodes of the target multi-way tree, then it is equivalent to using the starting address of memory as the starting address of the cache size required to write the serialized results of each node of the target multi-way tree. The address range formed by the starting address of memory and the first preset storage space is the maximum address range in memory that can be used to write the cache size required to write the serialized results of each node of the target multi-way tree. Thereafter, using the above maximum address range as the starting address, the address range formed by the maximum address range and the second preset storage space is the maximum address range in memory that can be used to write the total number of nodes of the target multi-way tree. Let `buffer_size` be the buffer size required for the serialization results of each node of the target multi-way tree, and `node_count` be the total number of nodes in the target multi-way tree. Assuming the first preset storage space is 4 bytes and the second preset storage space is also 4 bytes, then the buffer size required for the serialization results of each node of the target multi-way tree and the total number of nodes in the target multi-way tree are written to memory sequentially as follows: Figure 2 As shown.

[0056] Step S104: Traverse each node of the target multi-way tree using a preset traversal method, and write the data of each node of the target multi-way tree to the remaining storage space in memory according to the traversal order.

[0057] In this embodiment, the preset traversal method can be breadth-first traversal or depth-first traversal. When the target multi-way tree is a binary tree, the preset traversal method can also be preorder traversal, inorder traversal, or postorder traversal. The traversal order is the order in which the nodes of the target multi-way tree are traversed using the preset traversal method. The remaining memory storage space refers to the storage space remaining after the memory allocated in step S102 is used to write the serialized results of the target multi-way tree nodes into the memory allocated in step S102, and after considering the total number of nodes in the target multi-way tree. As mentioned above, the data of each node in the target multi-way tree actually includes both fixed-length and variable-length data. Therefore, writing the data of each node in the target multi-way tree into the remaining memory storage space according to the traversal order actually includes writing both fixed-length and variable-length data into the remaining memory storage space. Specifically, writing the data of each node of the target multi-way tree to the remaining memory space in traversal order can be as follows: Writing fixed-length data of each node of the target multi-way tree to the first remaining memory space obtained in step S102 in traversal order; writing variable-length data of each node of the target multi-way tree to the second remaining memory space obtained in step S102 in traversal order; wherein, the first remaining memory space is the remaining memory space after writing the serialized result of each node of the target multi-way tree to the aforementioned memory in traversal order and the total number of nodes in the target multi-way tree; the second remaining memory space is the remaining memory space after writing fixed-length data of all nodes of the target multi-way tree to the first remaining memory space in traversal order. Figure 3 As shown, taking the target multi-way tree as an example, assuming a breadth-first traversal is used, the traversal order is A→B→C→D→E→F. Therefore, the data of the nodes themselves is stored in the memory obtained through step S102, as shown in the figure. Specifically, as an embodiment of this application, writing the fixed-length data of each node of the target multi-way tree to the first remaining storage space of the memory obtained through step S102 in the traversal order can be as follows: S1: Write the fixed-length data of the root node of the target multi-way tree to the storage space corresponding to the first address of the first remaining storage space; and / or S2: If the root node has child nodes, then in the storage space after writing the fixed-length data of the root node of the target multi-way tree, write the fixed-length data of the child nodes to the memory in the traversal order; and / or S3: If the child node has child nodes, then in the storage space after writing the fixed-length data of the child nodes, write the fixed-length data of the child nodes' child nodes to the memory in the traversal order; repeat S1 to S3 until the fixed-length data of the last child node is written to the memory. Still using Figure 3 Taking the multi-way tree shown as an example, its root node is node A, and the starting address of the first remaining storage space is actually also... Figure 3The diagram shows the starting address of the fixed-length data for a node in a multi-way tree. After writing the fixed-length data of the target multi-way tree root node (node ​​A) to the memory space corresponding to the first address of the first remaining memory space, since node A has child nodes B and C, and the traversal order (breadth-first traversal) is B→C, the memory space after writing the fixed-length data of the target multi-way tree root node A will sequentially write the fixed-length data of child nodes B and C to memory. Child node B has child node D, and child node C has child nodes E and F, and the traversal order (breadth-first traversal) is D→E→F. Therefore, the memory space after writing the fixed-length data of child nodes B and C of the target multi-way tree root node A will sequentially write the fixed-length data of child node D of child node B to memory according to the traversal order. The memory space after writing the fixed-length data of child nodes B, C, and D will sequentially write the fixed-length data of child nodes E and F of child node C to memory according to the traversal order. The following uses the root node A of the target multi-way tree as an example to further illustrate the process of writing fixed-length data to memory. The process of writing fixed-length data of the other nodes of the target multi-way tree to memory is similar to the process of writing fixed-length data of the root node A to memory.

[0058] Specifically, writing fixed-length data of the target multi-way tree root node to the storage space corresponding to the first address of the first remaining storage space includes: writing basic data to the storage space corresponding to the first address of the first remaining storage space; and after writing the basic data, writing offset data to the remaining storage space of the first remaining storage space. In the above embodiment, the basic data written to the storage space corresponding to the first address of the first remaining storage space (denoted as base_data in this application embodiment) mainly includes the node identifier of the root node, the identifier of the parent node of the root node, the creation time of the node, and whether the node is active. The offset data mainly includes the offset address of the root node storage path, the space required for the root node storage path (denoted as path_len in this application embodiment), the offset address of the parent node of the root node (denoted as offset_parent_node in this application embodiment), the offset address of the child node offset address array of the root node, and the number of child nodes of the root node. It should be noted that since the root node does not have a parent node, in order to maintain consistency with other nodes, the existence of a parent node's offset address is still acknowledged for the root node, but it is set to 0; a similar special provision can be made for the identifier of the root node's parent node. As for the child node offset address array, it is essentially an array composed of various elements, where any element represents the offset address of a child node. In this embodiment, offset_child_node is used to represent the offset address of the child node offset address array. From the above definition of offset_path, it can be seen that offset_path is actually the offset address of the data pointing to the storage path of the node (denoted as path_data in this embodiment, which is the variable-length data of the node), and offset_child_node is actually the offset address of the first child node among the multiple child nodes of the node (denoted as child1bu_offset in this embodiment, which is the variable-length data of the node). For nodes that are not the root node in the target multi-way tree, offset_parent_node is actually the starting address of the storage unit of the fixed-length data of the node's parent node.Regarding the storage space after writing the fixed-length data of the root node of the target multi-way tree, writing the fixed-length data of child nodes to memory in traversal order, and writing the fixed-length data of the child nodes' child nodes to memory in traversal order in the storage space after writing the fixed-length data of the child nodes, this is similar to writing the fixed-length data of the root node of the target multi-way tree to the storage space corresponding to the first address of the first remaining storage space in the above embodiment. Specifically, if the root node has child nodes, then writing the fixed-length data of child nodes to memory in traversal order in the storage space after writing the fixed-length data of the root node of the target multi-way tree can be as follows: writing the basic data of the child nodes to memory in traversal order in the storage space after writing the fixed-length data of the root node of the target multi-way tree; after writing the basic data of the child nodes, writing the offset data of the child nodes to the remaining storage space in memory. The basic data of the child nodes includes the node identifier of the child node, the identifier of the parent node of the child node, the creation time of the child node, and whether the child node is active. The offset data of the child nodes includes the offset address of the storage path of the child node and the length of the storage path of the child node. The offset address of the parent node of the child node, the offset address of the child node's child node offset address array, and the number of child nodes of the child node; similarly, if the child node has child nodes, then in the storage space after writing the fixed-length data of the child node, writing the fixed-length data of the child node's child nodes to memory in traversal order can be: in the storage space after writing the fixed-length data of the child node, writing the basic data of the child node's child nodes to memory in traversal order; after writing the basic data of the child node's child nodes, writing the offset data of the child node's child nodes to the remaining storage space in memory, wherein the basic data of the child node's child nodes includes the node identifier of the child node's child nodes, the identifier of the parent node of the child node's child nodes, the creation time of the child node's child nodes, and whether the child node's child nodes are active; the offset data of the child node's child nodes includes the offset address of the storage path of the child node's child nodes, the length of the storage path of the child node's child nodes, the offset address of the parent node of the child node's child nodes, the offset address of the child node's child node offset address array, and the number of child nodes of the child node's child nodes.

[0059] As one embodiment of this application, writing the variable-length data of each node of the target multi-way tree into the second remaining storage space of the memory obtained in step S102 in traversal order can be as follows: writing the storage path of the root node of the target multi-way tree into the storage space corresponding to the first address of the second remaining storage space; if the root node has child nodes, then after writing the storage path of the root node of the target multi-way tree, writing the offset addresses of each child node of the root node into the remaining storage space of the second remaining storage space in traversal order; after writing the offset addresses of each child node of the root node, writing the storage path and offset address of each child node's child node into the remaining storage space of the second remaining storage space in traversal order. Figure 4The instructions describe writing sequentially to the second remaining memory space. Figure 3 The example diagram illustrates the variable-length data of each node in a multi-way tree. It also shows the pointers to the offset data in the fixed-length data of each node. In other words, although the multi-way tree information has been serialized, the serialized data still contains the tree relationship information between nodes. This is because each node in the serialized data stores the offset address of its parent node, and each node stores the offset addresses of all its child nodes.

[0060] From the above Figure 1 As can be seen from the example of the multi-way tree information serialization method, unlike related technologies that require two serialization operations when serializing multi-way tree information, the technical solution of this application, after obtaining the attribute information of the target multi-way tree and allocating memory that matches the attribute information of the target multi-way tree, sequentially writes the required cache size of the serialized result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree into memory, and writes the data of each node of the target multi-way tree into the remaining storage space of memory according to the traversal order. That is, the technical solution of this application only needs to perform one serialization operation to complete the serialization of multi-way tree information, thus having the advantage of high serialization efficiency.

[0061] Corresponding to Figure 1 The example describes a multi-way tree information serialization method; embodiments of this application provide a multi-way tree information deserialization method. See also... Figure 5 This is a flowchart illustrating a multi-way tree information deserialization method according to an embodiment of this application. The method mainly includes steps S501 to S506, which are described in detail below:

[0062] Step S501: Obtain the starting address of memory, where memory is the memory allocated when serializing each node of the target multi-way tree that matches the attribute information of the target multi-way tree. The attribute information of the target multi-way tree includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0063] The memory here refers to the memory allocated when serializing each node of the target multi-way tree, which matches the attribute information of the target multi-way tree. According to the aforementioned description of the multi-way tree information serialization method, the first data written into memory is the buffer size required for the serialization result of each node of the target multi-way tree, i.e., `buffer_size`. Furthermore, this `buffer_size` data is stored in a first preset storage space, which is the memory space pre-allocated to store the buffer size required for the serialization result of each node of the target multi-way tree. Therefore, obtaining the starting address of the first preset storage space is equivalent to obtaining the starting address of the memory. It should be noted that since the first data written into memory is `buffer_size`, the data first received and parsed by the party needing the serialization result is also `buffer_size`. Therefore, the party needing the serialization result can compare the received and parsed `buffer_size` with the expected data length of the serialization result. If they match, the received multi-way tree information serialization result is considered complete; otherwise, the data is considered incomplete.

[0064] Step S502: Calculate the root node address of the target multi-way tree based on the memory starting address, the preset storage space based on the total number of nodes in the target multi-way tree, and the cache size required for the serialization result of each node in the target multi-way tree.

[0065] When serializing multi-way tree information, the process involves writing the required cache size for the serialized results of each node of the target multi-way tree and the total number of nodes in the target multi-way tree into memory, and then writing the data of each node itself into the remaining memory space. Furthermore, when writing the data of each node itself into the remaining memory space, the fixed-length data of the root node of the target multi-way tree is written first. Therefore, the address of the root node of the target multi-way tree is actually the sum of the memory starting address, the preset storage space for the total number of nodes in the target multi-way tree, and the preset storage space for the cache size required for the serialized results of each node in the target multi-way tree. Assuming the starting address of the memory is denoted as buffer_addr, the address of the root node of the target multi-way tree is denoted as root_addr, and the total number of nodes in the target multi-way tree is preset to a storage space of nc_buffer_size, then root_addr = buffer_addr + buffer_size + nc_buffer_size. For example, if buffer_size is 4 bytes and nc_buffer_size is also 4 bytes, then root_addr = buffer_addr + 8 bytes.

[0066] Step S503: Based on the root node address of the target multi-way tree and the length of the root node's own data, obtain the addresses of each child node of the root node. The order in which the addresses of each child node of the root node are obtained is the same as the traversal order when serializing each node of the target multi-way tree using a preset traversal method.

[0067] According to the definition or principle of deserialization, the goal of deserialization is to parse the addresses of each node, its parent node, and its child nodes from the serialization result, and then read its data according to these addresses. Therefore, after calculating the root node address of the target multi-way tree, the addresses of each child node of the root node are obtained based on the root node address and the length of the root node's own data. Specifically, obtaining the addresses of each child node of the root node based on the root node address and the length of the root node's own data can be done as follows: 1. Calculate the number of child nodes of the root node based on the root node address and the length of the root node's own data; 2. Calculate the starting address of the child node offset address array based on the root node address; 3. Calculate the address of the nth child node among the root node's child nodes based on the starting address of the child node offset address array. It should be noted that although the above uses the root node as an example to illustrate the method of obtaining the addresses of each child node of the root node. However, it is understandable that the method described above for obtaining the addresses of each child node of the root node is also applicable to obtaining the addresses of each child node of other non-root nodes in the target multi-way tree. It is only necessary to replace the root node with a non-root node. Therefore, the method for obtaining the addresses of each child node of other non-root nodes in the target multi-way tree will not be described again here.

[0068] In the above embodiments, obtaining the number of child nodes of the root node based on the root node address and the length of the root node's own data specifically involves: calculating the difference between the length of the fixed-length data of the root node and the storage space occupied by the number of child nodes of the root node; calculating the sum of the root node address and the above difference as the storage space address for storing the number of child nodes of the root node; and reading the number of child nodes of the root node from the storage unit corresponding to the storage space address for storing the number of child nodes of the root node. Here, assuming that the difference between the length of the fixed-length data of the root node and the storage space occupied by the number of child nodes of the root node is 33 bytes, then root_addr+33 is the storage space address for storing the number of child nodes of the root node; if the storage space for storing the number of child nodes of the root node is p bytes, then reading the p bytes of storage space starting from the storage space address root_addr+33 and storing the content is the number of child nodes of the root node, child_count.

[0069] In the above embodiments, obtaining the starting address of the child node offset address array based on the root node address of the target multi-way tree can be achieved by: calculating the sum of the length of the basic data and the storage space occupied by the partial offset data in the fixed-length data of the root node; calculating the sum of the root node address and the above sum as the starting address of the offset address of the child node offset address array; obtaining the offset address of the child node offset address array based on the starting address of the offset address of the child node offset address array; and calculating the sum of the memory starting address and the offset address of the child node offset address array as the starting address of the child node offset address array. The partial offset data includes the offset address of the root node's storage path, the length of the root node's storage path, and the offset address of the parent node. For example, assuming the sum of the length of the basic data and the storage space occupied by the partial offset data in the fixed-length data of the root node is Sr, and the root node address is denoted as root_addr, then the starting address of the offset address of the child node offset address array = root_addr + Sr.

[0070] In the above embodiments, calculating the address of the nth child node among the root node's child nodes based on the starting address of the child node offset address array can be done as follows: locate the starting address of the child node offset address array; starting from the address buffer_addr+offset_child+(n-1)*k, read the data in k bytes of storage unit as the offset address of the nth child node among the root node's child nodes (denoted as offset_child_node); and use the sum of the memory starting address and the offset address of the nth child node among the root node's child nodes as the address of the nth child node among the root node's child nodes. Here, k is the number of bytes occupied by offset_child_node in the storage unit, offset_child is the starting address of the child node offset address array, and buffer_addr is the memory starting address.

[0071] Step S504: Read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node.

[0072] The data of each child node of the root node includes fixed-length data that occupies a fixed amount of memory, such as the node identifier of each child node, the parent node identifier (PnID), the creation time (create_time), whether it is active (Is_active), the offset address of the storage path (offset_path), the length of the storage path (path_len), the offset address of the parent node (offset_parent_node), the offset address of the child node offset address array (offset_child_node), and the number of child nodes (child_count). It also includes variable-length data that occupies a variable amount of memory, such as the storage path of the parent or child node (path_data) and the offset address array of the child nodes of the parent or child node.

[0073] Step S505: Based on the data of each child node of the root node, obtain the address of the parent node and the address of each child node of the root node.

[0074] Specifically, as an embodiment of this application, obtaining the parent node address and child node address of each child node of the root node based on its own data can be as follows: Based on the address of any child node of the root node and the length of its own data, obtain the number of child nodes of any child node; based on the address of any child node of the root node, obtain the starting address of the child node offset address array of any child node of the root node; based on the starting address of the child node offset address array of any child node of the root node, calculate the address of the m-th child node among the child nodes of any child node; calculate the sum of the length of the basic data in any child node of the root node, the storage space occupied by the offset address of the storage path of any child node's own data, the storage space occupied by the data length of the storage path, and the address of any child node of the root node as the starting address for storing the parent node offset address of any child node of the root node; read the parent node offset address from this starting address, and add the parent node offset address to the memory starting address to obtain the parent node address.

[0075] Step S506: Read the parent node and child node data of each child node from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

[0076] The parent node or child node's own data for each child node of the root node includes the node identifier (nID), the parent node identifier (PnID), the creation time (create_time), whether the parent node or child node is active (Is_active), the offset address of the storage path (offset_path), the length of the storage path (path_len), the offset address of the parent node (offset_parent_node), the offset address of the child node offset address array (offset_child_node), and the number of child nodes (child_count), which are fixed-length data occupying a fixed amount of memory. It also includes the storage path of the parent node or child node (path_data) and the child node offset address array of the parent node or child node (child_offset), which are variable-length data occupying a variable amount of memory. Taking the node identifier (nID) and parent node identifier (PnID) of a parent or child node each as 4 bytes of storage space, the creation time (create_time) as 8 bytes of storage space, and whether it is active (Is_active) as 1 byte of storage space, and the offset address of the storage path (offset_path), the length of the storage path (path_len), the offset address of the parent node (offset_parent_node), the offset address of the child node's offset address array (offset_child_node), and the number of child nodes (child_count) as each occupying 4 bytes of storage space as an example, then reading 4 bytes of data starting from the parent node address or child node address (denoted as node_addr) will give the node identifier (nID) of that parent or child node, and reading 4 bytes of data starting from the address node_addr+4 will give the node identifier (nID) of that parent or child node. The parent node identifier (PnID) of a child node is obtained by reading 8 bytes of data starting from the address node_addr+8 to get the creation time (create_time) of the parent or child node. Reading 1 byte of data starting from the address node_addr+16 gives the information on whether the parent or child node is active (Is_active). Reading 4 bytes of data starting from the address node_addr+17 gives the offset address (offset_path) of the storage path of the parent or child node. Reading 4 bytes of data starting from the address node_addr+21 gives the length (path_len) of the storage path of the parent or child node. Reading path_len bytes of data starting from the address (buffer_addr+offset_path) of the storage path of the parent or child node gives the storage path (path_data).

[0077] From the above Figure 5 As can be seen from the example of the multi-way tree information deserialization method, unlike related technologies that require two deserialization operations when serializing multi-way tree information, the technical solution of this application, after obtaining the memory starting address, calculates the root node address of the target multi-way tree based on the memory starting address, the total number of nodes in the target multi-way tree, the preset storage space, and the cache size required for the serialization results of each node in the target multi-way tree. Based on the root node address of the target multi-way tree and the length of the data of each node in the target multi-way tree, the addresses of each child node of the root node are obtained, and then the data of each node is obtained. That is, the technical solution of this application only needs to perform one deserialization operation to complete the deserialization, thus having the advantage of high efficiency in deserialization.

[0078] Corresponding to the aforementioned application function implementation method embodiments, this application also provides a multi-branch tree information serialization and deserialization device, electronic device, and corresponding embodiments.

[0079] See Figure 6 This is a schematic diagram of the structure of a multi-branch tree information serialization device shown in an embodiment of this application. For ease of explanation, only the parts related to the embodiments of this application are shown. Figure 6 The example multi-way tree information serialization and deserialization device mainly includes a first acquisition module 601, an application module 602, a first writing module 603, and a second writing module 604, wherein:

[0080] The first acquisition module 601 is used to acquire the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node in the target multi-way tree, the total number of nodes in the target multi-way tree, and the cache size required for the serialization result of each node in the target multi-way tree after serialization.

[0081] Module 602 is used to request memory that matches the attribute information of the target multi-way tree;

[0082] The first writing module 603 is used to sequentially write the cache size required for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree into memory.

[0083] The second writing module 604 is used to traverse each node of the target multi-branch tree in a preset traversal method and write the data of each node of the target multi-branch tree to the remaining storage space in memory in the traversal order.

[0084] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated further here.

[0085] See Figure 7This is a schematic diagram of the structure of a multi-branch tree information deserialization device shown in an embodiment of this application. For ease of explanation, only the parts related to the embodiments of this application are shown. Figure 7 The example multi-way tree information serialization and deserialization device mainly includes a second acquisition module 701, a calculation module 702, a third acquisition module 703, a first reading module 704, a fourth acquisition module 705, and a second reading module 706, wherein:

[0086] The second acquisition module 701 is used to acquire the memory starting address, wherein the memory is the memory allocated when serializing each node of the target multi-way tree that matches the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization.

[0087] The calculation module 702 is used to calculate the root node address of the target multi-way tree based on the memory starting address, the preset storage space based on the total number of nodes in the target multi-way tree, and the cache size required for the serialization result of each node in the target multi-way tree after serialization.

[0088] The third acquisition module 703 is used to acquire the addresses of each child node of the root node based on the root node address of the target multi-way tree and the length of the data of each node of the target multi-way tree. The acquisition order of the addresses of each child node of the root node is the traversal order when the nodes of the target multi-way tree are serialized using a preset traversal method.

[0089] The first reading module 704 is used to read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node;

[0090] The fourth acquisition module 705 is used to obtain the parent node address and child node address of each child node of the root node based on the data of each child node of the root node.

[0091] The second reading module 706 is used to read the parent node and the child node's own data from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

[0092] Figure 8 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application.

[0093] See Figure 8 The electronic device 800 includes a memory 810 and a processor 820.

[0094] The processor 820 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0095] Memory 810 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by the processor 820 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 810 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, memory 810 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, a high-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.

[0096] The memory 810 stores executable code, which, when processed by the processor 820, can cause the processor 820 to execute part or all of the methods described above.

[0097] Furthermore, the method according to this application can also be implemented as a computer program or computer program product, which includes computer program code instructions for performing some or all of the steps in the method described above.

[0098] Alternatively, this application may be implemented as a computer-readable storage medium (or a non-transitory machine-readable storage medium or a machine-readable storage medium) storing executable code (or computer program or computer instruction code) thereon, which, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the steps of the methods described above according to this application.

[0099] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A method for serializing multi-way tree information, characterized in that, The method includes: Obtain the attribute information of the target multi-way tree, including the length of the data of each node in the target multi-way tree, the total number of nodes in the target multi-way tree, and the cache size required for the serialization result of each node in the target multi-way tree after serialization; Request memory that matches the attribute information of the target multi-way tree; The required cache size for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree are sequentially written into the memory. The target multi-way tree is traversed in a preset traversal method, and the data of each node of the target multi-way tree is written to the remaining storage space of the memory in the traversal order. The requested memory, which matches the attribute information of the target multi-way tree, includes: Calculate the target storage space size, which is the sum of the lengths of the first preset storage space, the second preset storage space, and the data of all nodes in the target multi-way tree. The first preset storage space includes memory space pre-allocated for the cache size required to store the serialized results of each node in the target multi-way tree. The second preset storage space includes memory space pre-allocated for storing the total number of nodes in the target multi-way tree. Using the starting address of the first preset storage space as the starting address of the memory, request a storage space of not less than the size of the target storage space.

2. The multi-way tree information serialization method according to claim 1, characterized in that, The data of each node in the target multi-way tree includes fixed-length data and variable-length data of each node. Writing the data of each node in the target multi-way tree to the remaining storage space in memory according to the traversal order includes: According to the traversal order, the fixed-length data of each node of the target multi-way tree is written into the first remaining storage space of the memory in turn. The first remaining storage space is the remaining storage space of the memory after the serialization result of each node of the target multi-way tree is written into the memory in turn and the total number of nodes of the target multi-way tree. According to the traversal order, the variable-length data of each node of the target multi-way tree is written to the second remaining storage space of the memory in turn. The second remaining storage space is the remaining storage space of the memory after the fixed-length data of all nodes of the target multi-way tree are written to the first remaining storage space of the memory in turn.

3. The multi-way tree information serialization method according to claim 2, characterized in that, The step of writing fixed-length data of each node of the target multi-way tree into the first remaining storage space of the memory in the traversal order includes: Write the fixed-length data of the root node of the target multi-way tree to the storage space corresponding to the first address of the first remaining storage space; and / or, If the root node has child nodes, then in the storage space after writing the fixed-length data of the root node of the target multi-way tree, the fixed-length data of the child nodes are written to the memory according to the traversal order; and / or, If the child node has child nodes, then in the storage space after the fixed-length data of the child node is written, the fixed-length data of the child node's child nodes is written to the memory in the traversal order.

4. The multi-way tree information serialization method according to claim 3, characterized in that, The step of writing fixed-length data of the root node of the target multi-way tree to the storage space corresponding to the first address of the first remaining storage space includes: Write basic data to the storage space corresponding to the first address of the first remaining storage space. The basic data includes the node identifier of the root node, the identifier of the root node's parent node, the creation time of the root node, and whether the root node is active. After writing the basic data, write offset data to the remaining storage space of the first remaining storage space. The offset data includes the offset address of the root node's storage path, the length of the root node's storage path, the offset address of the root node's parent node, the offset address of the array of child node offset addresses of the root node, and the number of child nodes of the root node; and / or, If the root node has child nodes, then in the storage space after writing the fixed-length data of the root node of the target multi-way tree, the fixed-length data of the child nodes is written to the memory in the traversal order, including: in the storage space after writing the fixed-length data of the root node of the target multi-way tree, the basic data of the child nodes is written to the memory in the traversal order, the basic data of the child nodes includes the node identifier of the child node, the identifier of the parent node of the child node, the creation time of the child node, and whether the child node is active; after writing the basic data of the child nodes, the offset data of the child nodes is written to the remaining storage space in the memory, the offset data of the child nodes includes the offset address of the storage path of the child node, the length of the storage path of the child node, the offset address of the parent node of the child node, the offset address of the child node's child node offset address array, and the number of child nodes of the child node; and / or, If the child node has child nodes, then in the storage space after writing the fixed-length data of the child node, the fixed-length data of the child node's child nodes is written to the memory in the traversal order, including: in the storage space after writing the fixed-length data of the child node, the basic data of the child node's child nodes is written to the memory in the traversal order, the basic data of the child node's child nodes includes the node identifier of the child node's child nodes, the identifier of the parent node of the child node's child nodes, the creation time of the child node's child nodes, and whether the child node's child nodes are active; after writing the basic data of the child node's child nodes, the offset data of the child node's child nodes is written to the remaining storage space in the memory, the offset data of the child node's child nodes includes the offset address of the storage path of the child node's child nodes, the length of the storage path of the child node's child nodes, the offset address of the parent node of the child node's child nodes, the offset address of the offset address array of the child node's child nodes, and the number of the child nodes' child nodes.

5. The multi-way tree information serialization method according to claim 2, characterized in that, The step of writing variable-length data of each node of the target multi-way tree into the second remaining storage space of the memory in the traversal order includes: Write the storage path of the root node of the target multi-way tree to the storage space corresponding to the first address of the second remaining storage space; If the root node has child nodes, then after writing the storage path of the root node of the target multi-way tree, the offset addresses of each child node of the root node are written to the remaining storage space of the second remaining storage space in the traversal order. After writing the offset addresses of each child node of the root node, the storage paths and offset addresses of the child nodes of each child node are written sequentially into the remaining storage space of the second remaining storage space in the traversal order.

6. A method for deserializing multi-way tree information, characterized in that, The method includes: Obtain the starting address of the memory, where the memory is the memory allocated when serializing each node of the target multi-way tree and is consistent with the attribute information of the target multi-way tree. The first data written in the memory is the cache size required for the serialization result of each node of the target multi-way tree. The first data written in the memory is stored in the first preset storage space. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree. The root node address of the target multi-way tree is calculated based on the memory starting address, the total number of nodes in the target multi-way tree, the preset storage space, and the cache size required for the serialization result of each node in the target multi-way tree after serialization. Based on the root node address of the target multi-way tree and the length of the data of each node in the target multi-way tree, the addresses of each child node of the root node are obtained. The order in which the addresses of each child node of the root node are obtained is the traversal order when the nodes of the target multi-way tree are serialized using a preset traversal method. Read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node; Based on the data of each child node of the root node, obtain the parent node address and child node address of each child node of the root node; Read the parent node and child node data of each child node from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

7. The multi-way tree information deserialization method according to claim 6, characterized in that, The step of obtaining the addresses of each child node of the root node based on the root node address of the target multi-way tree and the length of the root node's own data includes: The number of child nodes of the root node is obtained based on the root node address of the target multi-way tree and the length of the root node's own data. Based on the root node address of the target multi-way tree, obtain the starting address of the child node offset address array; Based on the first address of the child node offset address array, calculate the address of the nth child node in the root node's child node count.

8. The method for deserializing multi-way tree information according to claim 7, characterized in that, The root node's own data includes fixed-length data of the root node. The step of obtaining the number of child nodes of the root node based on the root node address of the target multi-way tree and the length of the root node's own data includes: Calculate the difference between the length of the fixed-length data of the root node and the storage space occupied by the number of child nodes of the root node; The sum of the root node address and the difference is used as the storage space address for storing the number of child nodes of the root node; The number of child nodes of the root node is read from the storage unit corresponding to the storage space address.

9. The method for deserializing multi-way tree information according to claim 7, characterized in that, The step of obtaining the starting address of the child node offset address array based on the root node address of the target multi-way tree includes: Calculate the sum of the length of the basic data and the storage space occupied by the partial offset data in the fixed-length data of the root node. The partial offset data includes the offset address of the storage path of the root node, the length of the storage path of the root node, and the offset address of the parent node. The sum of the root node address and the sum of the two is used as the starting address of the offset address array of the child nodes; Obtain the offset address of the child node offset address array based on the starting address of the offset address array; The sum of the memory starting address and the offset address of the child node offset address array is calculated as the starting address of the child node offset address array.

10. The method for deserializing multi-way tree information according to claim 6, characterized in that, The step of obtaining the parent node address and child node address of each child node of the root node based on the self-data of each child node includes: The number of child nodes of any child node is obtained based on the address of any child node of the root node and the length of the data of any child node of the root node itself. Based on the addresses of any child nodes of the root node, obtain the starting address of the array of child node offset addresses of any child node of the root node; Based on the starting address of the array of child node offset addresses of any child node of the root node, calculate the address of the m-th child node in the total number of child nodes of the arbitrary child node; The sum of the length of the basic data in any child node of the root node, the storage space occupied by the offset address of the data storage path of the arbitrary child node, the storage space occupied by the data length of the storage path, and the address of any child node of the root node is used as the starting address of the parent node offset address of the arbitrary child node of the root node. Read the parent node offset address of any child node of the root node from the starting address of the parent node offset address, and add the parent node offset address of any child node of the root node to the starting address of the memory to obtain the parent node address of any child node of the root node.

11. A multi-branch tree information serialization device, characterized in that, The device includes: The first acquisition module is used to acquire the attribute information of the target multi-way tree. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization. The application module is used to apply for memory that matches the attribute information of the target multi-way tree; The first writing module is used to sequentially write the cache size required for the serialization result of each node of the target multi-way tree and the total number of nodes of the target multi-way tree to the memory. The second writing module is used to traverse each node of the target multi-way tree in a preset traversal method and write the data of each node of the target multi-way tree to the remaining storage space of the memory in the traversal order. The requested memory, which matches the attribute information of the target multi-way tree, includes: Calculate the target storage space size, which is the sum of the lengths of the first preset storage space, the second preset storage space, and the data of all nodes in the target multi-way tree. The first preset storage space includes memory space pre-allocated for the cache size required to store the serialized results of each node in the target multi-way tree. The second preset storage space includes memory space pre-allocated for storing the total number of nodes in the target multi-way tree. Using the starting address of the first preset storage space as the starting address of the memory, request a storage space of not less than the size of the target storage space.

12. A deserialization device for multi-branch tree information, characterized in that, The device includes: The second acquisition module is used to acquire the memory starting address. The memory is the memory allocated when serializing each node of the target multi-way tree, which is consistent with the attribute information of the target multi-way tree. The first data written in the memory is the cache size required for the serialization result of each node of the target multi-way tree. The first data written in the memory is stored in the first preset storage space. The attribute information includes the length of the data of each node of the target multi-way tree, the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree. The calculation module is used to calculate the root node address of the target multi-way tree based on the memory starting address, the preset storage space based on the total number of nodes of the target multi-way tree, and the cache size required for the serialization result of each node of the target multi-way tree after serialization. The third acquisition module is used to acquire the addresses of each child node of the root node according to the root node address of the target multi-way tree and the length of the data of each node of the target multi-way tree. The acquisition order of the addresses of each child node of the root node is the traversal order when the nodes of the target multi-way tree are serialized and traversed in a preset traversal method. The first reading module is used to read the data of each child node of the root node from the storage unit corresponding to the address of each child node of the root node; The fourth acquisition module is used to acquire the parent node address and child node address of each child node of the root node based on the self-data of each child node of the root node. The second reading module is used to read the parent node and the child node's own data from the storage unit corresponding to the parent node address and child node address of each child node of the root node.

13. An electronic device, characterized in that, include: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1 to 5 or 6 to 10.

14. A computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method as claimed in any one of claims 1 to 5 or 6 to 10.