Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description.
Technical terms used in one or more embodiments of the present specification will be explained first.
Hot plugging: the method is used for realizing the functions of dynamically adding, deleting or updating physical resources or logic resources of the application under the non-stop state.
Data medium: the data medium referred to herein refers to a system for storing data, such as a relational database, an object database, a Key-Value storage database, and a file store.
Referring to fig. 1, one or more embodiments of the present specification provide a system architecture diagram for implementing data storage, including a business layer 102, an interceptor 104, a distributor 106, a configuration list 108, a data layer 110, a data layer access interface 112, a storage media processor 114, and a storage media interface 116.
After the service layer 102 completes the service operation, it will receive a service operation result data storage request of the data layer 110, where the service operation result data storage request carries storage media types to which the service operation result data is stored,
the data of the business operation result is intercepted by the interceptor 104 before being stored, the interceptor 104 sends the intercepted data of the business operation result and the data storage request of the business operation result to the distributor 106,
the distributor 106 calls the configuration list 108, the configuration list 108 includes mapping relationships between storage media types and storage media processors 114, and between storage media processors 114 and storage media interfaces, the distributor 106 finds the storage media processor 114 corresponding to the storage media type in the service operation result data storage request through the data layer access interface 112, and calls the storage media interface 116 corresponding to the storage media processor 114 to implement multi-storage media type storage of the service operation result data,
the storage medium processor 114 may implement different types of storage of the service operation result data according to different storage media, and may perform different processing on the data format of the storage of the service operation result data.
The storage medium interface 116 receives the service operation result data processed by the storage medium processor 114, and then stores the service operation result data in a corresponding storage medium.
Referring to fig. 2, one or more embodiments of the present specification provide a data storage method, including steps 202 to 206.
Step 202: and receiving business operation result data and a storage request of the business operation result data, wherein the storage request carries at least two target storage medium types.
In one or more embodiments of the present specification, the business operation result data includes business operation result data of an intercepted business layer.
In one or more embodiments of the present specification, the service operation result data records a result corresponding to each step of operation of a service. Taking a purchase service as an example, the purchase service corresponds to a page browsing operation after entering a shopping website, a selection operation on an article to be purchased, a payment operation for purchasing the article, and the like, and the corresponding operations all have corresponding results, for example, the result corresponding to the page browsing operation includes all page names browsed by entering the shopping website, the result corresponding to the article selection operation includes the number of articles, the color of the articles, the model of the articles, and the like, which need to be purchased, and the result corresponding to the payment operation includes a payment amount and a selected payment bank, and the like.
In one or more embodiments of the present description, the business operation result data includes payment order data, cancellation order data, and/or selection payment source data.
In one or more embodiments of the present specification, the request for storing the service operation result data includes which types of storage media the service operation result data is stored in, so that the storage request carries at least two target storage media types, and the service operation result data can be stored in at least two types of storage media. In practical applications, the number of types of target storage media carried by the storage request may include two or more types, which are set according to practical requirements, and this application does not limit this.
In one or more embodiments of the present description, the target storage media type includes a relational storage media, an object-type storage media, and/or a file-type storage media. The practical application may also include other types of storage media, which are set according to practical requirements, and this application does not limit this.
Step 204: and determining at least two target storage medium interfaces corresponding to the at least two target storage medium types according to a preset configuration list, wherein the configuration list comprises a mapping relation between the storage medium types and the storage medium interfaces.
In one or more embodiments of the present specification, the configuration record stored in the configuration list includes a mapping relationship between storage medium types and storage medium interfaces, where one storage medium type in the configuration list corresponds to one storage medium interface.
The description will be given by taking an example in which the storage medium types include a relational storage medium, an object-type storage medium, and a file-type storage medium, the relational storage medium corresponds to the relational storage medium interface, the object-type storage medium corresponds to the object-type storage medium interface, and the file-type storage medium corresponds to the file-type storage medium interface. If the business operation result data is received through the relational storage medium interface, the business operation result data is stored into the relational storage medium, if the business operation result data is received through the object type storage medium interface, the business operation result data is stored into the object type storage medium, and if the business operation result data is received through the file type storage medium interface, the business operation result data is stored into the file type storage medium.
In one or more embodiments of the present specification, according to a configuration record in a configuration list and the at least two types of target storage media carried in the storage request, which storage media types in the configuration list correspond to the at least two types of target storage media may be determined, and then according to a mapping relationship between the storage media types and the storage media interfaces, at least two storage media interfaces, that is, target storage media interfaces, are determined.
Step 206: and storing the service operation result data to the at least two target storage media through the at least two target storage media interfaces respectively.
In one or more embodiments of the present specification, after receiving the service operation result data, the at least two target storage medium interfaces may perform processing such as format conversion on the service operation result data, convert the data format of the service operation result data into the format of a storage medium corresponding to the target storage medium interface, and then store the format of the storage medium to the target storage medium via the target storage medium interface.
In one or more embodiments of the present specification, after the business operation result data has been stored in the storage media of at least two target storage media types carried in the storage request, a storage result of the business operation result data is returned. And reminding that the business operation result data is successfully stored in a form of a popup window, a short message or an email.
In the data storage method provided in one or more embodiments of the present specification, the service layer does not pay attention to the implementation of the service operation result data storage logic, and only needs to pay attention to the storage medium interface of the storage behavior, and does not pay attention to which type of storage medium the service operation result data is to be stored in, and the storage medium interface corresponding to the type of storage medium is found according to the storage request, and the storage medium interface performs format conversion on the service operation result data and then stores the service operation result data to the corresponding storage medium, so that the service layer is completely decoupled from a specific storage process, and the code readability and the subsequent maintenance cost are greatly reduced.
Referring to fig. 3, one or more embodiments of the present specification provide a data storage method, including steps 302 to 308.
Step 302: and receiving business operation result data and a storage request of the business operation result data, wherein the storage request carries at least two target storage medium types.
Step 304: acquiring a preset configuration list, wherein the configuration list comprises a mapping relation between a storage medium type and a storage medium interface.
Step 306: and traversing the configuration list, and determining at least two target storage medium interfaces according to the at least two target storage medium types.
In one or more embodiments of the present specification, the configuration list is traversed, so that the mapping relationship between all storage media types and storage media interfaces in the configuration list is accessed once and only once. The configuration list may be traversed in a forward, middle, or backward order, and the selection may be made according to the actual application, which is not limited in any way by one or more embodiments of the present disclosure.
In one or more embodiments of the present description,
the mapping relationship between the storage medium type and the storage medium interface comprises the following steps:
the mapping relation between the storage medium type and the storage medium processor and the mapping relation between the storage medium processor and the storage medium interface;
determining at least two target storage media interfaces according to the at least two target storage media types comprises:
searching at least two storage medium types in the configuration list according to the at least two target storage medium types;
determining at least two storage medium processors corresponding to the at least two storage medium types based on the configuration list;
determining at least two storage medium interfaces corresponding to the at least two storage medium processors, wherein the at least two storage medium interfaces are the at least two target storage medium interfaces.
In one or more embodiments of the present description, the storage medium types correspond to respective storage medium processors, and the storage medium processors correspond to respective storage medium interfaces. In practical application, before storing the service operation result data, the format of the storage medium processor corresponding to the storage medium type is converted according to the requirement, and the storage of the service operation result data in different types of storage media is realized through the storage medium interface corresponding to the storage medium processor.
Taking the storage medium type including a relational storage medium, an object-type storage medium, and a file-type storage medium as an example for explanation, the mapping relationships between the storage medium processor and the mapping relationships between the storage medium type and the storage medium interface are specifically shown in table 1.
TABLE 1
Storage medium type
|
Storage medium processor
|
Storage medium interface
|
Relational storage medium
|
Relational storage medium processor
|
Relational storage medium interface
|
Object-type storage medium
|
Object type storage medium processor
|
Object type storage medium interface
|
File type storage medium
|
File type storage medium processor
|
File type storage medium interface |
In one or more embodiments of the present disclosure, the structure of the configuration list is illustrated in table 2.
TABLE 2
Referring to tables 1 and 2, the description will be made by taking an example in which the at least two target storage medium types include a relational storage medium and an object-type storage medium.
Firstly, determining a relational storage medium and an object storage medium in a corresponding configuration list according to the relational storage medium and the object storage medium;
then, according to the relation type storage medium and the object type storage medium in the configuration list, the relation type storage medium corresponds to the relation type storage medium processor, and the object type storage medium corresponds to the object type storage medium processor;
and finally, determining that the corresponding storage medium interfaces respectively comprise a relational storage medium interface and an object type storage medium interface according to the relational storage medium processor and the object type storage medium processor, wherein the relational storage medium interface and the object type storage medium interface are target storage medium interfaces corresponding to the at least two target storage medium types.
Step 308: and storing the service operation result data to the at least two target storage media through the at least two target storage media interfaces respectively.
In one or more embodiments of the present specification, a mapping relationship between a new storage medium type and a storage medium interface may also be added to the configuration list.
In practical applications, the mapping relationship between the new storage medium type and the storage medium interface includes a mapping relationship between the new storage medium type and the storage medium processor, and a mapping relationship between the storage medium processor and the storage medium interface.
In the data storage method provided in one or more embodiments of the present specification, if the service operation result data needs to be stored in other types of storage media, and a new storage media type needs to be implemented by extension, the service operation result data can be stored in other storage media types only by adding a storage media type and a storage media interface corresponding to the storage media type in the configuration list and implementing a processor of one storage media.
Referring to fig. 4, one or more embodiments of the present specification provide a data storage method including steps 402 to 410.
Step 402: and receiving business operation result data and a storage request of the business operation result data, wherein the storage request carries at least two target storage medium types.
Step 404: acquiring a preset configuration list, wherein the configuration list comprises a mapping relation between a storage medium type and a storage medium interface.
Step 406: and traversing the configuration list, and determining at least two target storage medium interfaces according to the at least two target storage medium types.
Step 408: and storing the service operation result data to the at least two target storage media through the at least two target storage media interfaces respectively.
Step 410: and modifying and/or deleting the mapping relation between the storage medium type and the storage medium interface recorded in the configuration list.
In the data storage method provided in one or more embodiments of the present specification, the type of the storage medium may be dynamically adjusted during running, and the hot plug effect may be achieved only by performing a deletion or modification operation in the configuration list, so that the adjustment of the type of the storage medium is completed without shutdown. And one part of service operation result data can be stored in different types of storage media without shutdown, so that the effect of hot plugging of the storage media is achieved, meanwhile, the capacity of dynamically expanding service operation result data to store multiple types of storage media can be achieved only by configuring the new type of storage media into a configuration list, and the method has the advantage of low maintenance cost.
Referring to fig. 5, one or more embodiments of the present disclosure provide a timing diagram of a data storage method, including steps 502 to 514.
Step 502: and intercepting the purchase operation result data obtained after the purchase service processing is finished and the type of the target storage medium required to be stored by the purchase operation result, and transmitting the purchase operation result data to a distributor.
In one or more embodiments of the present disclosure, for example, in the case of purchasing clothes, the data of the result of the purchasing operation includes all pages browsed by entering a shopping website, a style, a color, an amount of the selected clothes, an amount of money to be paid, and information of a selected bank card.
Step 504: and receiving the purchase operation result data and acquiring a configuration list.
In one or more embodiments of the present description, the configuration list includes a mapping relationship between the storage medium type and a storage medium processor, and a mapping relationship between the storage medium processor and the storage medium interface.
Step 506: and traversing the configuration list, and acquiring a corresponding storage medium type from the configuration list according to one target storage medium type which needs to be stored according to the purchase operation result.
Step 508: and searching a storage medium interface corresponding to the storage medium type and a storage medium processor corresponding to the storage interface according to the configuration list.
Step 510: and after the storage medium processor processes the purchase operation result data, calling the storage medium interface to store the purchase operation result data to a corresponding storage medium.
Step 512: and judging whether all target storage medium types needing to be stored in the purchase operation result are traversed, if so, executing step 514, and if not, executing step 506.
Step 514: and returning the storage result of the purchase operation result data.
In the data storage method provided by one or more embodiments of the present specification, the business layer does not pay attention to the implementation of the purchase operation result data storage logic, only needs to pay attention to the storage medium interface of the storage behavior, and does not pay attention to which type of storage medium the purchase operation result data is stored in, and finds the storage medium interface corresponding to the type of storage medium according to the storage request, and the storage medium processor corresponding to the storage medium interface displays format conversion and storage of the purchase operation result data, so that the business layer is completely decoupled from a specific storage process, and code readability and subsequent maintenance cost are greatly reduced.
Referring to fig. 6, one or more embodiments of the present specification provide a data storage device including:
a receiving module 602, configured to receive service operation result data and a storage request of the service operation result data, where the storage request carries at least two target storage media types;
an interface determining module 604, configured to determine at least two target storage media interfaces corresponding to the at least two target storage media types according to a preset configuration list, where the configuration list includes a mapping relationship between a storage media type and a storage media interface;
a storage module 606 configured to store the service operation result data to the at least two target storage media through the at least two target storage media interfaces, respectively.
Optionally, the interface determining module 604 includes:
the acquisition submodule is configured to acquire a preset configuration list, wherein the configuration list comprises a mapping relation between a storage medium type and a storage medium interface;
and the traversing submodule is configured to traverse the configuration list and determine at least two target storage medium interfaces according to the at least two target storage medium types.
Optionally, one storage medium type in the configuration list corresponds to one storage medium interface.
Alternatively,
the mapping relationship between the storage medium type and the storage medium interface comprises the following steps:
the mapping relation between the storage medium type and the storage medium processor and the mapping relation between the storage medium processor and the storage medium interface;
the traversal submodule comprises:
a searching sub-module configured to search for at least two storage medium types in the configuration list according to the at least two target storage medium types;
a processor determination submodule configured to determine, based on the configuration list, at least two storage medium processors corresponding to the at least two storage medium types;
an interface determining submodule configured to determine at least two storage medium interfaces corresponding to the at least two storage medium processors, where the at least two storage medium interfaces are the at least two target storage medium interfaces.
Optionally, the apparatus further comprises:
and the interception module is configured to intercept the service operation result data of the service layer.
Optionally, the receiving module is configured to receive a storage request of service operation result data from the service layer and service result data from the data layer.
Optionally, the apparatus further comprises:
and the adding module is configured to add the mapping relation between the new storage medium type and the storage medium interface into the configuration list.
Optionally, the apparatus further comprises:
and the modification and deletion module is configured to modify and/or delete the mapping relation between the storage medium type and the storage medium interface recorded in the configuration list.
Optionally, the apparatus further comprises:
and the return module is configured to return the storage result of the business operation result data.
Optionally, the at least two target storage media types include a relational storage medium, an object-type storage medium, and/or a file-type storage medium.
Optionally, the business operation result data includes order payment data, order cancellation data and/or payment source selection data.
In the data storage device provided in one or more embodiments of the present specification, the service layer does not pay attention to the implementation of the service operation result data storage logic, and only needs to pay attention to the storage medium interface of the storage behavior, and does not pay attention to which type of storage medium the service operation result data is stored in, and finds the storage medium interface corresponding to the type of storage medium according to the storage request, and the storage medium processor corresponding to the storage medium interface displays format conversion and storage of the service operation result data, so that the service layer is completely decoupled from a specific storage process, and code readability and subsequent maintenance cost are greatly reduced.
Referring to fig. 7, a schematic structural diagram of a computing device according to one or more embodiments of the present disclosure is shown, and the specific embodiment of the present disclosure does not limit the specific implementation of the computing device.
As shown in fig. 7, the computing device may include: a processor (processor)702, a Communications Interface 704, a memory 706, and a communication bus 708.
Wherein:
the processor 702, communication interface 704, and memory 706 communicate with each other via a communication bus 708.
A communication interface 704 for communicating with other terminal devices or servers.
The processor 702 is configured to execute the program 710, and may specifically execute relevant steps in the foregoing data processing method embodiments.
In particular, the program 710 may include program code that includes computer instructions.
The processor 702 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The terminal device comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
The memory 706 stores a program 710. The memory 706 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. The program 710 may be specifically configured to cause the processor 702 to perform operations that implement the data storage described above.
One or more embodiments of the present specification also provide a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the data storage method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the data storage method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the data storage method.
Each embodiment in one or more embodiments of the present disclosure is described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on differences from other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The technical carrier of the payment design described in one or more embodiments of the present specification may include, for example, Near Field Communication (NFC), WIFI, 3G/4G/5G, POS machine card swiping technology, two-dimensional code scanning technology, barcode scanning technology, bluetooth, infrared, Short Message Service (SMS), Multimedia Message Service (MMS), and the like.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and the practical application, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.