Detailed Description
The embodiment of the application provides a data processing method and device.
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
FIG. 1 is a flow chart of an embodiment of a data processing method of the present application. As shown in fig. 1, the data processing method may include:
s100: receiving a service request comprising service data, and determining first unique key configuration information corresponding to the service request according to a preset corresponding relation between the type of the service data and the unique key configuration information.
The data processing apparatus may receive a service request. The service request may include service data, a type of the service data, and a service processing type.
The service processing type may include: new, updated or deleted. When the service processing type is newly added, the service data can be newly added to the memory. When the service processing type is updating, the corresponding data in the memory can be updated to the service data in the service request. When the service processing type is deletion, the corresponding data in the memory can be deleted. The memory may include one or more databases and may also include a cache.
The unique key configuration information may be used to determine the data that needs to be queried. According to the corresponding relation between the type of the preset service data and the unique key configuration information, the first unique key configuration information corresponding to the service request can be determined.
The unique key configuration information may include: one or more configuration attributes. The configuration attribute may correspond to part or all of the content in the service data. For example, the content in the service data includes: user name, phone, mailbox, and address. The unique key configuration information may include both user name and phone configuration attributes.
The correspondence between the type of the service data and the unique key configuration information may be a one-to-one correspondence or a one-to-many correspondence. The determined first unique key configuration information corresponding to the service request may include one or more unique key configuration information.
For example, the received service request is: and adding new service data with a user type, wherein the service data is { id:1, name: test, email: test @ alipay.com, mobile:136xxxxxxxx, age:20 }. Then, in the service request, the service data is { id:1, name: test, email: test @ alipay.com, mobile:136 xxxxxxxxxx, age:20 }; the types of the service data are as follows: a user; the service processing types are as follows: and adding an age.
If it is assumed that the unique key configuration information corresponding to the data type user includes: email | mobile, which indicates that the first unique key configuration information includes two attributes of email and mobile.
Then, it may be determined that the first unique key configuration information corresponding to the service data in the received service request may include: email | mobile.
If it is assumed that the unique key configuration information corresponding to the data type user includes unique key configuration information 1 and unique key configuration information 2, specifically, unique key configuration information 1: name | email; unique key configuration information 2: name | mobile. The unique key configuration information 1 may represent unique key configuration information including two attributes of a name and an email, and the unique key configuration information 2 may represent unique key configuration information including two attributes of a name and a mobile.
Then, it may be determined that the first unique key configuration information corresponding to the service data in the received service request may include: unique key configuration information 1 and unique key configuration information 2.
S200: and determining unique key constraint configuration information corresponding to the service request according to the first unique key configuration information and the service data.
According to the first unique key configuration information and the service data, unique key constraint configuration information corresponding to the service request can be determined. The unique key constraint configuration information may correspond to the service data one to one.
For example, in the example mentioned in S100, the service data in the service request is { id:1, name: test, email: test @ alipay.com, mobile:136xxxxxxxx, age:20 }.
If it is assumed that the first unique key configuration information includes: email | mobile. Then, determining the unique key constraint configuration information corresponding to the service request may include: test @ alipay.com |136 xxxxxxxx.
If it is assumed that the first unique key configuration information includes: unique key configuration information 1: name | email; and unique key configuration information 2: name | mobile. Then, determining the unique key constraint configuration information corresponding to the service request may include: test | test @ alipay.com and test |136 xxxxxxxxxx.
The unique key constraint configuration information may be stored in a memory, in particular the unique key constraint configuration information may be stored in a unique key memory, which may be part of the memory.
In another embodiment, after determining the unique key constraint configuration information, the state of the unique key constraint configuration information may also be set. The state of the unique key constraint configuration information may be set to a first state. The first state may represent a state in which the unique key constraint configuration information is not confirmed to be valid.
In another embodiment, the timestamp length may also be set. The time stamp length may be used to represent a valid time length of the unique key constraint configuration information. The time stamp length may be preset. The time stamp length may be set according to practical experience, and may be generally less than 5 minutes, for example, may be set to 30 seconds. After the time stamp length is exceeded, the unique key constraint configuration information may be considered invalid.
In another embodiment, if the state of the unique key constraint configuration information is a first state and the set timestamp length is reached, the state of the unique key constraint configuration information may be changed to a second state. The second state may be used to state that the unique key constraint configuration information is invalid.
S300: and determining a unique key check result based on the unique key constraint configuration information, and if the unique key check result indicates that a conflict exists, sending a message that the conflict exists.
The determining of the unique key check result based on the unique key constraint configuration information may specifically include:
1) and when the service processing type is newly increased, searching whether the unique key storage stores the unique key constraint configuration information or not, and if so, checking the unique key to determine that a conflict exists.
Alternatively, the first and second electrodes may be,
2) and when the service processing type is updating, determining whether the updated content in the service request has the same content with the attribute of the unique key constraint configuration information, if so, searching whether the updated unique key constraint configuration information is stored in a unique key memory, and if so, checking that a conflict exists in the unique key check result.
The unique key store may be used to store the unique key constraint configuration information.
It should be noted that, when the unique key constraint configuration information corresponds to a plurality of unique key configuration information, it may be respectively found whether the content corresponding to each unique key configuration information is stored in the unique key memory. If the unique key memory stores the content corresponding to one of the unique key configuration information, the unique key check result may be that a conflict exists.
For example, in the examples of S100 and S200, the service data in the service request is { id:1, name: test, email: test @ alipay.com, mobile:136xxxxxxxx, age:20 }.
If it is assumed that the first unique key configuration information includes: unique key configuration information 1: name | email; and unique key configuration information 2: name | mobile. Then, determining the unique key constraint configuration information corresponding to the service request may include: test | test @ alipay.com and test |136 xxxxxxxxxx. If the unique key memory stores test | test @ alipay.com or test |136xxxxxxxx, the unique key check result may be that there is a conflict.
In another embodiment, the data processing method may further include: and when the service processing type is newly increased, searching whether the unique key storage stores the unique key constraint configuration information or not, and if not, judging that no conflict exists in the unique key check result.
In another embodiment, the data processing method may further include: and when the service processing type is updating, determining whether the updated content in the service request has the same content with the configuration attribute of the unique key constraint configuration information, and if not, determining that no conflict exists in the unique key detection result.
In another embodiment, the data processing method may further include: and when the service processing type is updating, determining whether the updated content in the service request has the same content with the configuration attribute of the unique key constraint configuration information, if so, searching whether the updated unique key constraint configuration information is stored in a unique key memory, and if not, checking that no conflict exists in the unique key check result.
When the unique key check result is that there is a conflict, a message that there is a conflict of unique keys may be transmitted. The message that there is a unique key collision may be sent to the sender of the service request.
In another embodiment, the data processing method may further include: and if the unique key check result is that no conflict exists, executing a first operation on the service request, and if the first operation fails, deleting the unique key constraint configuration information.
The first operation may include: and the operation corresponds to the service processing type in the service request. For example, if the service processing type in the service request is new, the service data in the service request may be newly added in the memory.
In another embodiment, the data processing method may further include: and if the first operation is successful and the state of the unique key constraint information is the first state, changing the state of the unique key constraint information into a third state. The third state represents a state in which the unique key configuration information is confirmed to be valid.
According to the data processing method disclosed by the embodiment, the first unique key configuration information corresponding to the service request can be determined according to the corresponding relation between the type of the preset service data and the unique key configuration information, manual configuration is not needed, and the convenience of operation of the data processing method is improved. Furthermore, the data processing method disclosed by the embodiment of the application is realized without using a remote procedure call protocol calling mode, and when the business operation fails, the unique key constraint configuration information can be directly deleted, so that the convenience of the operation of the data processing method is further improved. Furthermore, the state or the time stamp length of the unique key constraint configuration information is set, whether the unique key constraint configuration information is effective or not can be determined, and the accuracy of data uniqueness check can be improved.
FIG. 2 is a block diagram of one embodiment of a data processing apparatus according to the present application. As shown in fig. 2, the data processing apparatus may include: a first unique key configuration information determination module 100, a unique key constraint configuration information determination module 200, and a unique key check module 300. Wherein the content of the first and second substances,
the first unique key configuration information determining module 100 may be configured to receive a service request including service data, and determine first unique key configuration information corresponding to the service request according to a preset correspondence between a type of the service data and unique key configuration information.
The unique key constraint configuration information determining module 200 may be configured to determine unique key constraint configuration information corresponding to the service request according to the first unique key configuration information and the service data.
The unique key check module 300 may be configured to determine a unique key check result based on the unique key constraint configuration information, and send a message that there is a unique key collision if the unique key check result indicates that there is a collision.
FIG. 3 is a block diagram of the unique key check module of the present application. As shown in fig. 3, the unique key check module 300 may include: a new type check result determining module 301, an update type check result determining module 302 and a message sending module 303.
The newly added type check result determining module 301 may be configured to, when the service processing type is newly added, search whether the unique key storage stores the unique key constraint configuration information, and if so, determine that the unique key check result is that a conflict exists. Further, if not, the unique key check result may be that no conflict exists.
The update type checking result determining module 302 may be configured to determine, when the service processing type is update, whether the update content in the service request has the same content as the configuration attribute of the unique key constraint configuration information, if so, search for whether the updated unique key constraint configuration information is stored in the unique key memory, and if so, determine that the unique key checking result is a conflict. Further, whether the unique key constraint configuration information is stored in a unique key memory is searched, and if not, the unique key check result can be that no conflict exists. Further, the determination of whether the updated content in the service request has the same content as the configuration attribute of the unique key constraint configuration information is performed, if so, the determination of whether the updated content in the service request has the same content as the attribute of the unique key constraint configuration information is performed, and if not, the unique key check result is that no conflict exists.
The message sending module 303 may be configured to send a message that a unique key conflict exists when a result of the new addition type check result determining module 301 or the update type check result determining module 302 is that a conflict exists. The message sending module 303 may send the message that there is a unique key collision to the service request sender.
In another embodiment, the data processing apparatus may further include: a first operational block 400. The first operation module 400 may be configured to, when the unique key check result of the unique key check module 300 is not a conflict, perform a first operation on the service request, and if the first operation fails, delete the unique key constraint configuration information. The first operation may include: and the operation corresponds to the service processing type in the service request.
In another embodiment, the data processing apparatus may further include: a timestamp setting module 500. The status setting module 500 may be configured to set a timestamp length. The time stamp length may be used to represent a valid time length of the unique key constraint configuration information.
In another embodiment, the data processing apparatus may further include: a status setting module 600. The state setting module 600 may be configured to set or change the state of the unique key constraint configuration information.
The state of the unique key constraint configuration information may include: a first state, a second state, or a third state. The first state may represent a state in which the unique key constraint configuration information is not confirmed to be valid. The second state may be used to state that the unique key constraint configuration information is invalid. The third state represents a state in which the unique key configuration information is confirmed to be valid
After the unique key constraint configuration information determining module 200 determines the unique key constraint configuration information, the state setting module 600 may set the state of the configuration information on the unique key as a first state.
When the first operation in the first operation module 400 is successful, the state setting module 600 may change the state of the unique key constraint information to a third state.
When the state of the unique key constraint configuration information is a first state and the time stamp length set in the time stamp setting module 500 is reached, the state setting module 600 may change the state of the unique key constraint configuration information to a second state.
The data processing device disclosed in the above embodiments corresponds to the data processing method embodiments of the present application, and can achieve the technical effects of the data processing method embodiments of the present application.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate a dedicated integrated circuit chip 2. Furthermore, nowadays, instead of manually making an integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardsradware (Hardware Description Language), vhjhd (Hardware Description Language), and vhigh-Language, which are currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. With this understanding in mind, the present solution, or portions thereof that contribute to the prior art, may be embodied in the form of a software product, which in a typical configuration includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. The computer software product may include instructions for causing a computing device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in the various embodiments or portions of embodiments of the present application. The computer software product may be stored in a memory, which may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transient media), such as modulated data signals and carrier waves.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.