A kind of multi-type database adaptation method, device, electronic equipment and storage medium
Technical field
This application involves block chain technical field, in particular to a kind of multi-type database adaptation method, device, electronics are set
Standby and computer readable storage medium.
Background technique
The characteristic of decentralization and unsuppressible-suppression as possessed by block chain technology, so that block chain technology is very suitable to
For storage data quantity is big but the lesser significant data of volume of each data, such as just by block chain skill in bit coin network
Art carrys out store transaction data as the account book of record bit coin transaction.
With block chain technology development and bit coin it is burning hot, occur a variety of different types of block chains successively, often
One block chain equipment will exist as a node for forming the block chain network, to store the number stored in the block chain
According to.
The block chain network of different type or different purposes is often for the considerations of preventing with other data collisions, it is desirable that belongs to
Node device in it responds matched operational order using certain types of database.When not installed in node device
It is required that user can only install this database again when the database of type.Sometimes certain node device may be simultaneously as not
Node device with block chain network exists, and will lead to need to install a plurality of types of databases in its equipment, this
Situation can not only bring the dislike of user, and can greatly occupy the remaining computing resource in the poor equipment of performance.
Therefore, how overcoming in the prior art must use specific type of data matched with affiliated block chain network to come in fact
Technological deficiency present in the mode of the storage of existing data, is those skilled in the art's urgent problem to be solved.
Summary of the invention
The purpose of the application is to provide a kind of multi-type database adaptation method, device, electronic equipment and computer-readable
Storage medium, it is intended to which solving the prior art must use specific type of data matched with affiliated block chain network to carry out storing data
The problem that versatility present in mode is poor, user is poor using physical examination.
To achieve the above object, this application provides a kind of multi-type database adaptation methods, comprising:
Receive the operational order for the first kind that block chain network issues;
Detect the type of database of the actual installation in current block chain node device, the determining class with the database
The type of the adaptable operational order of type is Second Type;
The operational order of the first kind is converted into Second Type by preset multi-type database adaptation rule
Operational order;Wherein, the multi-type database adaptation rule includes the operational order of the first kind of every kind of function and each
Corresponding relationship between the operational order of the Second Type of types of database identical function;
Corresponding operation is carried out to the database by the operational order of the Second Type.
Optionally, before the operational order for receiving the first kind that target block chain network issues, further includes:
Obtain the operational order that the Second Type of identical function is indicated in all types of databases;
Being generated according to the same or similar part in the operational order of each Second Type indicates the first of identical function
The operational order of type;
Establish the behaviour of the operational order of the first kind of every kind of function and the Second Type of all types of database identical functions
Corresponding relationship between instructing, and the multi-type database adaptation rule is generated according to each corresponding relationship.
Optionally, the multi-type database adaptation method further include:
When the number of types of database of the actual installation in the current block chain node device is greater than 1, by any choosing
A kind of type of the database taken out is as actual database type.
Optionally, using a kind of type of the database arbitrarily selected as actual database type, comprising:
Calculate separately the finger between the corresponding operational order of each type of database and the operational order of the first kind
Enable similarity;
The type for possessing the database of supreme command similarity is elected to be the actual database type.
Optionally, the multi-type database adaptation method further include:
The format for the information that the database returns is converted to by the multi-type database adaptation rule can be by institute
State the format of target block chain network identification.
To achieve the above object, present invention also provides a kind of multi-type database adaptive device, which includes:
First kind operational order receiving unit, for receiving the operational order for the first kind that block chain network issues;
Second Type operational order determination unit, for detecting data of the actual installation in current block chain node device
The type in library, the type of the determining operational order adaptable with the type of the database are Second Type;
Operational order type conversion unit, for by preset multi-type database adaptation rule by the first kind
Operational order be converted to the operational order of Second Type;Wherein, the multi-type database adaptation rule includes every kind of function
The first kind operational order and all types of database identical functions Second Type operational order between corresponding relationship;
Operational order execution unit after conversion carries out the database for the operational order by the Second Type
Corresponding operation.
Optionally, the multi-type database adaptive device further include:
Each Second Type operation instruction obtaining unit, the standard operating instruction for being issued in reception target block chain network
Before, the operational order that the Second Type of identical function is indicated in all types of databases is obtained;
First kind operational order generation unit, for the identical or phase in the operational order according to each Second Type
The operational order for indicating the first kind of identical function is generated like part;
Corresponding relationship establish and adaptation rule generation unit, for establish every kind of function the first kind operational order with
Corresponding relationship between the operational order of the Second Type of all types of database identical functions, and generated according to each corresponding relationship
The multi-type database adaptation rule.
Optionally, the multi-type database adaptive device further include:
Actual database type selection unit, for working as data of the actual installation in the current block chain node device
When the number of types in library is greater than 1, using a kind of type of the database arbitrarily selected as actual database type.
Optionally, the polymorphic type actual database selection unit includes:
Instruct similarity calculation subelement, for calculate separately the corresponding operational order of each type of database with it is described
Instruction similarity between the operational order of the first kind;
Supreme command similarity type of database chooses subelement, for that will possess the database of supreme command similarity
Type is elected to be the actual database type.
Optionally, the multi-type database adaptive device further include:
The format of return information format conversion unit, the information for returning to the database passes through the polymorphic type number
The format that can be identified by the target block chain network is converted to according to library adaptation rule.
To achieve the above object, the application still further provides a kind of electronic equipment, and the electronic equipment includes storage
It is suitable to be stored with the polymorphic type actual database that can be run on the processor on the memory for device, processor and bus
With program, the polymorphic type actual database adaptation procedure is by the bus transfer to the processor, and by the processing
The polymorphic type actual database adaptation method as described in above content is realized when device executes.
To achieve the above object, the application still further provides a kind of computer readable storage medium, the computer
Polymorphic type actual database adaptation procedure is stored on readable storage medium storing program for executing, the polymorphic type actual database adaptation procedure can quilt
One or more processor executes, to realize the polymorphic type actual database adaptation method as described in above content.
Obviously, technical solution provided herein utilizes the operational order (mark for the first kind for including every kind of function
Quasi- operational order) it is corresponding between the operational order (practical operation instruction) of the Second Type of all types of database identical functions close
The multi-type database adaptation rule of system, (standard operation refers to the operational order for the first kind that target block chain network is sent
Enable) be converted to corresponding actual database Second Type operational order (practical operation instruction) so that originally possibly can not locate
The database for managing this format can also instruct to carry out corresponding operation, so that user is not necessarily to according to the practical operation after conversion
Certain types of database is installed again through complicated installation process again because type of database mismatches, increases database
Versatility, the user experience is improved.The application additionally provide simultaneously a kind of multi-type database adaptive device, electronic equipment and
Computer readable storage medium has above-mentioned beneficial effect, and details are not described herein.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis
The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of flow chart of multi-type database adaptation method provided by the embodiments of the present application;
Fig. 2 is a kind of schematic diagram of the corresponding relationship of dedicated adaptation rule provided by the embodiments of the present application;
Fig. 3 is a kind of schematic diagram of the corresponding relationship of General adaptive rule provided by the embodiments of the present application;
Fig. 4 is a kind of flow chart of standard operating instruction generation method provided by the embodiments of the present application;
Fig. 5 is that one kind is selected in polymorphic type actual database in multi-type database adaptation method provided by the embodiments of the present application
Take the flow chart of method;
Fig. 6 is a kind of structural block diagram of diversiform data adaptive device provided by the embodiments of the present application;
Fig. 7 is the structural schematic diagram of a kind of electronic equipment provided by the embodiments of the present application.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
The description and claims of this application and term " first ", " second ", " third ", " in above-mentioned attached drawing
The (if present)s such as four " are to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should manage
The data that solution uses in this way are interchangeable under appropriate circumstances, so that the embodiments described herein can be in addition to illustrating herein
Or the sequence other than the content of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that
Cover it is non-exclusive include, for example, containing the process, method, system, product or equipment of a series of steps or units need not limit
In step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, produce
The other step or units of product or equipment inherently.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection scope within.
Embodiment one
Referring to Figure 1, Fig. 1 is a kind of flow chart of multi-type database adaptation method provided by the embodiments of the present application,
The following steps are included:
S101: the operational order for the first kind that block chain network issues is received;
After receiving the operational order (being known as standard operating instruction in the present invention) that block chain network issues, determine that operation refers to
The type of order, wherein the first kind may refer to any one type, the operational order of the first kind can for it is a kind of with it is existing
A kind of corresponding operational order of the database of type, or customized operational order.
S102: the type of database of the detection actual installation in current block chain node device, it is determining and database
The type of the adaptable operational order of type is Second Type;
Determine the type of database of the actual installation in current block chain node device, the database that can detecte
Type is referred to as actual database type, and the type for the operational order being adapted with actual database type is determined as second
Type (is referred to as standard operating instruction relative to what block chain network issued, the operational order of Second Type herein can be claimed
For practical operation instruction), in order to realize the conversion of operational order type, this is because in the first kind with Second Type in phase
When different in the instruction of congenerous, block chain network can not identify the operational order of Second Type used in block chain link point,
And block chain node can not also identify that it is received before not installing the database being adapted with the operational order of the first kind
The first kind operational order.
It further, can also basis if there are many databases of type for actual installation on current block chain node device
Actual conditions pick out one of most suitable conduct actual database type, and will be corresponding with the actual database type
Operational order is determined as Second Type.Concrete mode can according to each type of operational order on description identical function with the
Similarity, all particular/special requirements that may be present between the operational order of one type etc., herein and are not specifically limited.
S103: the operational order of the first kind is converted to by Second Type by preset multi-type database adaptation rule
Operational order;
On the basis of S102, this step is intended to complete operational order by preset multi-type database adaptation rule
Conversion (conversion that standard operating instruction to practical operation instructs) from the first kind to Second Type, so that current block chain link
Point device can complete block chain according to the operational order after conversion under the premise of specially not installing certain types of database
The task and relevant operation that network issues.Wherein, multi-type database adaptation rule includes the behaviour of the first kind of every kind of function
Make the corresponding relationship between the operational order of the Second Type of instruction and all types of database identical functions.
Wherein, according to the operational order of the first kind whether be existing a certain type operational order, the adaptation rule is also
Dedicated adaptation rule or General adaptive as shown in Figure 3 rule as shown in Figure 2 can be embodied in.
For the adaptation rule form of expression of the operational order of existing a certain type, i.e., Fig. 2 corresponds to the operation of the first kind
To require the block chain network using certain type of database to provide a kind of dedicated adaptation rule, it is assumed that A block chain network
It is required that being instructed using T generic operation corresponding with the database of X class, then being identical to providing one kind in such cases can be by T class
Operational order is converted to the operational order transformation rule that can be identified by a variety of other types of databases, i.e., is targetedly the area A
Block chain network provides a kind of dedicated adaptation rule, so that as must no longer be equipped with X in the node device of A block chain network
The database of class could normally handle the instruction of the T generic operation from A block chain network.But in such cases, once being changed to
It is required that when using other block chain networks of non-X class database, it is also necessary to provide and be adapted to the corresponding operational order of non-X class database
Adaptation rule between type and other operational order types.
In view of needing the database creation and other number of types of each type respectively when using dedicated adaptation rule
According to the special instruction transformation rule between library, more troublesome and management is responsible for, can also be according to existing a plurality of types of databases point
The operational order type not used generates the new operational order of one kind as standard operating instruction, all answers in all block chain networks
When with the standard block chain network, it is only necessary to provide according to corresponding between the standard operating instruction and other types of operational order
The General adaptive rule that relationship creates can (corresponding relationship for including in the General adaptive rule that such mode is formed can join
See Fig. 3).In other words, standard operating instruction at this time is (to correspond respectively to every kind according to the operational order of a variety of existing types
The database of type) handled after obtain, treatment process namely establishes the process of corresponding relationship, that is to say, that at this time
Standard operating instruction will send operational order, General adaptive to specific block chain node device as the operational order on a upper layer
Rule changes it to practical operation instruction corresponding with the type of actual database by the corresponding relationship that inside includes, in turn
Realize higher versatility.
By General adaptive rule in the way of generate standard operating instruction in the case where, due to and there is no one can
In the database for just directly handling standard operating instruction without conversion, that is to say, that simple standard operating instruction will not have
In all senses, it is intended only as in corresponding relationship for determining that the source operational order of object run instruction uses, therefore can use up can
Its length of the shortening of energy, reduces the flow expended in data transmission procedure, increases information exchange efficiency.
S104: corresponding operation is carried out to database by the operational order of Second Type.
The present embodiment using include every kind of function the first kind operational order (standard operating instruction) with it is all types of
The multi-type database of corresponding relationship between the operational order (practical operation instruction) of the Second Type of database identical function is suitable
With rule, the operational order (standard operating instruction) for the first kind that target block chain network is sent is converted into corresponding actual number
According to the operational order (practical operation instruction) of the Second Type in library, so that possibly can not originally handle the database of this format
It can be instructed according to the practical operation after conversion to carry out corresponding operation, so that user is not necessarily to mismatch again because of type of database
Certain types of database is installed again through complicated installation process, increases the versatility of database, improves user
Experience.
Embodiment two
Fig. 4 is referred to, Fig. 4 is a kind of flow chart of General adaptive rule generating method provided by the embodiments of the present application,
On the basis of embodiment one, the present embodiment is intended to provide a kind of generation method of General adaptive rule, is not necessarily to each type of
Database provides respectively dedicated adaptation rule, includes the following steps:
S201: the operational order that the Second Type of identical function is indicated in all types of databases is obtained;
S202: being generated according to the same or similar part in the operational order of each Second Type indicates the first of identical function
The operational order of type;
In order to make the operational order (standard operating instruction) and current existing type of database pair of the first kind
The operational order relevance for the Second Type answered is stronger, therefore the present embodiment will be according to the phase in the operational order of each Second Type
With or similar portion come generate indicate identical function the first kind operational order (standard operating instruction).
S203: the operational order of the first kind of every kind of function and the Second Type of all types of database identical functions are established
Operational order between corresponding relationship, and according to each corresponding relationship generate multi-type database adaptation rule.
On the basis of S202, corresponding relationship easily very can be established according to the process for finding identical point, and according to each
Corresponding relationship generates General adaptive rule.
Under by the way of General adaptive rule, it is necessary first to determine one it is more upper, more rich in versatility
Operational order type can specifically select original one kind, can also voluntarily create, can be according to when using voluntarily creating
Different modes is created in conjunction with the position of keyword in every kind of existing operational order or meaning, and due to voluntarily creating mode
Under existing various types of databases can not directly handle the standard operating instruction voluntarily created, that is to say, that simple mark
Quasi- operational order, which will not have, to be intended only as in corresponding relationship in all senses for determining the source operational order of object run instruction
It uses, therefore its length can be shortened as far as possible, reduce the flow expended in data transmission procedure, increase information exchange effect
Rate.
Embodiment three
Fig. 5 is referred to, Fig. 5 is that one kind is real in polymorphic type in multi-type database adaptation method provided by the embodiments of the present application
The flow chart of border database choosing method, on the basis of the various embodiments described above, the present embodiment is in current block chain node
A kind of method that the scene of a plurality of types of databases provides determining actual type is installed, is included the following steps:
S301: the finger between the corresponding operational order of each type of database and the operational order of the first kind is calculated separately
Enable similarity;
S302: the type for possessing the database of supreme command similarity is elected to be actual database type.
Instruction similarity indicates the respectively practical operation when indicating the operational order of identical function of different types of database
Difference between instruction, similarity are higher, it is meant that the difference of the data of both types is smaller, instructs in the actual operation process
The executive mode degree of coupling it is higher, be less susceptible to malfunction, therefore the present embodiment will possess the database of supreme command similarity
Type is elected to be actual database type, and the conversion operation of subsequent step is carried out according to the actual database type being elected to be.
Because situation is complicated, it can not enumerate and be illustrated, those skilled in the art should be able to recognize according to the application
The basic skills principle combination actual conditions of offer may exist many examples, in the case where not paying enough creative works,
It should within the scope of protection of this application.
Example IV
Fig. 6 is referred to, Fig. 6 is a kind of structural block diagram of diversiform data adaptive device provided by the embodiments of the present application, should
Device may include:
First kind operational order receiving unit 100, the operation for receiving the first kind that block chain network issues refer to
It enables;
Second Type operational order determination unit 200, for detecting actual installation in current block chain node device
The type of database, the type of the determining operational order adaptable with the type of database are Second Type;
Operational order type conversion unit 300, for by preset multi-type database adaptation rule by the first kind
Operational order be converted to the operational order of Second Type;Wherein, multi-type database adaptation rule includes the of every kind of function
Corresponding relationship between the operational order of the Second Type of the operational order of one type and all types of database identical functions;
Operational order execution unit 400 after conversion carries out database for the operational order by Second Type corresponding
Operation.
Further, which can also include:
Each Second Type operation instruction obtaining unit, the standard operating instruction for being issued in reception target block chain network
Before, the operational order that the Second Type of identical function is indicated in all types of databases is obtained;
First kind operational order generation unit, for the same or similar portion in the operational order according to each Second Type
The mitogenetic operational order at the first kind for indicating identical function;
Corresponding relationship establish and adaptation rule generation unit, for establish every kind of function the first kind operational order with
Corresponding relationship between the operational order of the Second Type of all types of database identical functions, and multiclass is generated according to each corresponding relationship
Type database adaptation rule.
Further, which can also include:
Actual database type selection unit, for when database of the actual installation in current block chain node device
When number of types is greater than 1, using a kind of type of the database arbitrarily selected as actual database type.
Wherein, which may include: again
Similarity calculation subelement is instructed, for calculating separately the corresponding operational order of each type of database and first
Instruction similarity between the operational order of type;
Supreme command similarity type of database chooses subelement, for that will possess the database of supreme command similarity
Type is elected to be actual database type.
Further, which can also include:
The format of return information format conversion unit, the information for returning to database is adapted to by multi-type database
Rule is converted to the format that can be identified by target block chain network.
The present embodiment exists as the Installation practice for corresponding to above method embodiment, and there is embodiment of the method to be had
Whole beneficial effects, no longer repeat one by one herein.
Hereinbefore by some embodiments between the conversion of operational order how realizing disparate databases type into
Detailed description is gone, the application also provides a kind of entity hardware device corresponding with this method, this partial content principle and side
Case part is corresponding, and details are not described herein again for the part of realization principle, will form carry out to the hardware of the entity hardware device below
Description refers to Fig. 7, and Fig. 7 is the structural schematic diagram of a kind of electronic equipment provided by the embodiments of the present application:
The electronic equipment 500 includes memory 510, processor 520 and bus 530, and being stored on memory 510 can be
The polymorphic type actual database adaptation procedure run on processor 520, the polymorphic type actual database adaptation procedure pass through bus
530 are transferred to processor 520, and the reality of the polymorphic type as described in above-described embodiment can be realized when being executed by processor 520
Each step in the database adaptation method of border.
Wherein, memory 510 includes at least a type of readable storage medium storing program for executing, and readable storage medium storing program for executing includes flash memory, hard
Disk, multimedia card, card-type memory (for example, SD or DX memory etc.), magnetic storage, disk, CD etc..Memory 510
It can be the internal storage unit of electronic equipment 500, such as the hard disk of the electronic equipment 500 in some embodiments.Memory
510 are also possible to match on the External memory equipment of the electronic equipment 500, such as the electronic equipment 500 in further embodiments
Standby plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD)
Card, flash card (Flash Card) etc..Further, memory 510 can also be simultaneously by internal storage unit and external storage
Equipment forms simultaneously.Further, what memory 510 can be not only used for that storage is installed in the electronic equipment 500 various answers
With software and Various types of data, can be also used for temporarily storing the data that has exported or will export.
Processor 520 can be in some embodiments central processing unit (Central Processing Unit, CPU),
Controller, microcontroller, microprocessor or other data processing chips, the program code for being stored in run memory 510
Or processing data, such as polymorphic type actual database adaptation procedure etc..
Bus 530 can be Peripheral Component Interconnect standard (peripheral component interconnect, abbreviation
PCI) bus or expanding the industrial standard structure (extended industry standard architecture, abbreviation EISA)
Bus etc..The bus can be divided into address bus, data/address bus, control bus etc..For convenient for indicating, only with one pair in Fig. 7
It is indicated to hollow index line, it is not intended that an only bus or a type of bus.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.In several embodiments provided herein, it should be understood that disclosed system, device and method can pass through it
Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of unit, only
A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of device or unit
It connects, can be electrical property, mechanical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit
Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple networks
On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
It, can if integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product
To be stored in a computer readable storage medium.Based on this understanding, the technical solution of the application substantially or
Say that all or part of the part that contributes to existing technology or the technical solution can embody in the form of software products
Out, which is stored in a storage medium, including some instructions are used so that a computer equipment
(can be personal computer, server or the network equipment etc.) executes the method gone out given in each embodiment of the application
All or part of the steps.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), magnetic or disk etc. are various can store journey
The medium of sequence code.
It should be noted that the serial number of the above embodiments of the invention is only for description, do not represent the advantages or disadvantages of the embodiments.And
The terms "include", "comprise" herein or any other variant thereof is intended to cover non-exclusive inclusion, so that packet
Process, device, article or the method for including a series of elements not only include those elements, but also including being not explicitly listed
Other element, or further include for this process, device, article or the intrinsic element of method.Do not limiting more
In the case where, the element that is limited by sentence "including a ...", it is not excluded that including process, device, the article of the element
Or there is also other identical elements in method.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.