Data storage method, electronic device, readable storage medium and program product

By selecting the target secondary block in the directed acyclic graph blockchain storage model, binding and signing and verification, the problem of low data storage efficiency caused by the Genesis block fork is solved, and efficient data is achieved storage.

CN119045745APending Publication Date: 2024-11-29MIGU CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411273454.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The blockchain storage model based on directed acyclic graph results in low data storage efficiency in the case of Genesis block forking, which requires a lot of computing resources to address reliable blocks.

Method used

Select the target secondary block bound to the partition from multiple secondary blocks, store the data in the block or the blocks generated by it, and ensure the reliability of data storage through binding and sign-up verification mechanisms and efficiency.

Benefits of technology

Save computing resources, improve data storage efficiency, avoid performance bottlenecks caused by forking in the blockchain storage model, and realize efficient data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119045745A_ABST
    Figure CN119045745A_ABST
Patent Text Reader

Abstract

The invention discloses a data storage method, electronic equipment, a readable storage medium and a program product, and belongs to the technical field of computers.The data storage method in the embodiment of the invention comprises the steps that first data is extracted from a first partition; selecting a target secondary block bound with the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; wherein the plurality of second-level blocks are a plurality of different next-level blocks of a creation block of the storage model; and storing the first data and / or data obtained based on the first data to the target secondary block or a block generated based on the target secondary block. Therefore, the data storage efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and specifically relates to a data storage method, an electronic device, a readable storage medium, and a program product. Background Art

[0002] In order to improve storage performance, a blockchain storage model based on a directed acyclic graph (DAG) is proposed in the related art. The genesis block of this storage model has multiple forks, that is, multiple different block topological orders are created under the genesis block. In this case, when storing data, a large amount of computing resources are required to address reliable blocks for data storage, resulting in low data storage efficiency. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a data storage method, an electronic device, a readable storage medium, and a program product to solve the problem of low data storage efficiency in the related art.

[0004] In order to solve the above technical problems, this application is implemented as follows:

[0005] In a first aspect, a data storage method is provided, comprising:

[0006] Extracting first data from a first partition; the first partition is: any partition among all partitions used for caching or storing data;

[0007] Selecting a target secondary block bound to the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; wherein the plurality of secondary blocks are a plurality of different next-level blocks of a genesis block of the storage model;

[0008] The first data and / or data obtained based on the first data are stored in the target secondary block or a block generated based on the target secondary block.

[0009] Optionally, the method further includes:

[0010] Create a new partition;

[0011] A new secondary block is created under the genesis block of the storage model, and the newly created secondary block is bound to the new partition.

[0012] Optionally, the method further includes:

[0013] When it is detected that there is data in the new partition, extracting second data from the new partition;

[0014] Signing the second data to obtain signed data, and storing the signed data in the newly created secondary block;

[0015] The signed data in the newly created secondary block is verified by the genesis block. If the verification is successful, the genesis block is bound to the newly created secondary block; if the verification fails, the genesis block is not bound to the newly created secondary block.

[0016] Optionally, after selecting the target secondary block bound to the first partition from the plurality of secondary blocks based on the storage model of the directed acyclic graph, the method further includes:

[0017] If the target secondary block has a next-level block, determine the block topology order corresponding to the target secondary block, and determine the terminal block corresponding to the target secondary block according to the block topology order;

[0018] Based on the terminal block, generating a new block pointing to the terminal block;

[0019] The storing the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block includes:

[0020] The first data and / or data obtained based on the first data are stored in the new block.

[0021] Optionally, if it is determined that there are multiple block topological sortings corresponding to the target secondary block, the method further includes:

[0022] Select a block topological sorting from multiple block topological sortings;

[0023] The step of determining the terminal block corresponding to the target secondary block according to the block topological sorting includes:

[0024] The last block in the topological sorting of the blocks is determined as the terminal block corresponding to the target secondary block.

[0025] Optionally, if the first data and the data stored in the second partition are correlated, before storing the first data and / or the data obtained based on the first data in the target secondary block or a block generated based on the target secondary block, the method further includes:

[0026] When it is detected that there is data in the second partition, third data is extracted from the second partition, and the first data and the third data are associated to obtain processed data;

[0027] Selecting a secondary block bound to the second partition from a plurality of secondary blocks of the storage model;

[0028] The storing the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block includes:

[0029] The processed data is stored in a first block, wherein the first block is a block generated based on the target secondary block and a secondary block bound to the second partition.

[0030] Optionally, before extracting the first data from the first partition, the method further includes:

[0031] Determining the number of forks of the storage model according to the number of partitions created for caching data;

[0032] According to the number of forks, a new secondary block is created under the genesis block of the storage model, and a binding relationship between the newly created secondary block and the created partition is established.

[0033] In a second aspect, a data storage device is provided, comprising:

[0034] A first extraction module is used to extract first data from a first partition; the first partition is: any partition among all partitions used for caching or storing data;

[0035] A first selection module is used to select a target secondary block bound to the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; wherein the plurality of secondary blocks are a plurality of different next-level blocks of a genesis block of the storage model;

[0036] The first storage module is used to store the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block.

[0037] In a third aspect, an electronic device is provided, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0038] In a fourth aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0039] In a fifth aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0040] Through the scheme in the embodiment of the present application, after extracting the first data from the first partition, the target secondary block bound to the first partition can be selected from multiple secondary blocks based on the storage model of the directed acyclic graph, and the first data and / or the data obtained based on the first data can be stored in the target secondary block or the block generated based on the target secondary block. Thus, by binding different partitions to different secondary blocks, the data extracted from different partitions can be directly stored in the corresponding secondary blocks or the blocks generated based on the secondary blocks, without consuming a large amount of computing resources to address reliable blocks, thereby saving computing resources and improving data storage efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a flow chart of a data storage method provided by an embodiment of the present application;

[0042] Figure 2 is a schematic diagram of the system architecture in an embodiment of the present application;

[0043] Figure 3 is a structural schematic diagram of a data storage device provided in an embodiment of the present application;

[0044] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.

[0047] In order to facilitate understanding of the embodiments of the present application, the following contents are first described.

[0048] For a directed acyclic graph (DAG), "directed" means there is a direction, and "acyclic" means there is no loop. The DAG structure allows each vertex to point to the previous vertex, and the entire data flow has an obvious direction.

[0049] Blockchain technology is a technology in which several computing devices jointly participate in the distributed ledger and jointly maintain a complete distributed intelligent database. Blockchain technology has been widely used because it is decentralized, open and transparent, each computing device can participate in database records, and each computing device can quickly synchronize data and execute consistency. The storage model in the embodiment of this application can be understood as a blockchain storage model.

[0050] The Genesis Block, also known as the Genesis Block, is the first block in the blockchain network. It is regarded as the origin of the entire blockchain and contains the initial data and parameters. The generation of the Genesis Block is the beginning of the blockchain system and the consensus basis of the entire blockchain network.

[0051] Optionally, the data in the embodiments of the present application, such as the first data, the second data, the third data, the fourth data, etc., may be business information, business messages, etc., and are not limited to this.

[0052] The data storage method, electronic device, readable storage medium and program product provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0053] See also Figure 1 , Figure 1 is a flowchart of a data storage method provided in an embodiment of the present application, which is applied to entities involving data storage, such as business systems, storage systems, etc. Figure 1 As shown, the method comprises the following steps:

[0054] Step 11: extracting first data from the first partition;

[0055] Step 12: Select a target secondary block bound to the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; the plurality of secondary blocks are a plurality of different next-level blocks of a genesis block of the storage model (i.e., the first block generated after the genesis block); the genesis block is specifically the first block of the storage model;

[0056] Step 13: Store the first data and / or data obtained based on the first data in a target secondary block or a block generated based on the target secondary block.

[0057] In the embodiment of the present application, the first partition is: any partition among all partitions used for caching or storing data. That is, the first partition can be any partition among all partitions that have been created for caching or storing data. The data in different created partitions can be the same type of business data or different types of business data; can be related business data or unrelated business data; there is no limitation on this.

[0058] Optionally, the first partition may be a kafka partition, a message queue (MQ), etc., without limitation. For kafka partitions, the corresponding supported partitioning strategies may be selected as but not limited to: 1) Round-robin strategy, which evenly distributes data to all partitions; 2) Random strategy, which randomly distributes data to all partitions; 3) Consistent Hashing strategy, which distributes data to partitions so that data with the same key is always distributed to the same partition; 4) Key Partitioning strategy, which distributes data to partitions so that data with the same key is always distributed to the same partition; 5) Range Partitioning strategy, which distributes data to partitions so that data with keys in the same range is always distributed to the same partition.

[0059] For the first partition, a created thread (such as a consumer thread) can be used to monitor whether there is data therein, and when it is monitored that there is data in the first partition, the data is extracted from the first partition.

[0060] The extracting of the first data from the first partition may also be expressed as obtaining the first data from the first partition, consuming the first data in the first partition, etc. The extracting in this embodiment may be expressed as obtaining, consuming, etc.

[0061] The data obtained based on the first data may be data obtained after de-redundancy, calculation, and other processing is performed on the first data, or may be data obtained after merging, calculating, and other processing is performed on the first data and data associated / related thereto; there is no limitation on this.

[0062] The storage model can be understood as a blockchain storage model based on a directed acyclic graph. The storage model based on a directed acyclic graph can be abbreviated as a DAG storage model.

[0063] The block generated based on the target secondary block can be a next-level block of the target secondary block, such as a new block generated based on the target secondary block and pointing to the target secondary block; it can also be the terminal block in the block topological sorting corresponding to the target secondary block, or a new block generated based on the terminal block and pointing to the terminal block, etc.

[0064] Different created partitions can be bound to different secondary blocks of the storage model based on the directed acyclic graph, that is, a binding relationship between the created partitions and the secondary blocks is established.

[0065] In an optional implementation, the upstream module of the business system can store the business data into a created partition (such as a Kafka partition) after completing business processing; the downstream module extracts the business data by listening to the corresponding partition and stores the business data in a block bound to the partition.

[0066] Through the scheme in the embodiment of the present application, after extracting the first data from the first partition, the target secondary block bound to the first partition can be selected from multiple secondary blocks based on the storage model of the directed acyclic graph, and the first data and / or the data obtained based on the first data can be stored in the target secondary block or the block generated based on the target secondary block. Thus, by binding different partitions to different secondary blocks, the data extracted from different partitions can be directly stored in the corresponding secondary blocks or the blocks generated based on the secondary blocks, without consuming a large amount of computing resources to address reliable blocks, thereby saving computing resources and improving data storage efficiency.

[0067] In an embodiment of the present application, a storage model based on a directed acyclic graph can be constructed based on the number of partitions created during the business flow. Before extracting the first data from the first partition, the data storage method in this embodiment can also include:

[0068] According to the number of partitions (such as Kafka partitions) created for caching data, the number of forks of the storage model based on the directed acyclic graph is determined; for example, the number of created partitions can be directly determined as the number of forks of the DAG storage model; for example, if the number of created partitions is 10, the number of forks of the DAG storage model can be determined to be 10; or, if the number of created partitions is 15, the number of forks of the DAG storage model can be determined to be 15;

[0069] According to the number of forks, a new secondary block is created under the genesis block of the storage model, and a binding relationship between the newly created secondary block and the created partition is established.

[0070] In this way, by determining the number of forks of the DAG storage model according to the number of created partitions, it can be ensured that the DAG storage model is generated in combination with the business model, thereby effectively improving the performance of data storage in the DAG storage model; further, with the help of the above binding relationship, data extracted from different partitions can be directly stored in the corresponding bound secondary blocks or blocks generated based on the secondary blocks, without consuming a large amount of computing resources to address reliable blocks, thereby saving computing resources and improving data storage efficiency.

[0071] In the embodiment of the present application, by binding different partitions to the corresponding secondary blocks of the DAG storage model, when the DAG storage model has performance bottlenecks during business processing and needs to be expanded, dynamic expansion based on the number of partitions can be achieved. The above data storage method may also include:

[0072] Create a new partition; for example, the partition can be a kafka partition;

[0073] A new secondary block is created under the genesis block of the storage model, and the newly created secondary block is bound to the new partition.

[0074] In this way, by creating new partitions, the number of partitions can be expanded, and the secondary blocks of the DAG storage model can be dynamically expanded, thereby improving the performance of the DAG storage model.

[0075] Optionally, in order to ensure the reliability of the newly added block, a verification operation may be introduced. After the newly created secondary block is bound to the new partition, the data storage method in this embodiment may further include:

[0076] When it is monitored that there is data in the new partition, second data is extracted from the new partition; for example, the second data may be a business message, etc.; the new partition may be monitored through a created thread (such as a consumer thread) to see whether there is data therein;

[0077] Signing the second data to obtain signed data, and storing the signed data in the newly created secondary block; signing can be understood as encryption, for example, the second data can be encrypted using a public key;

[0078] The signed data in the newly created secondary block is verified by the genesis block. If the verification is successful, the newly added secondary block is confirmed to be reliable (i.e., the downstream module associated with the secondary block is reliable), and the binding (i.e., business association) between the genesis block and the newly created secondary block is established to ensure that the topological sorting can be traced back to the genesis block; if the verification fails, the reliability of the newly added block cannot be guaranteed (i.e., the downstream module associated with the secondary block is unreliable), and the genesis block is not bound to the newly created secondary block, that is, the binding between the genesis block and the newly created secondary block is not established, and no new block is generated / created based on this secondary block. The verification can be understood as decryption, for example, the private key corresponding to the above public key can be used for decryption.

[0079] In this way, with the help of signing and verifying operations, the reliability of the expanded block can be guaranteed.

[0080] In the embodiment of the present application, as the block nodes increase, it is necessary to obtain the terminal block (also called leaf node) corresponding to the secondary block when creating a new block. After selecting the target secondary block bound to the first partition from the multiple secondary blocks based on the storage model of the directed acyclic graph, the data storage method in this embodiment may also include:

[0081] If the target secondary block has a block of the next level, determine the block topology sorting corresponding to the target secondary block, and determine the end block (i.e., the last block) corresponding to the target secondary block according to the block topology sorting;

[0082] Based on the end block, a new block pointing to the end block is generated.

[0083] The storing of the first data and / or data obtained based on the first data in a target secondary block or a block generated based on the target secondary block includes:

[0084] The first data and / or data obtained based on the first data are stored in the new block, so that the extracted data can be stored in a suitable block.

[0085] Optionally, if it is determined that there are multiple block topological sortings corresponding to the target secondary block, the data storage method in this embodiment may further include:

[0086] Select a block topology sorting from multiple block topology sortings; for example, a block topology sorting may be randomly selected from multiple block topology sortings;

[0087] The step of determining the terminal block corresponding to the target secondary block according to the block topological sorting includes:

[0088] The last block in the topological sorting of the blocks is determined as the terminal block corresponding to the target secondary block.

[0089] Optionally, if the first data and the data stored in the second partition are correlated, before storing the first data and / or the data obtained based on the first data in the target secondary block or the block generated based on the target secondary block, the data storage method in this embodiment may further include:

[0090] When it is detected that there is data in the second partition, third data is extracted from the second partition, and the first data and the third data are associated to obtain processed data;

[0091] A secondary block bound to the second partition is selected from the plurality of secondary blocks of the storage model.

[0092] Storing the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block includes: storing the processed data in a first block, wherein the first block is a block generated based on the target secondary block and a secondary block bound to the second partition.

[0093] For example, if the first data in the first partition is a transaction list, and the third data in the second partition is a transaction amount, it can be determined that the first data (i.e., the transaction list) and the third data (i.e., the transaction amount) are correlated; in this case, the first data (i.e., the transaction list) and the third data (i.e., the transaction amount) can be associated to obtain associated data. If the secondary block bound to the first partition is secondary block 1, the secondary block bound to the second partition is secondary block 2, and the block generated based on secondary block 1 and secondary block 2 is block 3, that is, the next-level block common to both secondary block 1 and secondary block 2 is block 3, then the above-mentioned associated data can be stored in block 3.

[0094] In this way, the processing results of related data can be stored in the same block, thereby saving storage space and facilitating direct acquisition of the processing results later.

[0095] Combine the following Figure 2 The specific embodiments of the present application are described.

[0096] In the specific embodiment of the present application, the storage model based on the directed acyclic graph (DAG) is expanded, and the ledger model of the directed acyclic graph (DAG) is used in combination with the partitioning characteristics of Kafka. In addition, the number of forks of the DAG storage model is determined based on the number of Kafka partitions in the business flow process; after extracting data from different partitions of Kafka, the downstream module of the corresponding secondary block processes the data and stores it in the corresponding secondary block or a block generated based on the secondary block. Figure 2 As shown, the business system in the specific embodiment of the present application may mainly include the following parts:

[0097] 1) Upstream module: After completing the relevant business processing, the upstream module can store the relevant data in the Kafka partition.

[0098] 2) Downstream module: The downstream module obtains business data by listening to the Kafka partition. When the downstream module is just expanded and needs to generate a secondary block, the data in the secondary block needs to be signed to ensure that the added downstream module is reliable. After being signed by the Genesis block, the data in the Kafka partition is obtained / extracted, and the leaf block is addressed through topological sorting, and a new block is generated based on the leaf block. Each secondary partition corresponds to a downstream module.

[0099] 3) Partition0 (abbreviated as P0), Partition1 (abbreviated as P1), Partition2 (abbreviated as P2), Partition3 (abbreviated as P3) and Partition4 (abbreviated as P4): represent Kafka partitions; to improve business processing performance, the upstream module stores data in different Kafka partitions; when the downstream module extracts data, the consumer thread is initialized according to the number of Kafka partitions.

[0100] 4) A1-A5: Based on the secondary blocks of DAG, a corresponding number of secondary blocks are established according to the number of Kafka partitions, and different Kafka partitions are bound to corresponding secondary blocks.

[0101] 5) BH: represents other blocks based on DAG, which are used to store data extracted from Kafka partitions into the corresponding blocks of different secondary blocks A1-A5.

[0102] 6) Genesis: represents the genesis block of the DAG-based storage model. All DAG secondary blocks point to the genesis block Genesis to connect all block ledgers. When a newly added downstream module needs to establish a secondary block, Genesis verifies the signature data of the downstream module. Only the secondary blocks that pass the verification can be associated with the genesis block Genesis for business, ensuring that its topological sorting can be traced back to the genesis block Genesis.

[0103] against Figure 2 The system architecture shown, the relevant processing flow may at least include:

[0104] S1: After the upstream module completes business processing, it stores the business data in the Kafka partition, for example, storing the business data in p0-p3;

[0105] S2: The downstream module monitors different partitions of Kafka according to the number of Kafka partitions; the data in the p0 partition is consumed / extracted by the corresponding downstream module and stored in the secondary block A1, the data in the p1 partition is consumed / extracted by the corresponding downstream module and stored in the secondary block A2, the data in the p2 partition is consumed / extracted by the corresponding downstream module and stored in the secondary block A3, and the data in the p3 partition is consumed / extracted by the corresponding downstream module and stored in the secondary block A4; thus, it is not necessary to consume a lot of computing resources to address reliable blocks, thereby saving computing resources;

[0106] S3: Assuming that the consumer thread listening to the p0 partition obtains new data and stores it in the block, the data extracted from the p0 partition is stored in a new block B pointing to A1 generated based on the A1 block;

[0107] S4: If the business data stored in the p1 partition and the p2 partition are correlated, the downstream module extracts the data in the p1 partition and the p2 partition, performs business correlation processing, and stores the processed data in the new block C generated based on the A2 block and the A3 block;

[0108] S5: After extracting data from different partitions, the leaf nodes (i.e., terminal blocks) corresponding to blocks A1-A4 are determined through directed acyclic graph topological sorting, and different new blocks are generated based on different leaf nodes; for example, the data extracted from partition p0 is stored in secondary block A1, and E-->B-->A1-->Genesis is obtained through the topological sorting algorithm, confirming that the leaf node corresponding to block A1 is block E, and the downstream module corresponding to A1 stores the data extracted from partition p0 in the new block generated based on block E;

[0109] S6: For scenarios where there are multiple topological sortings, a leaf node of a topological sorting can be randomly selected and a new block can be generated. For example, for extracting data from the p1 partition, there are two topological sortings, F-->C-->A2-->Genesis and G-->C-->A2-->Genesis. After extracting data from p1, one of the two topological sortings can be selected, such as G-->C-->A2-->Genesis, and the leaf node obtained is block G. The data extracted from p1 is stored in a new block generated based on block G.

[0110] S7: If the DAG storage model has performance bottlenecks during business processing and needs to be expanded, it can be dynamically expanded based on the number of Kafka partitions. For example, the number of Kafka partitions can be adjusted from 4 to 5, and a partition Partition4 can be added. The downstream module adds consumer threads, and the DAG storage model adds a secondary block A5 accordingly. The data cache is extracted from p4 and a new block is generated based on the A5 block to complete the dynamic expansion of the block.

[0111] S8: In order to ensure the reliability of the consumer thread of the newly added downstream module, when the newly created secondary block A5 and the Genesis block Genesis are doing business association, the Genesis block will verify the transaction data of the secondary block A5, and after Genesis completes the verification of the secondary block A5, it is confirmed that the consumer thread of the newly added business module is reliable, and the business association between the secondary block A5 and the Genesis block Genesis is completed at the same time, ensuring that it can be traced back to the Genesis block Genesis during the subsequent topological sorting. The downstream modules associated with the secondary blocks that cannot be traced back to the Genesis block Genesis during the topological sorting are considered unreliable, and new blocks cannot be created.

[0112] S9: Assuming that a new downstream module needs to consume data and create a new secondary block X, when the Genesis block checks the transaction data of the secondary block X, the check fails and the reliability of the new downstream module cannot be guaranteed. Then the Genesis block will not be associated with the secondary block X, and the secondary block X cannot point to the Genesis block. When the business data is consumed later, since the topological sorting cannot be traced back to the Genesis block, a new block cannot be created based on the secondary block X.

[0113] S10: To ensure that data is not lost, only after the data is extracted from the Kafka partition and topologically sorted and traced back to the Genesis block, and the data is stored in the newly generated block, the downstream module consumer thread will confirm the data extracted from the Kafka partition; before the data is stored in the newly generated block, the downstream module will not confirm it, and the data will still be saved in the Kafka file.

[0114] S11: The IP address of the downstream module that fails to verify the signature multiple times (configurable) will be added to the blacklist and will not be allowed to consume the business data. If this happens in the alliance chain scenario, the credit of the organization to which the downstream module belongs will also be affected.

[0115] It should be noted that the data storage method provided in the embodiment of the present application can be executed by a data storage device or a control module in the data storage device for executing the data storage method. In the embodiment of the present application, the data storage device provided in the embodiment of the present application is described by taking the data storage device executing the data storage method as an example.

[0116] See also Figure 3 , Figure 3 is a schematic diagram of a data storage device provided in an embodiment of the present application, which is applied to entities involving data storage, such as business systems, storage systems, etc. Figure 3 As shown, the data storage device 30 includes:

[0117] A first extraction module 31 is used to extract first data from a first partition; the first partition is: any partition among all partitions used for caching or storing data;

[0118] A first selection module 32 is used to select a target secondary block bound to the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; wherein the plurality of secondary blocks are a plurality of different next-level blocks of a genesis block of the storage model;

[0119] The storage module 33 is used to store the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block.

[0120] Through the scheme in the embodiment of the present application, after extracting the first data from the first partition, the target secondary block bound to the first partition can be selected from multiple secondary blocks based on the storage model of the directed acyclic graph, and the first data and / or the data obtained based on the first data can be stored in the target secondary block or the block generated based on the target secondary block. Thus, by binding different partitions to different secondary blocks, the data extracted from different partitions can be directly stored in the corresponding secondary blocks or the blocks generated based on the secondary blocks, without consuming a large amount of computing resources to address reliable blocks, thereby saving computing resources and improving data storage efficiency.

[0121] Optionally, the data storage device 30 further includes:

[0122] Create module, used to create new partitions;

[0123] The processing module is used to create a new secondary block under the genesis block of the storage model, and bind the newly created secondary block to the new partition.

[0124] Optionally, the data storage device 30 further includes:

[0125] A second extraction module, configured to extract second data from the new partition when detecting that there is data in the new partition;

[0126] A signing module, used for signing the second data to obtain the signed data, and storing the signed data in the newly created secondary block;

[0127] The signature verification module is used to verify the signed data in the newly created secondary block through the genesis block. If the signature verification is successful, the genesis block is bound to the newly created secondary block; if the signature verification fails, the genesis block is not bound to the newly created secondary block.

[0128] Optionally, the data storage device 30 further includes:

[0129] A first determination module is used to determine a block topology order corresponding to the target secondary block when there is a block of the next level for the target secondary block, and determine a terminal block corresponding to the target secondary block according to the block topology order;

[0130] A generation module, configured to generate a new block pointing to the terminal block based on the terminal block;

[0131] The first storage module 33 is specifically configured to store the first data and / or data obtained based on the first data in the new block.

[0132] Optionally, the data storage device 30 further includes:

[0133] A selection module, configured to select a block topology sorting from the multiple block topology sortings when determining that there are multiple block topology sortings corresponding to the target secondary block;

[0134] The first determination module is specifically used to determine the last block in the topological sorting of the one block as the terminal block corresponding to the target secondary block.

[0135] Optionally, the data storage device 30 further includes:

[0136] an association processing module, configured to extract third data from the second partition when the first data and the data stored in the second partition are correlated and when it is detected that there is data in the second partition, and to perform association processing on the first data and the third data to obtain processed data;

[0137] A second selection module, configured to select a secondary block bound to the second partition from a plurality of secondary blocks of the storage model;

[0138] The storage module 33 is specifically configured to store the processed data in a first block, wherein the first block is a block generated based on the target secondary block and the secondary block bound to the second partition.

[0139] Optionally, the data storage device 30 further includes:

[0140] A second determination module, configured to determine the number of forks of the storage model according to the number of partitions created for caching data;

[0141] An establishment module is used to create a new secondary block under the genesis block of the storage model according to the number of forks, and establish a binding relationship between the newly created secondary block and the created partition.

[0142] The data storage device 30 of the embodiment of the present application can realize the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.

[0143] Optional, such as Figure 4 As shown, an embodiment of the present application also provides an electronic device 40, including a processor 41, a memory 42, and a program or instruction stored in the memory 42 and executable on the processor 41. When the program or instruction is executed by the processor 41, each process of the above-mentioned data storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0144] The present application also provides a computer program product, including computer instructions, which can achieve the above-mentioned Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and to avoid repetition, they will not be described again here.

[0145] The embodiment of the present application also provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned data storage method embodiment can be implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0146] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0147] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0148] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a service classification device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0150] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data storage method, characterized in that: include: extracting first data from the first partition; The first partition is: any partition among all partitions used for caching or storing data; Selecting a target secondary block bound to the first partition from a plurality of secondary blocks of a storage model based on a directed acyclic graph; wherein the plurality of secondary blocks are a plurality of different next-level blocks of a genesis block of the storage model; The first data and / or data obtained based on the first data are stored in the target secondary block or a block generated based on the target secondary block.

2. The method according to claim 1, characterized in that The method further comprises: Create a new partition; A new secondary block is created under the genesis block of the storage model, and the newly created secondary block is bound to the new partition.

3. The method according to claim 2, characterized in that The method further comprises: When it is detected that there is data in the new partition, extracting second data from the new partition; Signing the second data to obtain signed data, and storing the signed data in the newly created secondary block; The signed data in the newly created secondary block is verified by the genesis block. If the verification is successful, the genesis block is bound to the newly created secondary block; if the verification fails, the genesis block is not bound to the newly created secondary block.

4. The method according to claim 1, characterized in that: After selecting the target secondary block bound to the first partition from the plurality of secondary blocks based on the storage model of the directed acyclic graph, the method further includes: If the target secondary block has a next-level block, determine the block topology order corresponding to the target secondary block, and determine the terminal block corresponding to the target secondary block according to the block topology order; Based on the terminal block, generating a new block pointing to the terminal block; The storing the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block includes: The first data and / or data obtained based on the first data are stored in the new block.

5. The method according to claim 4, characterized in that If it is determined that there are multiple block topological sortings corresponding to the target secondary block, the method further includes: Select a block topological sorting from multiple block topological sortings; The step of determining the terminal block corresponding to the target secondary block according to the block topological sorting includes: The last block in the topological sorting of the blocks is determined as the terminal block corresponding to the target secondary block.

6. The method according to claim 1, characterized in that If the first data and the data stored in the second partition are correlated, before storing the first data and / or the data obtained based on the first data in the target secondary block or a block generated based on the target secondary block, the method further includes: When it is detected that there is data in the second partition, third data is extracted from the second partition, and the first data and the third data are associated to obtain processed data; Selecting a secondary block bound to the second partition from a plurality of secondary blocks of the storage model; The storing the first data and / or data obtained based on the first data in the target secondary block or a block generated based on the target secondary block includes: The processed data is stored in a first block, wherein the first block is a block generated based on the target secondary block and a secondary block bound to the second partition.

7. The method according to any one of claims 1 to 6, characterized in that: Before extracting the first data from the first partition, the method further includes: Determining the number of forks of the storage model according to the number of partitions created for caching data; According to the number of forks, a new secondary block is created under the genesis block of the storage model, and a binding relationship between the newly created secondary block and the created partition is established.

8. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method according to any one of claims 1 to 7.

9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 7.