Data writing method, device, computer equipment and storage medium
By using cache to obtain the maximum node number of the target array and generating new leaf node number in blockchain technology, and updating the node tree and target array, the problem of high complexity of traditional Merkle Tree data writing is solved, and efficient data is achieved Write and store.
Patent Information
- Application Number
- CN202211537563.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-12-02
AI Technical Summary
In the blockchain technology, traditional Merkle Tree has redundant calculations and frequent random I/O readings when writing data, resulting in high complexity and low efficiency in data writing.
By obtaining the maximum node number of the target array from the cache, generating a new leaf node number, and updating the node tree and target array, the data writing process requires only one cache read, reducing complexity and improving efficiency.
It effectively reduces the complexity and storage pressure of data writing, improves the efficiency of data writing, and avoids frequent I/O problems.
Smart Images

Figure CN116204581B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of blockchain technology, and in particular to a data writing method, device, computer equipment and storage medium. Background Art
[0002] In blockchain technology, when the server stores transaction data from the client, it usually collects data in the form of Merkle Tree. However, the traditional Merkle Tree not only has redundant intermediate node calculations, but also frequently performs random I / O readings when inserting and deleting data, resulting in a high complexity in data writing and reducing the efficiency of data writing. Summary of the invention
[0003] The embodiments of the present disclosure at least provide a data writing method, apparatus, computer equipment and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides a data writing method, comprising:
[0005] In response to a write operation for target data, a currently stored target array is obtained from a cache; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data;
[0006] Generate node summary information of a new leaf node according to the target data, and determine the node sequence number of the new leaf node according to the target array;
[0007] The node tree is updated according to the node summary information of the new leaf node to obtain an updated node tree, and the target array is updated using the node sequence number of the new leaf node to obtain an updated target array; wherein, the completion of the node tree update is used to indicate that the target data is written successfully.
[0008] In a possible implementation, updating the node tree according to the node summary information of the new leaf node to obtain an updated node tree includes:
[0009] When the node sequence number is an even number, the node tree is updated according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain an updated node tree; the node summary information of the target node is stored in the cache.
[0010] In a possible implementation, the updating of the target array by using the node sequence number of the new leaf node to obtain an updated target array includes:
[0011] According to the node sequence numbers and node connection relationships of each newly generated node corresponding to the updated node tree, the verifiable structure array is updated to obtain an updated verifiable structure array; the newly generated node at least includes the new leaf node and the parent node of the new leaf node;
[0012] According to the maximum node sequence number of each layer of the updated verifiable structure array, the target array is updated to obtain an updated target array;
[0013] After obtaining the updated target array, the method further includes:
[0014] The target array stored in the cache is updated using the updated target array.
[0015] In a possible implementation, when the node sequence number is an odd number, updating the target array using the node sequence number of the new leaf node to obtain an updated target array includes:
[0016] Adding the node serial number of the new leaf node to the level where the verifiable structure array matches the leaf node to obtain the updated verifiable structure array;
[0017] The maximum node number with the first sorting order in the target array is replaced with the node number of the new leaf node to obtain an updated target array; wherein the sorting order of each maximum node number in the target array is determined in descending order according to the level to which each maximum node number belongs in the node tree.
[0018] In a possible implementation, updating the node tree according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain an updated node tree includes:
[0019] Generate a target parent node of the new leaf node and node summary information of the target parent node according to the node summary information of the new leaf node and the node summary information of the target node corresponding to the largest node sequence number with the first sorting order in the target array;
[0020] Determine whether the target node corresponding to the next largest node sequence number in the target array has a generated parent node;
[0021] If not, generating a new target parent node and the node summary information of the new target parent node according to the node summary information of the target parent node and the node summary information of the target node corresponding to the next largest node sequence number;
[0022] Return to the step of determining whether a target node corresponding to the next largest node sequence number in the target array has a generated parent node, until the target array traversal is completed or a generated parent node exists;
[0023] The node tree is updated according to the generated node summary information of each target parent node to obtain an updated node tree.
[0024] In a possible implementation, the method further includes:
[0025] In the case that the target node corresponding to the next largest node number in the target array has a generated parent node, the node tree is updated according to the node summary information of the target parent node of the new leaf node to obtain an updated node tree.
[0026] In a possible implementation, after obtaining the updated node tree, the method further includes:
[0027] Determine the root set summary corresponding to the new leaf node according to the updated node tree; the root set summary includes each root set node corresponding to the new leaf node and node summary information of the root set node;
[0028] The root set summary corresponding to the new leaf node is stored in the first target file, and the node summary information of each newly generated node in the updated node tree except the new leaf node is stored in the second target file.
[0029] In a second aspect, an embodiment of the present disclosure further provides a data writing device, including:
[0030] An acquisition module, configured to acquire a currently stored target array from a cache in response to a write operation for target data; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data;
[0031] A determination module, used to generate node summary information of a new leaf node according to the target data, and determine a node sequence number of the new leaf node according to the target array;
[0032] An update module is used to update the node tree according to the node summary information of the new leaf node to obtain an updated node tree, and to update the target array using the node sequence number of the new leaf node to obtain an updated target array; wherein the completion of the node tree update is used to indicate that the target data has been written successfully.
[0033] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0034] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0035] For a description of the effects of the above-mentioned data writing device, computer equipment, and computer-readable storage medium, please refer to the description of the above-mentioned data writing method, which will not be repeated here.
[0036] The data writing method, device, computer equipment and storage medium provided by the embodiments of the present disclosure use the target array obtained from the cache to determine the node number of the new leaf node generated according to the target data to be written, and update the node tree, so that the entire data writing process only needs to read the data from the cache once, effectively reducing the complexity of data writing and improving the efficiency of data writing. In addition, since the target array only stores the maximum node number of each layer in the verifiable structure array, the volume of the target array is small, and then the data is written through the stored target array, which effectively reduces the pressure of data storage.
[0037] Furthermore, the data writing method, apparatus, computer device and storage medium provided by the embodiments of the present disclosure can also utilize the node summary information of the target node corresponding to the maximum node sequence number stored in the cache to generate the parent node of the new leaf node, that is, it is possible to generate the parent node by reading the cache only once, effectively avoiding the problem of frequent I / O and improving the efficiency of data writing.
[0038] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0040] Figure 1 A flow chart of a data writing method provided by an embodiment of the present disclosure is shown;
[0041] Figure 2 A schematic diagram of a node tree provided by an embodiment of the present disclosure is shown;
[0042] Figure 3 A schematic diagram of a structure of a verifiable structure array provided by an embodiment of the present disclosure is shown;
[0043] Figure 4 A schematic diagram of a data writing device provided by an embodiment of the present disclosure is shown;
[0044] Figure 5 A schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0046] In addition, the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.
[0047] The "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0048] Research has found that, due to the limitations of the traditional Merkle Tree generation method, the Merkle Tree model has a high complexity when maintaining the tree structure. For example, when inserting data, it is necessary to read the data through multiple random I / Os. This inevitably leads to the problem of low data writing efficiency.
[0049] Based on the above research, the present disclosure provides a data writing scheme, which uses the target array obtained from the cache to determine the node number of the new leaf node generated according to the target data to be written, and updates the node tree, so that the entire data writing process only needs to read the cache once, effectively reducing the complexity of data writing and improving the efficiency of data writing. In addition, since the target array only stores the maximum node number of each layer in the verifiable structure array, the target array is small in size, and then data is written through the stored target array, effectively reducing the pressure of data storage.
[0050] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0052] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0053] To facilitate understanding of the present embodiment, a data writing method disclosed in the embodiment of the present disclosure is first introduced in detail. The executor of the data writing method provided in the embodiment of the present disclosure is generally a terminal device or other processing device with certain computing capabilities, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a personal digital assistant (PDA), a handheld device, a computer device, etc.; in some possible implementations, the data writing method may be implemented by a processor calling computer-readable instructions stored in a memory.
[0054] The data writing method provided by the embodiment of the present disclosure is described below by taking a computer device as an example of an execution subject.
[0055] like Figure 1 As shown, it is a flowchart of a data writing method provided by an embodiment of the present disclosure, which may include the following steps:
[0056] S101: In response to a write operation for target data, a currently stored target array is obtained from a cache; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined based on the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data.
[0057] Here, the target data is the data that needs to be newly written, and specifically can be any type of data that can be applied to blockchain technology, for example, the target data can be transaction data, order data, etc. Optionally, the target array can be stored in a cache or memory.
[0058] The constructed node tree is constructed based on each written data, and the written data is the data that has been stored in the trusted relational database. One written data is used to generate the node summary information of a leaf node in the node tree. The node summary information can be obtained by hashing the written data. In other words, each leaf node in the node tree is used to represent the summary information of the written data corresponding to the leaf node. Other nodes in the node tree except the leaf nodes can be called intermediate nodes, and different intermediate nodes can be generated based on the summary information represented by different leaf nodes. For example, since the nodes at adjacent levels in the node tree can include nodes with parent-child relationships, the intermediate nodes with parent-child relationships with the leaf nodes can be generated based on the summary information represented by the leaf nodes.
[0059] For example, the constructed node tree can be as follows Figure 2As shown, a leaf node in the node tree corresponds to a written data, and each leaf node in the node tree corresponds to a node serial number. The node serial number of each leaf node is generated according to the generation rule corresponding to the leaf node serial number, and each leaf node is used to represent the node summary information generated according to the written data corresponding to the leaf node. Figure 2 The leaf nodes with node numbers 1 to 16 are shown in FIG. 16. The nodes other than the leaf nodes in the node tree can be called intermediate nodes. The leaf nodes belong to the L0 layer of the node tree. The parent nodes of the leaf nodes belong to the L1 layer. The parent nodes of the parent nodes of the leaf nodes belong to the L2 layer. And so on. The nodes belonging to each layer can be determined. For example, in Figure 2 Five layers of nodes are shown, namely L0 to L4 layers. The intermediate nodes of each layer of the node tree correspond to an intermediate node sequence number generation rule. Exemplarily, based on the node summary information of the leaf nodes 1 and 2 of the L0 layer, an intermediate node with an L1 layer node sequence number of 1 can be generated; based on the node summary information of the leaf nodes 3 and 4 of the L0 layer, an intermediate node with an L1 layer node sequence number of 2 can be generated; based on the node summary information of the intermediate nodes with L1 layer node sequences of 1 and 2, an intermediate node with an L2 layer node sequence number of 3 can be generated. About Figure 2 The generation of each intermediate node can refer to Figure 2 The connections between the midpoints will not be described here.
[0060] The Verifiable Shrubs Array (VSA) is generated based on the currently constructed node tree. The hierarchical structure is consistent with the hierarchical structure of the node tree. The Verifiable Shrubs Array only stores the node numbers of each layer of the node tree and the connection relationship between the nodes corresponding to each node number. Figure 3 As shown, it is a schematic diagram of a structure of a verifiable structure array provided by an embodiment of the present disclosure. It should be noted that, Figure 3 The latest leaf node of the node tree corresponding to the verifiable structure array is leaf node 14, so Figure 3 Only the connection relationship related to the node number 14 is shown. The reason why the node number 7 of the L3 layer, the node number 10 of the L2 layer, and the node number 13 of the L0 layer are highlighted is that the nodes corresponding to these three node numbers are nodes in the root set summary (also called the root set) of the leaf node 13. The root set summary is used to characterize the root nodes corresponding to the nodes. For example, the root set summary of the leaf node 3 includes the intermediate node 1 and the leaf node 3, the root set summary corresponding to the leaf node 8 includes the intermediate node 7, and the root set summary corresponding to the leaf node 16 includes the intermediate node 15.
[0061] The target array is determined according to the maximum node sequence number of each layer in the currently established verifiable structure array, that is, the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array. For example, when the latest leaf node in the currently constructed node tree is leaf node 13, the node tree is a 4-layer tree, wherein the L3 layer includes intermediate node 7, the L2 layer includes intermediate nodes 3, 6, and 10, the L1 layer includes intermediate nodes 1, 2, 4, 5, 8, and 9, and the L0 layer includes leaf nodes 1 to 13. Accordingly, each layer in the verifiable structure array corresponding to the currently constructed node tree will also include the node sequence numbers corresponding to the above nodes, respectively. Furthermore, the maximum node sequence number of each layer selected can include 13 of the L0 layer, 9 of the L1 layer, 10 of the L2 layer, and 7 of the L3 layer, that is, the target array can be [13, 9, 10, 7]. The node sequence numbers in the target array can be arranged in order from low to high levels. That is, in the target array, the node number with the first sorting order bit is the maximum node number in the L0 layer, the node number with the second sorting order bit is the maximum node number in the L1 layer, and so on, until the node number with the Mth sorting order bit is the maximum node number in the LN layer, where M=N-1, and the M layer is the highest layer of the current verifiable structure array.
[0062] Exemplarily, in response to a write operation for target data, the currently stored target array can be obtained from the cache. The currently stored target array is determined according to the verifiable structure array corresponding to the latest generated node tree, including the maximum node sequence number of each layer in the currently established verifiable structure array. For example, when the maximum node sequence number of the verifiable structure array L0 layer is 8, the target array can be [8, 5, 6, 7]; when the maximum node sequence number of the verifiable structure array L0 layer is 14, the target array can be [14, 11, 10, 7]; when the maximum node sequence number of the verifiable structure array L0 layer is 23, the target array can be [23, 19, 18, 15].
[0063] S102: Generate node summary information of a new leaf node according to the target data, and determine the node sequence number of the new leaf node according to the target array.
[0064] After acquiring the target data, a data write operation can be performed. Specifically, a new leaf node can be generated for the constructed node tree, and a hash operation can be performed on the target data to obtain the node summary information of the new leaf node. At the same time, the node sequence number of the new leaf node can be determined according to the node sequence number that matches the L0 layer in the target array (that is, the node sequence number that is the first in the sorting order). Exemplarily, the sequence number obtained by adding 1 to the node sequence number that matches the L0 layer in the target array can be used as the node sequence number of the new leaf node. For example, when the sequence number that matches the L0 layer in the target array is 13, the node sequence number of the new leaf node is 14.
[0065] Optionally, there is no specific execution order between the steps of generating the node summary information of the new leaf node according to the target data and determining the node serial number of the new leaf node according to the target array. In specific implementation, the step of determining the node summary information can be executed first, or the step of determining the node serial number can be executed first, and of course the two steps can be executed simultaneously.
[0066] S103: Update the node tree according to the node summary information of the new leaf node to obtain an updated node tree, and use the node sequence number of the new leaf node to update the target array to obtain an updated target array; wherein, the completion of the node tree update is used to indicate that the target data is written successfully.
[0067] Exemplarily, after obtaining the node summary information of the new leaf node, the node summary information of the new leaf node can be used to update the currently constructed node tree to obtain an updated node tree. When the node summary information of the new leaf node is used to update the node tree, it can be determined whether the node summary information of other leaf nodes needs to be used based on the node sequence number of the new leaf node. If so, it is necessary to obtain other node summary information from the cache and update the node tree using the node summary information of the new leaf node and other node summary information; if not, the update can be completed using only the node summary information of the new leaf node. After obtaining the updated node tree, the verifiable structure array can also be updated according to the node sequence number of each node in the node tree to obtain an updated verifiable structure array.
[0068] At the same time, the node serial number of the new leaf node can be used to update the acquired target array, and the updated target array can be obtained and stored. Here, in the case where the node tree can be updated only by using the node summary information of the new leaf node, the target array can be updated only by using the node serial number of the new leaf node. In other cases, it means that other nodes are generated in the node tree, and it is necessary to use the node serial number of the new leaf node and the node serial numbers of other nodes to update the target array to obtain the updated target array.
[0069] Optionally, in addition to using the node sequence number of the new leaf node to update the target array, if an updated verifiable structure array is obtained, the target array can also be updated using the updated verifiable structure array.
[0070] In this way, by using the target array obtained from the cache, determining the node number of the new leaf node generated according to the target data to be written, and updating the node tree, the entire data writing process can be realized by only reading the cache once, which effectively reduces the complexity of data writing and improves the efficiency of data writing. In addition, since the target array only stores the maximum node number of each layer in the verifiable structure array, the target array is small in size, and then data is written through the stored target array, which effectively reduces the pressure of data storage.
[0071] In one embodiment, the step of updating the node tree can be determined according to the parity of the node serial number of the new leaf node. Specifically, when the node serial number is an even number, the node tree is updated according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node serial number in the target array to obtain an updated node tree; the node summary information of the target node is stored in the cache.
[0072] Here, the target node is the node corresponding to the maximum node serial number in the target array. The node summary information of the target nodes corresponding to each maximum node serial number in the target array can be pre-stored in the cache, and the node summary information of each target node can be synchronously obtained when the target array is obtained from the cache.
[0073] When the node number of the new leaf node is an even number, it means that after the new leaf node is generated, at least a new parent node can be generated based on the new leaf node and the previous leaf node. Among them, the node number of the previous leaf node is the node number of the new leaf node minus 1. Since the target array stores the maximum node number of each layer, for the L0 layer where the leaf node is located, before inserting the new leaf node, the maximum node number of the L0 layer must be in the target array. Therefore, the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node number in the target array can be used to update the node tree to obtain an updated node tree.
[0074] In specific implementation, the step of updating the node tree according to the node summary information of the new leaf node and the node summary information of the target node can be implemented according to the following steps:
[0075] Step 1: Generate the target parent node of the new leaf node and the node summary information of the target parent node based on the node summary information of the new leaf node and the node summary information of the target node corresponding to the largest node number with the first sorting order in the target array.
[0076] Here, the sorting order of each maximum node number in the target array is determined in order from low to high according to the level to which each maximum node number belongs in the node tree. Exemplarily, the L0 layer is lower than the L1 layer, lower than the L2 layer, lower than the L3 layer..., that is, the maximum node number with the first sorting order in the target array is the maximum node number corresponding to the L0 layer, the maximum node number with the second sorting order is the maximum node number corresponding to the L1 layer, and the maximum node number with the third sorting order is the maximum node number corresponding to the L2 layer. Among them, the target node corresponding to the maximum node number with the first sorting order is a leaf node in the node tree.
[0077] In specific implementation, the node summary information of the new leaf node and the node summary information of the target node corresponding to the largest node sequence number that is the first in the sorting order can be added, and then the added summary information is hashed to obtain the target parent node and the summary information of the target parent node. At the same time, the node sequence number of the target parent node can be determined. For example, the sequence numbers corresponding to each layer of nodes in the node tree can be pre-stored. After the target parent node is generated, the sequence number of the target parent node can be determined based on the target level to which the target parent node belongs and the largest node sequence number that matches the target level in the target array; the node sequence number of the target parent node can also be determined based on the largest node sequence numbers in the target array.
[0078] For example, when the target array is [13, 9, 10, 7] and the node number of the new leaf node is 14, the target parent node with node number 11 and the node summary information of the target parent node can be generated based on the node summary information of leaf node 14 and the node summary information of leaf node 13 corresponding to the maximum node number 13.
[0079] Step 2: Determine whether the target node corresponding to the next largest node number in the target array has a generated parent node.
[0080] Here, when the sorting order position of the maximum node sequence number used in step one is the first position, the next maximum node sequence number is the maximum node sequence number with the second position in the sorting order; when the sorting order position of the maximum node sequence number used in step one is N positions, the next maximum node sequence number is the maximum node sequence number with the N+1th position in the sorting order.
[0081] Exemplarily, it is possible to determine whether target node 1 has a generated parent node based on whether there is a parent-child relationship between target node 1 corresponding to the next largest node number and target node 2 corresponding to the next largest node number of the next largest node number. For example, after generating a target parent node with node number 11, it is possible to determine whether there is a parent-child relationship between the target node corresponding to the largest node number 9 in the target array and the target node corresponding to the largest node number 10, and further determine whether the target node corresponding to the largest node number 9 has a generated parent node.
[0082] Step 3: If not, generate a new target parent node and the node summary information of the new target parent node according to the node summary information of the target parent node and the node summary information of the target node corresponding to the next largest node sequence number.
[0083] Here, in the case that the target node corresponding to the next maximum node number does not have a generated parent node, it can be explained that the target parent node can be combined with the target node corresponding to the next maximum node number to generate a new parent node. Therefore, the node summary information of the target parent node and the node summary information of the target node corresponding to the next maximum node number can be used to generate a new target parent node and the node summary information of the new target parent node.
[0084] Step 4: Return to the step of determining whether the target node corresponding to the next largest node number in the target array has a generated parent node, until the target array is traversed or a generated parent node exists.
[0085] Step 5: Update the node tree according to the generated node summary information of each target parent node to obtain an updated node tree.
[0086] Exemplarily, when the target array is [15, 11, 10, 7] and the node number of the new leaf node is 16, a target parent node with a node number of 12 can be generated based on the node summary information of the new leaf node and the node summary information of the target node corresponding to number 15. Then, since there is no generated parent node for the next largest node number 11 in the target array, a new target parent node with a node number of 13 can be generated based on the node summary information of the target parent node with a node number of 12 and the node summary information of the target node corresponding to the next largest node number 11. Furthermore, since there is no generated parent node for the next largest node number 10 in the target array, a new target parent node with a node number of 14 can be generated based on the node summary information of the target node corresponding to the largest node number 10 and the node summary information of the new target parent node with a node number of 13. Furthermore, since the next largest node number 7 in the target array does not have a generated parent node, a new target parent node with a node number of 15 can be generated based on the node summary information of the target node corresponding to the largest node number 7 and the node summary information of the new target parent node with a node number of 14. At this time, since the target array traversal is completed, the node tree can be updated using the new leaf node 16, the target parent node with a node number of 12, the target parent node with a node number of 13, the target parent node with a node number of 14, and the target parent node with a node number of 15 and the node summary information of each node to obtain an updated node tree. At this time, the target array will also be updated to [16, 12, 13, 14, 15].
[0087] In addition, when the target node corresponding to the next largest node number in the target array has a generated parent node, the node tree can be directly updated according to the node summary information of the target parent node of the new leaf node to obtain an updated node tree.
[0088] Here, if the target node corresponding to the next largest node number has a generated parent node, it can be said that the target parent node cannot be combined with the target node corresponding to the next largest node number to generate a new target parent node, that is, the node tree cannot be updated any further. Therefore, the new leaf node and its node summary information, the target parent node and its node summary information can be added to the node tree to complete the update of the node tree.
[0089] Exemplarily, when the target array is [13, 9, 10, 7] and the node number of the new leaf node is 14, after generating the target parent node with the node number 11, it can be determined whether the target node corresponding to the next maximum node number (i.e., node number 9) has a generated parent node. Here, since the target node corresponding to the maximum node number 10 in the target array is the generated parent node of the target node corresponding to the maximum node number 9, it can be determined that the target parent node with the node number 11 cannot be combined with the target node corresponding to the maximum node number 9. Therefore, the new leaf node 14 and its node summary information, the target parent node with the node number 11 and its node summary information can be added to the node tree to update the node tree. At this time, the target array will also be updated to [14, 11, 10, 7].
[0090] In one embodiment, the step of updating the target array using the node sequence number of the new leaf node may be implemented according to the following sub-steps:
[0091] Sub-step 1: Update the verifiable structure array according to the node serial numbers of each newly generated node corresponding to the updated node tree to obtain an updated verifiable structure array; the newly generated node at least includes a new leaf node and a parent node of the new leaf node.
[0092] Exemplarily, after obtaining the updated node tree, the verifiable structure array can be updated according to the node serial numbers of each newly generated node corresponding to the updated node tree and the node connection relationship between each newly generated node to obtain an updated verifiable structure array.
[0093] Wherein, when the node serial number of the new leaf node is an even number, the newly generated node may at least include the new leaf node and the parent node of the new leaf node. When the node serial number of the new leaf node is an odd number, the newly generated node may include the new leaf node.
[0094] Exemplarily, when the target array is [15, 11, 10, 7] and the node number of the new leaf node is 16, the newly generated nodes corresponding to the updated node tree include leaf node 16, intermediate nodes with node number 12, intermediate nodes with node number 13, intermediate nodes with node number 14, and intermediate nodes with node number 15. Subsequently, node number 16 can be added to the L0 layer of the verifiable structure array, node number 12 can be added to the L1 layer of the verifiable structure array, node number 13 can be added to the L2 layer of the verifiable structure array, node number 14 can be added to the L3 layer of the verifiable structure array, node number 15 can be added to the L4 layer of the verifiable structure array, and a connection relationship between each node number can be established in the verifiable structure array. For example, a connection relationship is established between node numbers 15 and 16 of the L0 layer and node number 12 of the L1 layer, a connection relationship is established between node numbers 11 and 12 of the L1 layer and node number 13 of the L2 layer, a connection relationship is established between node numbers 10 and 13 of the L2 layer and node number 14 of the L3 layer, and a connection relationship is established between node numbers 7 and 14 of the L3 layer and node number 15 of the L4 layer. Based on this, the update of the array to be verified can be realized.
[0095] Sub-step 2: Update the target array according to the maximum node number of each layer of the updated verifiable structure array to obtain an updated target array.
[0096] For example, when the target array is [15, 11, 10, 7] and the node number of the new leaf node is 16, the maximum node number in each layer of the updated verifiable structure array is 16 for the L0 layer, 12 for the L1 layer, 13 for the L2 layer, 14 for the L3 layer, and 15 for the L4 layer. Thus, the target array can be updated from [15, 11, 10, 7] to [16, 12, 13, 14, 15].
[0097] Optionally, after obtaining the updated node tree, the target array may be directly updated according to the node sequence numbers of each newly generated node corresponding to the updated node tree and the target level to which each newly generated node belongs, so as to obtain an updated target array.
[0098] Furthermore, after obtaining the updated target array, the updated target array may be used to update the target array stored in the cache.
[0099] Exemplarily, the target array originally stored in the cache can be deleted, and the updated target array can be stored in the cache. At the same time, the node summary information of the target nodes corresponding to each maximum node number in the updated target array can also be stored in the cache, thereby realizing the update of the information stored in the cache.
[0100] In this way, since the amount of data corresponding to the target array is very small and can usually be controlled within a few KB, using cache to store the target array and using the stored target cache to write data can effectively reduce storage pressure and improve data writing efficiency.
[0101] In one embodiment, when the node sequence number of a leaf node is an odd number, the new leaf node and the node summary information it represents can be directly added to the node tree, thereby updating the node tree and obtaining an updated node tree.
[0102] Exemplarily, when the node number of the new leaf node is 15, the new leaf node can be directly added to the L0 layer of the currently constructed node tree. Specifically, it can be added after the leaf node 14 of the L0 layer of the constructed node tree, thereby updating the node tree.
[0103] Further, when the node sequence number of the leaf node is an odd number, for the step of updating the target array, the node sequence number of the new leaf node can be first added to the level matched by the verifiable structure array and the leaf node to obtain the updated verifiable structure array. Here, the level matched by the leaf node is the lowest level in the verifiable structure array. Exemplarily, the node sequence number 15 of the new leaf node can be added after the node sequence number 14 of the L0 layer of the verifiable structure array to obtain the updated verifiable structure array.
[0104] Then, the maximum node number with the first sorting order in the target array can be replaced with the node number of the new leaf node to obtain an updated target array; wherein the sorting order of each maximum node number in the target array is determined in descending order according to the level to which each maximum node number belongs in the node tree. For example, the L0 level is lower than the L1 level, lower than the L2 level, lower than the L3 level...
[0105] For example, when the target array is [14, 11, 10, 7] and the node number of the new leaf node is 15, the node number 15 can be directly used to replace the largest node number 14 that is the first in the sorting order, and the updated target array is [15, 11, 10, 7].
[0106] After obtaining the updated target array, the target array stored in the cache can be updated using the updated target array, and the node summary information of the target nodes corresponding to each maximum node number in the updated target array can be used to update the node summary information stored in the cache.
[0107] In one implementation, in order to reduce resource consumption when updating the target array, when the node sequence number of the new leaf node is an even number, the target array can be updated according to the node sequence numbers of each node except the new leaf node in each newly generated node corresponding to the updated node tree to obtain an updated target array. When the node sequence number of the new leaf node is an odd number, the largest node sequence number that is the first in the sorting order in the target array is directly replaced with the node sequence number of the new leaf node to obtain an updated target array.
[0108] For example, when the target array is [13, 9, 10, 7], if a leaf node with a node number of 14 is generated, the target array can be updated to [13, 11, 10, 7]. After that, when a leaf node with a node number of 15 is generated, the target array can be updated from [13, 11, 10, 7] to [15, 11, 10, 7]. Furthermore, when a leaf node with a node number of 16 is generated, the target array can be updated from [15, 11, 10, 7] to [15, 12, 13, 14, 15]. In this way, based on the node number of the new leaf node, it is determined whether it is necessary to update the maximum node number with the first position in the sorting order, which can effectively reduce the number of writes to update the target array when the node number is an even number, and reduce the resource consumption when updating the target array.
[0109] In one embodiment, after obtaining the updated node tree, the root set summary corresponding to the new leaf node can also be determined based on the updated node tree; the root set summary includes each root set node corresponding to the new leaf node and the node summary information of the root set node.
[0110] Here, the root set summary is the root set of the leaf nodes. Figure 2 For leaf node 1 in , the corresponding root set summary includes leaf node 1 and node summary information of leaf node 1. Figure 2 For leaf node 4 in the L2 layer, the corresponding root set summary includes the node numbered 3 at the L2 layer and the node summary information of the node. Figure 2 For the leaf node 13 in the root set, the corresponding root set summary includes the leaf node 13, the node numbered 10 in the L2 layer, the node numbered 7 in the L3 layer, and the node summary information of these three nodes. Figure 2 For the leaf node 16 in , the corresponding root set summary includes the node with the node number 15 of the L4 layer and the node summary information of the node.
[0111] After determining the root set summary corresponding to the new leaf node, the root set summary corresponding to the new leaf node can be stored in the first target file, and the node summary information of each newly generated node in the updated node tree except the new leaf node can be stored in the second target file.
[0112] Here, each newly generated node in the updated node tree except the new leaf node can be each newly added intermediate node in the updated node tree, that is, the newly added node in each layer except the L0 layer in the updated node tree. Exemplarily, in the case where the new leaf node is leaf node 16, the newly added nodes in each layer except the L0 layer in the updated node tree include intermediate node 12, intermediate node 13, intermediate node 14 and intermediate node 15. The first target file and the second target file are different, and the storage locations are also different. By storing the root set summary corresponding to the new leaf node and the node summary information of each newly generated node except the new leaf node in different files, it is convenient to quickly find the required information from different files according to the node type corresponding to the required node summary information. Among them, the node type includes a leaf node type and an intermediate node type.
[0113] If you need to find the node summary information of the leaf node, you can find it from the first target file; if you need to find the node summary information of the intermediate node, you can find it from the second target file.
[0114] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0115] Based on the same inventive concept, a data writing device corresponding to the data writing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned data writing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0116] like Figure 4 FIG. 1 is a schematic diagram of a data writing device provided by an embodiment of the present disclosure, comprising:
[0117] The acquisition module 401 is used to obtain the currently stored target array from the cache in response to the write operation for the target data; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data;
[0118] A determination module 402, configured to generate node summary information of a new leaf node according to the target data, and determine a node sequence number of the new leaf node according to the target array;
[0119] The update module 403 is used to update the node tree according to the node summary information of the new leaf node to obtain an updated node tree, and use the node sequence number of the new leaf node to update the target array to obtain an updated target array; wherein, the completion of the node tree update is used to indicate that the target data is written successfully.
[0120] In a possible implementation, the updating module 403, when updating the node tree according to the node summary information of the new leaf node to obtain the updated node tree, is used to:
[0121] When the node sequence number is an even number, the node tree is updated according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain an updated node tree; the node summary information of the target node is stored in the cache.
[0122] In a possible implementation manner, the updating module 403, when updating the target array using the node sequence number of the new leaf node to obtain the updated target array, is used to:
[0123] According to the node sequence numbers and node connection relationships of each newly generated node corresponding to the updated node tree, the verifiable structure array is updated to obtain an updated verifiable structure array; the newly generated node at least includes the new leaf node and the parent node of the new leaf node;
[0124] According to the maximum node sequence number of each layer of the updated verifiable structure array, the target array is updated to obtain an updated target array;
[0125] Furthermore, after obtaining the updated target array, the updating module 403 is further configured to:
[0126] The target array stored in the cache is updated using the updated target array.
[0127] In a possible implementation, when the node sequence number is an odd number, the updating module 403, when updating the target array using the node sequence number of the new leaf node to obtain the updated target array, is used to:
[0128] Adding the node serial number of the new leaf node to the level where the verifiable structure array matches the leaf node to obtain the updated verifiable structure array;
[0129] The maximum node number with the first sorting order in the target array is replaced with the node number of the new leaf node to obtain an updated target array; wherein the sorting order of each maximum node number in the target array is determined in descending order according to the level to which each maximum node number belongs in the node tree.
[0130] In a possible implementation, the updating module 403, when updating the node tree according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain the updated node tree, is used to:
[0131] Generate a target parent node of the new leaf node and node summary information of the target parent node according to the node summary information of the new leaf node and the node summary information of the target node corresponding to the largest node sequence number with the first sorting order in the target array;
[0132] Determine whether the target node corresponding to the next largest node sequence number in the target array has a generated parent node;
[0133] If not, generating a new target parent node and the node summary information of the new target parent node according to the node summary information of the target parent node and the node summary information of the target node corresponding to the next largest node sequence number;
[0134] Return to the step of determining whether a target node corresponding to the next largest node sequence number in the target array has a generated parent node, until the target array traversal is completed or a generated parent node exists;
[0135] The node tree is updated according to the generated node summary information of each target parent node to obtain an updated node tree.
[0136] In a possible implementation manner, the updating module 403 is further configured to:
[0137] In the case that the target node corresponding to the next largest node number in the target array has a generated parent node, the node tree is updated according to the node summary information of the target parent node of the new leaf node to obtain an updated node tree.
[0138] In a possible implementation, the device further includes a storage module 404:
[0139] After obtaining the updated node tree, the storage module 404 is used to:
[0140] Determine the root set summary corresponding to the new leaf node according to the updated node tree; the root set summary includes each root set node corresponding to the new leaf node and node summary information of the root set node;
[0141] The root set summary corresponding to the new leaf node is stored in the first target file, and the node summary information of each newly generated node in the updated node tree except the new leaf node is stored in the second target file.
[0142] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0143] Based on the same technical concept, the embodiment of the present application also provides a computer device. Figure 5 FIG. 1 is a schematic diagram of a computer device provided in an embodiment of the present application, including:
[0144] Processor 51, memory 52 and bus 53. The memory 52 stores machine-readable instructions executable by the processor 51, and the processor 51 is used to execute the machine-readable instructions stored in the memory 52. When the machine-readable instructions are executed by the processor 51, the processor 51 performs the following steps: S101: In response to a write operation for target data, the currently stored target array is obtained from the cache; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent the summary information of the written data; S102: generate node summary information of new leaf nodes according to the target data, and determine the node sequence number of the new leaf node according to the target array; S103: update the node tree according to the node summary information of the new leaf node to obtain an updated node tree, and use the node sequence number of the new leaf node to update the target array to obtain an updated target array; wherein the completion of the node tree update is used to represent the successful writing of the target data.
[0145] The above-mentioned memory 52 includes a memory 521 and an external memory 522; the memory 521 here is also called an internal memory, which is used to temporarily store the calculation data in the processor 51, as well as the data exchanged with the external memory 522 such as a hard disk. The processor 51 exchanges data with the external memory 522 through the memory 521. When the computer device is running, the processor 51 and the memory 52 communicate through the bus 53, so that the processor 51 executes the execution instructions mentioned in the above-mentioned method embodiment.
[0146] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data writing method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0147] The computer program product of the data writing method provided in the embodiment of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the steps of the data writing method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0148] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0149] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0154] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A data writing method, characterized in that: include: In response to a write operation for target data, a currently stored target array is obtained from a cache; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data; Generate node summary information of a new leaf node according to the target data, and determine the node sequence number of the new leaf node according to the target array; The node tree is updated according to the node summary information of the new leaf node to obtain an updated node tree, and the target array is updated using the node sequence number of the new leaf node to obtain an updated target array; wherein, the completion of the node tree update is used to indicate that the target data is written successfully.
2. The method according to claim 1, characterized in that The updating of the node tree according to the node summary information of the new leaf node to obtain an updated node tree includes: When the node sequence number is an even number, the node tree is updated according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain an updated node tree; the node summary information of the target node is stored in the cache.
3. The method according to claim 2, characterized in that The method of updating the target array by using the node sequence number of the new leaf node to obtain an updated target array includes: According to the node sequence numbers and node connection relationships of each newly generated node corresponding to the updated node tree, the verifiable structure array is updated to obtain an updated verifiable structure array; the newly generated node at least includes the new leaf node and the parent node of the new leaf node; According to the maximum node sequence number of each layer of the updated verifiable structure array, the target array is updated to obtain an updated target array; After obtaining the updated target array, the method further includes: The target array stored in the cache is updated using the updated target array.
4. The method according to claim 1, characterized in that: In the case where the node sequence number is an odd number, the target array is updated using the node sequence number of the new leaf node to obtain an updated target array, including: Adding the node serial number of the new leaf node to the level where the verifiable structure array matches the leaf node to obtain the updated verifiable structure array; The maximum node number with the first sorting order in the target array is replaced with the node number of the new leaf node to obtain an updated target array; wherein the sorting order of each maximum node number in the target array is determined in descending order according to the level to which each maximum node number belongs in the node tree.
5. The method according to claim 2, characterized in that: The updating of the node tree according to the node summary information of the new leaf node and the node summary information of the target node corresponding to at least one maximum node sequence number in the target array to obtain an updated node tree includes: Generate a target parent node of the new leaf node and node summary information of the target parent node according to the node summary information of the new leaf node and the node summary information of the target node corresponding to the largest node sequence number with the first sorting order in the target array; Determine whether the target node corresponding to the next largest node sequence number in the target array has a generated parent node; If not, generating a new target parent node and the node summary information of the new target parent node according to the node summary information of the target parent node and the node summary information of the target node corresponding to the next largest node sequence number; Return to the step of determining whether a target node corresponding to the next largest node sequence number in the target array has a generated parent node, until the target array traversal is completed or a generated parent node exists; The node tree is updated according to the generated node summary information of each target parent node to obtain an updated node tree.
6. The method according to claim 5, characterized in that The method further comprises: In the case that the target node corresponding to the next largest node number in the target array has a generated parent node, the node tree is updated according to the node summary information of the target parent node of the new leaf node to obtain an updated node tree.
7. The method according to claim 1, characterized in that After getting the updated node tree, it also includes: Determine the root set summary corresponding to the new leaf node according to the updated node tree; the root set summary includes each root set node corresponding to the new leaf node and node summary information of the root set node; The root set summary corresponding to the new leaf node is stored in the first target file, and the node summary information of each newly generated node in the updated node tree except the new leaf node is stored in the second target file.
8. A data writing device, characterized in that: include: An acquisition module, configured to acquire a currently stored target array from a cache in response to a write operation for target data; the target array includes the maximum node sequence number of each layer in the currently established verifiable structure array; the verifiable structure array is determined according to the node sequence number and node connection relationship of each node in the currently constructed node tree, and has a hierarchical structure consistent with the node tree; the nodes in the node tree are used to represent summary information of the written data; A determination module, used to generate node summary information of a new leaf node according to the target data, and determine a node sequence number of the new leaf node according to the target array; An update module is used to update the node tree according to the node summary information of the new leaf node to obtain an updated node tree, and to update the target array using the node sequence number of the new leaf node to obtain an updated target array; wherein the completion of the node tree update is used to indicate that the target data has been written successfully.
9. A computer device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the processor executes the steps of the data writing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the data writing method according to any one of claims 1 to 7.
