Data resource processing method and device, computer equipment and storage medium
By locking data resources, the chaos in ownership caused by multiple managers' simultaneous transfer of requests is solved, ensuring the security and user experience of data resources.
Patent Information
- Application Number
- CN202310581074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2024-11-22
AI Technical Summary
During the transfer of data resource ownership rights, when multiple managers initiate transfer requests at the same time, it is easy to cause confusion in the ownership rights of data resource, making it difficult to ensure the security of data resources.
By locking the data resource, it is ensured that only one transfer request is in process and other requests are temporarily blocked until the lock is released before processing the next request, ensuring the consistency and security of the data resource status.
It effectively avoids processing multiple transfer requests at the same time, ensures the security of data resources, improves user experience, and reduces the time when the initiator of the transfer request waits for processing results.
Smart Images

Figure CN119004405A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data resource processing method, device, computer equipment and storage medium. Background Art
[0002] With the continuous development of computer technology, the code data resources of neural network models, the code data resources running on web pages, and the electronic document data resources can all be regarded as a kind of asset, or in other words, the creators of these data resources enjoy the ownership of these data resources.
[0003] In some scenarios, the ownership of data resources may need to be transferred. For example, when an employee leaves the company, the company manager needs to transfer the ownership of the code data resources created by the employee during his / her employment to other employees. However, if two or more managers simultaneously initiate transfer requests for the same batch of data resources, it is easy to cause confusion in the ownership of the data resources, making it difficult to ensure the security of the data resources. Summary of the invention
[0004] The embodiment of the present application provides a data resource processing method, device, computer equipment and storage medium, which can ensure the security of data resources. The technical solution is as follows:
[0005] On the one hand, a data resource processing method is provided, which is applied to a server, and the method comprises:
[0006] In response to a transfer request for a data resource, locking the data resource so that during the locking of the data resource, no other transfer request for the data resource other than the transfer request is executed, the transfer request indicating that ownership of the data resource is transferred from a first object to a second object;
[0007] executing the main transaction of the transfer request, and if the execution is successful, unlocking the data resource, sending a first feedback message, wherein the main transaction indicates that the resource state of the data resource is updated to ownership being transferred, and the first feedback message indicates that the transfer request has been executed;
[0008] Execute the slave transaction of the transfer request, and if the execution is successful, send a second feedback message, the slave transaction indicates that the resource state of the data resource is updated to the ownership belongs to the second object, and the second feedback message indicates that the ownership of the data resource belongs to the second object.
[0009] On the other hand, a data resource processing method is provided, which is applied to a terminal, and the method includes:
[0010] Sending a transfer request for a data resource to a server, wherein the transfer request indicates that ownership of the data resource is transferred from a first object to a second object;
[0011] receiving a first feedback message sent by the server, the first feedback message indicating that the transfer request has been executed, the server being configured to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, no other transfer requests for the data resource other than the transfer request are executed, and executing a main transaction of the transfer request, and if the execution is successful, unlocking the data resource, the main transaction indicating that a resource status of the data resource is updated to ownership being transferred;
[0012] A second feedback message sent by the server is received, wherein the second feedback message indicates that the ownership of the data resource belongs to the second object, and the server is further used to execute a slave transaction of the transfer request, wherein the slave transaction indicates that the resource state of the data resource is updated to that the ownership belongs to the second object.
[0013] On the other hand, a data resource processing device is provided, which is applied to a server, and the device includes:
[0014] A locking module, configured to lock the data resource in response to a transfer request for the data resource, so that during the locking of the data resource, no other transfer request for the data resource other than the transfer request is executed, wherein the transfer request indicates that the ownership of the data resource is transferred from the first object to the second object;
[0015] A first execution module, configured to execute the main transaction of the transfer request, unlock the data resource if the execution is successful, and send a first feedback message, wherein the main transaction indicates that the resource status of the data resource is updated to ownership being transferred, and the first feedback message indicates that the transfer request has been executed;
[0016] The second execution module is used to execute the slave transaction of the transfer request. If the execution is successful, a second feedback message is sent. The slave transaction indicates that the resource status of the data resource is updated to the ownership belongs to the second object, and the second feedback message indicates that the ownership of the data resource belongs to the second object.
[0017] In some embodiments, the locking module is used to:
[0018] In response to the transfer request, a target name is determined based on the object identifier of the first object, and a distributed lock with the target name is added to the data resource so that no other transfer requests for the data resource except the transfer request are executed during the locking of the data resource.
[0019] In some embodiments, the apparatus further comprises:
[0020] a generation module, configured to generate, in response to the transfer request, a transaction identifier corresponding to the transfer request based on the object identifier of the first object, the object identifier of the second object, the object identifier of a third object that initiates the transfer request, and the resource identifier of the data resource, wherein the transaction identifier indicates the master transaction and the slave transaction.
[0021] In some embodiments, the second execution module is used to:
[0022] Using the transaction identifier as an index, obtaining the data resource from a database;
[0023] Updating the resource status of the data resource to indicate that the ownership right belongs to the second object;
[0024] The second feedback message is sent.
[0025] In some embodiments, the second execution module is used to:
[0026] Based on the resource status of the data resource, a consistency check is performed on the data resource, and if the check passes, the resource status of the data resource is updated to indicate that the ownership right belongs to the second object;
[0027] The consistency check refers to checking whether the resource status of the data resources is that the ownership is being transferred.
[0028] In some embodiments, the locking module is used to:
[0029] In response to the transfer request, verifying the transfer request, and if the verification passes, locking the data resource;
[0030] Among them, the verification of the transfer request includes at least one of the following: verifying the object identifier of the first object; verifying the object identifier of the second object; verifying the object identifier of the third object that initiates the transfer request; and verifying the resource identifier of the data resource.
[0031] On the other hand, a data resource processing device is provided, which is applied to a terminal, and the device includes:
[0032] A sending module, configured to send a transfer request for a data resource to a server, wherein the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object;
[0033] a receiving module, configured to receive a first feedback message sent by the server, the first feedback message indicating that the transfer request has been executed, the server being configured to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, no other transfer request other than the transfer request for the data resource is executed, and execute a main transaction of the transfer request, and if the execution is successful, unlock the data resource, and the main transaction indicates that the resource status of the data resource is updated to the ownership being transferred;
[0034] The receiving module is further used to receive a second feedback message sent by the server, wherein the second feedback message indicates that the ownership of the data resource belongs to the second object. The server is further used to execute a slave transaction of the transfer request, wherein the slave transaction indicates that the resource status of the data resource is updated to that the ownership belongs to the second object.
[0035] In some embodiments, the device further comprises a display module, wherein the display module is used for at least one of the following:
[0036] Based on the first feedback message, displaying first prompt information, wherein the first prompt information indicates that the transfer request has been executed;
[0037] Based on the second feedback message, in response to a viewing operation on the data resource, second prompt information is displayed, wherein the second prompt information indicates that the ownership of the data resource belongs to the second object.
[0038] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the data resource processing method in the embodiment of the present application.
[0039] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the data resource processing method in the embodiment of the present application.
[0040] On the other hand, a computer program product is provided, the computer program product includes at least one computer program, the at least one computer program is stored in a computer-readable storage medium. A processor of a computer device reads the at least one computer program from the computer-readable storage medium, and the processor executes the at least one computer program, so that the computer device executes to implement the data resource processing method in the embodiment of the present application.
[0041] In an embodiment of the present application, in response to a transfer request for a data resource, the ownership transfer of the data resource is achieved by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to achieve the actual ownership transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 It is a schematic diagram of an implementation environment of a data resource processing method provided in an embodiment of the present application;
[0044] Figure 2 It is a schematic diagram of an application scenario provided according to an embodiment of the present application;
[0045] Figure 3 is a flow chart of a data resource processing method provided according to an embodiment of the present application;
[0046] Figure 4 is a flowchart of another data resource processing method provided according to an embodiment of the present application;
[0047] Figure 5 is a flow chart of a data resource processing method provided according to an embodiment of the present application;
[0048] Figure 6 is a schematic diagram of a Chubby distributed lock provided according to an embodiment of the present application;
[0049] Figure 7 is a schematic diagram of a data resource processing method provided according to an embodiment of the present application;
[0050] Figure 8 is a schematic diagram of a first prompt information provided according to an embodiment of the present application;
[0051] Fig. 9 is a schematic diagram of transaction processing provided according to an embodiment of the present application;
[0052] Fig.10is a schematic diagram of a data resource processing method provided according to an embodiment of the present application;
[0053] Fig.11 is a structural diagram of a data resource processing device provided according to an embodiment of the present application;
[0054] Fig.12 is a structural diagram of another data resource processing device provided according to an embodiment of the present application;
[0055] Fig.13 is a schematic diagram of the structure of a terminal provided according to an embodiment of the present application;
[0056] Fig.14 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0058] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0059] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there a limitation on the quantity and execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms.
[0060] These terms are only used to distinguish one element from another element. For example, without departing from the scope of various examples, a first object can be referred to as a second object, and similarly, a second object can also be referred to as a first object. Both the first object and the second object can be objects, and in some cases, can be separate and different objects.
[0061] Here, at least one refers to one or more than one, for example, at least one object can be one object, two objects, three objects, or any other integer greater than or equal to one. And multiple refers to two or more than two, for example, multiple objects can be two objects, three objects, or any other integer greater than or equal to two.
[0062] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the data resources involved in this application are all obtained with full authorization.
[0063] The following is an introduction to the implementation environment of the data resource processing solution provided in the embodiment of the present application.
[0064] Figure 1 1 is a schematic diagram of an implementation environment of a data resource processing method provided in an embodiment of the present application. The implementation environment includes: a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via a wired network or a wireless network, and the present application does not limit this.
[0065] Terminal 101 includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. Schematically, terminal 101 can install and run an application, which is used to provide a data resource transfer function. Schematically, terminal 101 displays an application interface of the application, and in response to a data resource transfer operation implemented on the application interface, the ownership of the corresponding data resource is transferred. Schematically, terminal 101 is a terminal used by a user, and the user account of the user is logged in to the application running in terminal 101.
[0066] In some embodiments, terminal 101 generally refers to one of multiple terminals, and this embodiment is only illustrated by terminal 101. Those skilled in the art will know that the number of the above-mentioned terminals 101 can be greater. For example, the above-mentioned terminals 101 are dozens or hundreds, or more, and the embodiment of the present application does not limit the number of terminals and device types.
[0067] The server 102 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The number of the above-mentioned servers 102 can be more or less, and the embodiments of the present application are not limited to this. Of course, the server 102 can also include other functional servers to provide more comprehensive and diversified services. Schematically, the server 102 is used to provide background services for applications running on the terminal 101. For example, the server 102 transfers the ownership of a data resource in response to a transfer request sent by the terminal 101 for a certain data resource.
[0068] In some embodiments, during the data resource processing process, the server 102 undertakes the main computing work and the terminal 101 undertakes the secondary computing work; or, the server 102 undertakes the secondary computing work and the terminal 101 undertakes the main computing work; or, the server 102 or the terminal 101 can each undertake the computing work independently.
[0069] In some embodiments, the wired or wireless network described above uses standard communication technology and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network, or any combination of a virtual private network. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above data communication technologies.
[0070] The data resource processing method provided in this application can be applied to the scenario of transferring the ownership of data resources. Among them, data resources are any kind of valuable information, data, metadata, and attributes. It can be original, structured, or even semi-structured, all of which belong to data resources. It can be modeled according to metadata standards, or any unstructured data. This application does not limit the specific form of data resources. For example, data resources can be documents, tables, databases, web pages, images, etc., which can be stored on local disks, network storage services, or cloud servers.
[0071] refer to Figure 2 , Figure 2 Schematic diagram of an application scenario provided according to an embodiment of the present application. Figure 2 As shown, taking the data resource transfer in the scenario of enterprise employee resignation as an example, when enterprise employee A resigns, the enterprise manager needs to transfer the ownership of the data resources created by employee A during his employment to the incumbent employee B. Schematically, the terminal displays the application interface of the application, which displays the data resources of employee A. The enterprise manager can operate on the application interface, for example, select employee A's data resources in batches and transfer them to employee B with one click.
[0072] Based on this, the present application provides a data resource processing method, which can ensure the security of data resources and improve transfer efficiency and user experience during the transfer of ownership of data resources. The data resource processing method provided by the present application embodiment is introduced below through several method embodiments.
[0073] Figure 3 1 is a flow chart of a data resource processing method provided according to an embodiment of the present application. Figure 3 As shown, the method is applied to a server. Schematically, the method includes the following steps 301 to 303.
[0074] 301. In response to a transfer request for a data resource, the server locks the data resource so that during the locking of the data resource, no other transfer requests for the data resource except the transfer request are executed, wherein the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object.
[0075] In the embodiment of the present application, the transfer request is sent by the terminal, and the server is used to provide background services for the application running on the terminal, and the application can provide a data resource transfer function. Among them, transferring data resources means transferring the ownership of data resources, or changing the owner of data resources. It should be noted that the present application does not limit the number of data resources targeted by the transfer request. For example, the data resource can be one document or multiple documents, etc.
[0076] Locking data resources means locking the data resources so that during the period when the data resources are locked, the server executes the currently received transfer request for the data resources instead of executing other transfer requests for the data resources, thereby avoiding processing multiple transfer requests in the same time period and avoiding confusion in the ownership of data resources, thereby improving the security of data resources.
[0077] 302. The server executes the main transaction of the transfer request. If the execution is successful, the data resource is unlocked and a first feedback message is sent. The main transaction indicates that the resource status of the data resource is updated to ownership being transferred. The first feedback message indicates that the transfer request has been executed.
[0078] In the embodiment of the present application, the transfer request is implemented by executing a transaction. The transaction corresponding to the transfer request includes a master transaction and a slave transaction. The master transaction indicates that the resource status of the data resource is updated to the ownership being transferred. That is, in the process of executing the master transaction, the ownership of the data resource is not actually transferred to the second object, but the resource status of the data resource is updated. Since this process consumes less time, when the master transaction is successfully executed, a first feedback message is sent to indicate that the transfer request has been executed, which can avoid the initiator of the transfer request waiting for the processing result for a long time and improve the user experience.
[0079] 303. The server executes the slave transaction of the transfer request. If the execution is successful, a second feedback message is sent. The slave transaction indicates that the resource state of the data resource is updated to the ownership right belongs to the second object. The second feedback message indicates that the ownership right of the data resource belongs to the second object.
[0080] In the embodiment of the present application, based on the aforementioned step 302, it can be known that the transaction corresponding to the transfer request also includes a slave transaction, and the slave transaction indicates that the resource status of the data resource is updated to the ownership belongs to the second object, that is, in the process of executing the slave transaction, the ownership of the data resource is actually transferred to the second object. Since this process is performed after sending the first feedback message, it not only avoids the initiator of the transfer request from waiting for the processing result for a long time, but also completes the actual transfer process, thereby ensuring the user experience.
[0081] In summary, in the data resource processing method provided in the present application, in response to a transfer request for a data resource, the ownership of the data resource is transferred by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to realize the real transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience.
[0082] Figure 4 FIG. 1 is a flow chart of another data resource processing method provided according to an embodiment of the present application. Figure 4 As shown, the method is applied to a terminal. Schematically, the method includes the following steps 401 to 403.
[0083] 401. A terminal sends a transfer request for a data resource to a server, where the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object.
[0084] In an embodiment of the present application, an application is running on the terminal, the application can provide a data resource transfer function, and the server is used to provide background services for the application.
[0085] 402. The terminal receives a first feedback message sent by the server, where the first feedback message indicates that the transfer request has been executed.
[0086] In the embodiment of the present application, the server is used to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, no other transfer requests for the data resource other than the transfer request are executed, and the main transaction of the transfer request is executed. If the execution is successful, the data resource is unlocked, and the main transaction indicates that the resource status of the data resource is updated to the ownership being transferred. Figure 3 The illustrated embodiments will not be described in detail.
[0087] 403. The terminal receives a second feedback message sent by the server, where the second feedback message indicates that the ownership of the data resource belongs to the second object.
[0088] In the embodiment of the present application, the server is further used to execute a slave transaction of the transfer request, and the slave transaction indicates that the resource state of the data resource is updated to the ownership right belongs to the second object. Figure 3 The illustrated embodiments will not be described in detail.
[0089] In summary, in the data resource processing method provided in the present application, for a transfer request for a data resource, the ownership of the data resource is transferred by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to realize the real transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience.
[0090] Through the above Figure 3 and Figure 4 , briefly introduces the data resource processing method provided by this application, and the following reference Figure 5 , the data resource processing method provided by this application is introduced in detail.
[0091] Figure 5 1 is a flow chart of a data resource processing method provided according to an embodiment of the present application. Figure 5 As shown, the interaction between a server and a terminal is taken as an example for introduction. Schematically, the method includes the following steps 501 to 509.
[0092] 501. In response to a transfer operation for a data resource, a terminal sends a transfer request for the data resource to a server, where the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object.
[0093] In the embodiment of the present application, the ownership of the data resource belongs to the first object. Schematically, the terminal displays the application interface of the application program, and in response to the transfer operation for the data resource implemented on the application interface, sends a corresponding transfer request to the server.
[0094] In some embodiments, the transfer request carries at least one of the following: the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, and the resource identifier of the data resource, which is not limited in this application. For example, the transfer operation can be a click operation on the "batch transfer" control on the application interface. In response to the operation, the terminal triggers the node Node end interface (an application programming interface based on Node.js) to collect the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, and the resource identifier of the data resource, etc., package these information, generate a transfer request, and send the transfer request to the server through the Common Gateway Interface (CGI).
[0095] 502. In response to the transfer request, the server generates a transaction identifier corresponding to the transfer request, where the transaction identifier indicates a master transaction and a slave transaction of the transfer request.
[0096] In an embodiment of the present application, the server generates a transaction identifier corresponding to the transfer request in response to the transfer request based on the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, and the resource identifier of the data resource. For example, the server serializes the aforementioned various identifiers to obtain a binary string stream, that is, a transaction identifier. In some embodiments, the server also combines a timestamp to generate a transaction identifier. For example, the timestamp is a millisecond-level Unix (Unex, a multi-user, multi-tasking operating system) timestamp, but the present application is not limited to this. In the above manner, the uniqueness of the transaction identifier is ensured.
[0097] In some embodiments, the server responds to the transfer request and verifies the transfer request. If the verification passes, a transaction identifier corresponding to the transfer request is generated, and subsequent step 503 is executed to lock the data resource. Among them, the verification of the transfer request includes at least one of the following: verifying the object identifier of the first object; verifying the object identifier of the second object; verifying the object identifier of the third object that initiates the transfer request; verifying the resource identifier of the data resource. For example, based on the naming rules of the aforementioned various identifiers, the legality of the aforementioned various identifiers is verified. For another example, for the object identifier of the third object, the object identifier is compared with the target list to determine whether the object identifier is in the target list. If so, it indicates that the third object has the authority to initiate the transfer request. The present application does not limit the specific manner in which the server verifies the transfer request.
[0098] 503. The server locks the data resource so that during the locking period of the data resource, other transfer requests other than the transfer request for the data resource are not executed.
[0099] In the embodiment of the present application, the server responds to the transfer request, determines the target name based on the object identifier of the first object, and adds a distributed lock with the target name as the name to the data resource, so that during the locking of the data resource, other transfer requests other than the transfer request for the data resource are not executed. Among them, the distributed lock is a way to control the synchronous access to shared resources between distributed systems.
[0100] In some embodiments, the distributed lock added to the data resource is a Chubby distributed lock. Chubby is a lock service for loosely coupled distributed systems, and is generally used to provide a highly available distributed lock service for a loosely coupled distributed system consisting of a large number of small computers of moderate size. Figure 6 , Figure 6Schematic diagram of a Chubby distributed lock provided according to an embodiment of the present application. Figure 6 As shown in the figure, both service A and service B request to access public resources. If service A first successfully calls the Chubby service to lock through remote procedure call (RPC), then before service A unlocks, the RPC call of service B needs to be blocked and wait until the lock is released before calling the Chubby service to lock. In other words, the Chubby lock is equivalent to the mutual exclusion lock of the distributed system. In addition, the locking process of the Chubby lock is also the process of creating a self-named file, that is, the locking process is realized by the file name based on service A.
[0101] Schematically, taking the Chubby distributed lock as an example, the server responds to the transfer request, determines the target name based on the object identifier of the first object, creates a file based on the target name, and the file name of the file is also the target name. The process of creating the file is also the process of locking the data resource. In some embodiments, the server determines the target name based on the object identifier of the first object and the object identifier of the third object that initiates the transfer request. For example, the target name is expressed as 1XXX-2XXX, where 1XXX is the object identifier of the third object and 2XXX is the object identifier of the first object. Of course, this is only an example, and the specific form of the target name is not limited in this application.
[0102] By locking the data resource, it can be ensured that only one transfer request is processed in the same time period, or in other words, only a transfer request initiated by one object is processed. Figure 7 , Figure 7 is a schematic diagram of a data resource processing method provided according to an embodiment of the present application. Figure 7 As shown, object A and object B simultaneously initiate transfer requests for the same batch of data resources. If the server responds to the transfer request initiated by object A first and successfully locks the data resources, object B can perform subsequent operations only after unlocking.
[0103] 504. The server executes the main transaction of the transfer request, where the main transaction indicates that the resource status of the data resource is updated to the ownership being transferred.
[0104] In the embodiment of the present application, the server uses the transaction identifier as an index to obtain the data resource from the database, and updates the resource status of the data resource to the ownership being transferred. In schematic form, a preset status bit is used to reflect whether the ownership is being transferred. For example, a preset status bit of 0 indicates that the ownership of the data resource is not being transferred, and a preset status bit of 1 indicates that the ownership of the data resource is being transferred. The present application is not limited thereto.
[0105] 505. The server unlocks the data resource and sends a first feedback message to the terminal, where the first feedback message indicates that the transfer request has been executed.
[0106] In an embodiment of the present application, after unlocking the data resource, the server sends a first feedback message to the terminal to prompt that the transfer request has been executed. Taking the server locking the data resource based on the Chubby distributed lock as an example, a preset flag is used to reflect whether the locking is successful, that is, the server unlocks the data by modifying the preset flag. For example, the preset flag is 1 to indicate that the locking is successful, and the preset flag is 0 to indicate that the unlocking is successful, and the present application is not limited to this.
[0107] In some embodiments, when the server unlocks the data resource, if a transfer request for the data resource initiated by a fourth object is received, a third feedback message is sent to the terminal where the fourth object is located, and the third feedback message indicates that the ownership of the data resource is being transferred. In this way, repeated processing of transfer requests for the same data resource can be avoided, saving the operating resources of the server.
[0108] 506. The terminal receives the first feedback message, and displays first prompt information based on the first feedback message, where the first prompt information indicates that the transfer request has been executed.
[0109] In an embodiment of the present application, the terminal receives a first feedback message, and based on the first feedback message, displays a first prompt message on the application interface. For example, the first prompt message is "The transfer request has been executed and is being transferred." Schematically, refer to Figure 8 , Figure 8 is a schematic diagram of a first prompt information provided according to an embodiment of the present application. Figure 8 As shown, the terminal displays the menu item "Data resources to be transferred" in the application interface, and displays the first prompt information "Transfer request has been executed and is being transferred" in the area corresponding to the menu item, or displays the first prompt information "No data yet" in the area to prompt that the data resources are being transferred.
[0110] 507. The server executes a slave transaction of the transfer request, where the slave transaction indicates that the resource status of the data resource is updated to indicate that the ownership right belongs to the second object.
[0111] In an embodiment of the present application, the server uses the transaction identifier as an index to obtain data resources from the database, and updates the resource status of the data resources to indicate that the ownership belongs to the second object. In some embodiments, the server performs a consistency check on the data resources based on the resource status of the data resources, and if the check passes, updates the resource status of the data resources to indicate that the ownership belongs to the second object; wherein the consistency check refers to checking whether the resource status of the data resources is that the ownership is being transferred. For example, taking the example of using a preset status bit to reflect whether the ownership is being transferred, the server verifies the preset status bit of the data resource to determine whether the resource status of the data resource is that the ownership is being transferred. This consistency check method ensures that the data resources processed by the server are not transferred, thereby ensuring the consistency of the data resources.
[0112] It should be noted that the present application does not limit the execution order of the above steps 506 and 507.
[0113] After the above steps 504 to 507, the server realizes the transfer of the ownership of the data resource by executing the master transaction and the slave transaction corresponding to the transfer request. The execution of the slave transaction is asynchronous, which can improve the user experience. Fig. 9 , introduces the principle of asynchronous execution of slave transactions. Fig. 9 , Fig. 9 Schematic diagram of a transaction processing provided according to an embodiment of the present application. Fig. 9 As shown, it should be understood that transactions usually exist to ensure data consistency. After the server (or business service end) registers transaction-related information, the transaction center will return the transaction identifier of this transaction. After executing the main transaction, the server commits (Commit) the main transaction and then returns. At this time, the main transaction has been executed, and the transaction center will deliver a message to process the slave transaction. During the execution of the slave transaction, the consistency of the data is usually verified to ensure data consistency. In addition, since the processing of the slave transaction is asynchronous, it is usually imperceptible to the user, thereby improving the user experience.
[0114] 508. The server sends a second feedback message to the terminal, where the second feedback message indicates that the ownership of the data resource belongs to the second object.
[0115] 509. The terminal receives the second feedback message, and based on the second feedback message, displays second prompt information in response to a viewing operation on the data resource, where the second prompt information indicates that the ownership of the data resource belongs to the second object.
[0116] In an embodiment of the present application, the terminal receives the second feedback message, and based on the second feedback message, in response to the viewing operation of the data resource, displays the second prompt information on the application interface. That is, after the server successfully executes the slave transaction, the execution result is synchronized to the terminal, so that the terminal responds to the viewing operation of the data resource and displays the second prompt information to prompt that the current ownership of the data resource belongs to the second object. For example, the second prompt information is "the ownership belongs to the second object", which is not limited in the present application.
[0117] In summary, in the data resource processing method provided in the present application, in response to a transfer request for a data resource, the ownership of the data resource is transferred by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to realize the real transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience.
[0118] Reference below Fig.10 , taking the server locking data resources based on Chubby distributed lock as an example, the data resource processing method provided in the embodiment of the present application is illustrated.
[0119] Fig.10 is a schematic diagram of a data resource processing method provided according to an embodiment of the present application. Fig.10 As shown, the terminal includes a web page end and a Node end, and the server includes a business service end, a logic end, a lock service end, a database, and a transaction center. Schematically, the data resource processing method includes:
[0120] The web page of the terminal displays the application interface of the application, which displays the data resources of the first object. In response to the transfer operation on the data resources implemented in the application interface, the Node interface is triggered to collect the object identifier of the first object (the person to be transferred), the object identifier of the second object (the transferor), the object identifier of the third object that initiates the transfer request (the operator), and the resource identifier of the data resource, etc., package this information, generate a transfer request, and send the transfer request to the server through the CGI interface.
[0121] The business service end of the server receives the transfer request and verifies the various information carried in the transfer request, including whether the third party has the authority to initiate the transfer request to ensure that there is no unauthorized operation. After the verification is passed, the transfer request is transparently transmitted to the logic end for actual logic processing.
[0122] The logic end of the server responds to the transfer request and starts logic processing, and generates a transaction identifier for this transaction based on various information carried in the transfer request. That is, the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, the resource identifier of the data resource, and the timestamp are serialized to obtain a binary string stream, that is, a transaction identifier.
[0123] After generating the transaction identifier, the logic end of the server calls the lock server (that is, the Chubby server) to lock the data resource and register the transaction information (that is, to record the transaction-related information corresponding to the transfer request). Then, the logic end executes the main transaction of the transfer request, obtains the data resource from the database with the transaction identifier as the index, and updates the resource status of the data resource to the ownership being transferred. The data resource is unlocked and a first feedback message is sent to the terminal. The terminal receives the first feedback message and displays a first prompt message through the web page to prompt that the transfer request has been executed.
[0124] The logical end of the server submits a transaction to the transaction center. The transaction center calls back to the logical end to execute the slave transaction of the transfer request, obtains data resources from the database with the transaction identifier as the index, and performs a consistency check on the data resources to ensure that the data resources to be processed next are those whose ownership is being transferred. If the check passes, the resource status of the data resources is updated to the ownership of the second object.
[0125] It can be seen that through the above method, when the ownership of data resources is transferred, even if the number of data resources is too large, the status of the data resources can be updated by executing the main transaction, and the actual transfer can be realized by executing the slave transaction. For the object that initiates the transfer request, it can quickly receive the notification that the transfer request has been executed after the main transaction updates the status, without having to synchronously wait for the actual transfer process of the slave transaction, which improves the user experience. Moreover, if there are more than two objects transferring the same batch of data resources at the same time, the data resources are locked through the Chubby distributed lock, the processing priority of the data resources is locked, the ownership of the data resources is avoided, and the security of the data resources is ensured. In addition, when executing the slave transaction, the consistency of the data resources is further guaranteed by performing consistency verification on the data resources.
[0126] Fig.11 is a structural diagram of a data resource processing device provided according to an embodiment of the present application. The device is used to execute the steps executed by the server in the above-mentioned data resource processing method, see Fig.11 The device includes: a locking module 1101, a first execution module 1102 and a second execution module 1103.
[0127] The locking module 1101 is used to lock the data resource in response to a transfer request for the data resource, so that during the locking of the data resource, other transfer requests for the data resource other than the transfer request are not executed, and the transfer request indicates that the ownership of the data resource is transferred from the first object to the second object;
[0128] A first execution module 1102 is used to execute the main transaction of the transfer request. If the execution is successful, the data resource is unlocked and a first feedback message is sent. The main transaction indicates that the resource status of the data resource is updated to the ownership being transferred, and the first feedback message indicates that the transfer request has been executed.
[0129] The second execution module 1103 is used to execute the slave transaction of the transfer request. If the execution is successful, a second feedback message is sent, the slave transaction indicates that the resource state of the data resource is updated to the ownership belongs to the second object, and the second feedback message indicates that the ownership of the data resource belongs to the second object.
[0130] In some embodiments, the locking module 1101 is used to:
[0131] In response to the transfer request, a target name is determined based on the object identifier of the first object, and a distributed lock with the target name is added to the data resource so that no other transfer requests for the data resource except the transfer request are executed during the locking of the data resource.
[0132] In some embodiments, the apparatus further comprises:
[0133] A generation module is used to generate a transaction identifier corresponding to the transfer request in response to the transfer request based on the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, and the resource identifier of the data resource, wherein the transaction identifier indicates a master transaction and a slave transaction.
[0134] In some embodiments, the second execution module 1103 is configured to:
[0135] Using the transaction identifier as the index, obtain data resources from the database;
[0136] Updating the resource status of the data resource to indicate that the ownership right belongs to the second object;
[0137] A second feedback message is sent.
[0138] In some embodiments, the second execution module 1103 is configured to:
[0139] Based on the resource status of the data resource, a consistency check is performed on the data resource, and if the check passes, the resource status of the data resource is updated to indicate that the ownership right belongs to the second object;
[0140] The consistency check refers to checking whether the resource status of data resources is that the ownership is being transferred.
[0141] In some embodiments, the locking module 1101 is used to:
[0142] In response to the transfer request, verify the transfer request, and if the verification passes, lock the data resource;
[0143] Among them, verifying the transfer request includes at least one of the following: verifying the object identifier of the first object; verifying the object identifier of the second object; verifying the object identifier of the third object that initiates the transfer request; verifying the resource identifier of the data resource.
[0144] Through the above-mentioned device, in response to a transfer request for a data resource, the ownership transfer of the data resource is realized by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to realize the actual ownership transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience.
[0145] It should be noted that: the data resource processing device provided in the above embodiment only uses the division of the above functional modules as an example when processing data resources. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data resource processing device provided in the above embodiment and the data resource processing method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0146] Fig.12 is a structural diagram of a data resource processing device provided according to an embodiment of the present application. The device is used to execute the steps executed by the terminal in the above-mentioned data resource processing method, see Fig.12 , the device includes: a sending module 1201 and a receiving module 1202.
[0147] The sending module 1201 is used to send a transfer request for a data resource to a server, where the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object;
[0148] The receiving module 1202 is used to receive a first feedback message sent by the server, the first feedback message indicating that the transfer request has been executed, and the server is used to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, other transfer requests for the data resource other than the transfer request are not executed, and execute the main transaction of the transfer request. If the execution is successful, the data resource is unlocked, and the main transaction indicates that the resource status of the data resource is updated to the ownership being transferred;
[0149] The receiving module 1202 is also used to receive a second feedback message sent by the server, the second feedback message indicates that the ownership of the data resource belongs to the second object, and the server is also used to execute a slave transaction of the transfer request, the slave transaction indicates that the resource status of the data resource is updated to the ownership belongs to the second object.
[0150] In some embodiments, the device further comprises a display module, the display module being configured to:
[0151] Based on the first feedback message, displaying first prompt information, the first prompt information indicating that the transfer request has been executed;
[0152] Based on the second feedback message, in response to the viewing operation on the data resource, second prompt information is displayed, and the second prompt information indicates that the ownership of the data resource belongs to the second object.
[0153] Through the above-mentioned device, for a transfer request for a data resource, the ownership transfer of the data resource is realized by locking the data resource, wherein the main transaction of the transfer request is executed during the locking of the data resource, and the resource status of the data resource is updated to avoid processing multiple transfer requests at the same time, thereby ensuring the security of the data resource. Furthermore, when a feedback message is sent to indicate that the transfer request has been executed, the slave transaction of the transfer request is executed to realize the actual ownership transfer process, thereby avoiding the initiator of the transfer request waiting for the processing result of the transfer request for a long time, thereby improving the user experience.
[0154] It should be noted that: the data resource processing device provided in the above embodiment only uses the division of the above functional modules as an example when processing data resources. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data resource processing device provided in the above embodiment and the data resource processing method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0155] In an exemplary embodiment, a computer device is also provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the data resource processing method in the embodiment of the present application.
[0156] Taking computer equipment as the terminal as an example, Fig.13 1 is a schematic diagram of a terminal structure provided according to an embodiment of the present application. The terminal 1300 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 1300 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0157] Typically, the terminal 1300 includes a processor 1301 and a memory 1302 .
[0158] The processor 1301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1301 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0159] The memory 1302 may include one or more computer-readable storage media, which may be non-transitory. The memory 1302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1302 is used to store at least one program code, which is used to be executed by the processor 1301 to implement the data resource processing method provided in the method embodiment of the present application.
[0160] In some embodiments, the terminal 1300 may also optionally include: a peripheral device interface 1303 and at least one peripheral device. The processor 1301, the memory 1302 and the peripheral device interface 1303 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1303 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1304, a display screen 1305, a camera assembly 1306, an audio circuit 1307, a positioning assembly 1308 and a power supply 1309.
[0161] The peripheral device interface 1303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1301 and the memory 1302. In some embodiments, the processor 1301, the memory 1302, and the peripheral device interface 1303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1301, the memory 1302, and the peripheral device interface 1303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0162] The radio frequency circuit 1304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1304 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1304 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1304 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1304 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1304 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0163] The display screen 1305 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1305 is a touch display screen, the display screen 1305 also has the ability to collect touch signals on the surface or above the surface of the display screen 1305. The touch signal can be input to the processor 1301 as a control signal for processing. At this time, the display screen 1305 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1305 can be one, set on the front panel of the terminal 1300; in other embodiments, the display screen 1305 can be at least two, respectively set on different surfaces of the terminal 1300 or in a folding design; in other embodiments, the display screen 1305 can be a flexible display screen, set on a curved surface or a folding surface of the terminal 1300. Even, the display screen 1305 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1305 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0164] The camera assembly 1306 is used to capture images or videos. Optionally, the camera assembly 1306 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1306 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0165] The audio circuit 1307 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1301 for processing, or input them into the radio frequency circuit 1304 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 1300. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1301 or the radio frequency circuit 1304 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1307 may also include a headphone jack.
[0166] The positioning component 1308 is used to locate the current geographical location of the terminal 1300 to implement navigation or LBS (Location Based Service).
[0167] The power supply 1309 is used to power various components in the terminal 1300. The power supply 1309 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1309 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0168] In some embodiments, the terminal 1300 further includes one or more sensors 1310 . The one or more sensors 1310 include, but are not limited to, an acceleration sensor 1311 , a gyroscope sensor 1312 , a pressure sensor 1313 , an optical sensor 1314 , and a proximity sensor 1315 .
[0169] The acceleration sensor 1311 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 1300. For example, the acceleration sensor 1311 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 1301 can control the display screen 1305 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 1311. The acceleration sensor 1311 can also be used to collect motion data of games or users.
[0170] The gyro sensor 1312 can detect the body direction and rotation angle of the terminal 1300, and the gyro sensor 1312 can cooperate with the acceleration sensor 1311 to collect the user's 3D actions on the terminal 1300. The processor 1301 can implement the following functions based on the data collected by the gyro sensor 1312: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0171] The pressure sensor 1313 can be set on the side frame of the terminal 1300 and / or the lower layer of the display screen 1305. When the pressure sensor 1313 is set on the side frame of the terminal 1300, it can detect the user's holding signal of the terminal 1300, and the processor 1301 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1313. When the pressure sensor 1313 is set on the lower layer of the display screen 1305, the processor 1301 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 1305. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0172] The optical sensor 1314 is used to collect the ambient light intensity. In one embodiment, the processor 1301 can control the display brightness of the display screen 1305 according to the ambient light intensity collected by the optical sensor 1314. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1305 is increased; when the ambient light intensity is low, the display brightness of the display screen 1305 is reduced. In another embodiment, the processor 1301 can also dynamically adjust the shooting parameters of the camera assembly 1306 according to the ambient light intensity collected by the optical sensor 1314.
[0173] The proximity sensor 1315, also called a distance sensor, is usually arranged on the front panel of the terminal 1300. The proximity sensor 1315 is used to collect the distance between the user and the front of the terminal 1300. In one embodiment, when the proximity sensor 1315 detects that the distance between the user and the front of the terminal 1300 is gradually decreasing, the processor 1301 controls the display screen 1305 to switch from the screen-on state to the screen-off state; when the proximity sensor 1315 detects that the distance between the user and the front of the terminal 1300 is gradually increasing, the processor 1301 controls the display screen 1305 to switch from the screen-off state to the screen-on state.
[0174] Those skilled in the art will understand that Fig.13 The structure shown in the figure does not constitute a limitation on the terminal 1300, and the terminal 1300 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0175] Take the computer device as a server as an example. Fig.14 It is a structural diagram of a server provided according to an embodiment of the present application. The server 1400 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1401 and one or more memories 1402, wherein the memory 1402 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 1401 to implement the data resource processing method provided by the above-mentioned various method embodiments. Of course, the server can also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server can also include other components for implementing device functions, which will not be repeated here.
[0176] An embodiment of the present application also provides a computer-readable storage medium, which is applied to a computer device. The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the data resource processing method in the above embodiment.
[0177] The embodiment of the present application also provides a computer program product, which includes at least one computer program, and the at least one computer program is stored in a computer-readable storage medium. The processor of the computer device reads the at least one computer program from the computer-readable storage medium, and the processor executes the at least one computer program, so that the computer device executes to implement the data resource processing method in the above embodiment.
[0178] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0179] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data resource processing method, characterized in that: Applied to a server, the method comprises: In response to a transfer request for a data resource, locking the data resource so that during the locking of the data resource, no other transfer request for the data resource other than the transfer request is executed, the transfer request indicating that ownership of the data resource is transferred from a first object to a second object; executing the main transaction of the transfer request, and if the execution is successful, unlocking the data resource, sending a first feedback message, wherein the main transaction indicates that the resource state of the data resource is updated to ownership being transferred, and the first feedback message indicates that the transfer request has been executed; Execute the slave transaction of the transfer request, and if the execution is successful, send a second feedback message, the slave transaction indicates that the resource state of the data resource is updated to the ownership belongs to the second object, and the second feedback message indicates that the ownership of the data resource belongs to the second object.
2. The method according to claim 1, characterized in that The step of locking the data resource in response to the transfer request for the data resource so that no other transfer request for the data resource other than the transfer request is executed during the locking of the data resource comprises: In response to the transfer request, a target name is determined based on the object identifier of the first object, and a distributed lock with the target name is added to the data resource so that no other transfer requests for the data resource except the transfer request are executed during the locking of the data resource.
3. The method according to claim 1, characterized in that: The method further comprises: In response to the transfer request, a transaction identifier corresponding to the transfer request is generated based on the object identifier of the first object, the object identifier of the second object, the object identifier of the third object that initiates the transfer request, and the resource identifier of the data resource, and the transaction identifier indicates the master transaction and the slave transaction.
4. The method according to claim 3, characterized in that The executing the slave transaction of the transfer request, if the execution is successful, sending a second feedback message includes: Using the transaction identifier as an index, obtaining the data resource from a database; Updating the resource status of the data resource to indicate that the ownership right belongs to the second object; The second feedback message is sent.
5. The method according to claim 4, characterized in that The updating the resource status of the data resource to indicate that the ownership right belongs to the second object includes: Based on the resource status of the data resource, a consistency check is performed on the data resource, and if the check passes, the resource status of the data resource is updated to indicate that the ownership right belongs to the second object; The consistency check refers to checking whether the resource status of the data resources is that the ownership is being transferred.
6. The method according to any one of claims 1 to 5, characterized in that The step of locking the data resource in response to the transfer request for the data resource comprises: In response to the transfer request, verifying the transfer request, and if the verification passes, locking the data resource; Among them, the verification of the transfer request includes at least one of the following: verifying the object identifier of the first object; verifying the object identifier of the second object; verifying the object identifier of the third object that initiates the transfer request; and verifying the resource identifier of the data resource.
7. A data resource processing method, characterized in that: Applied to a terminal, the method comprises: Sending a transfer request for a data resource to a server, wherein the transfer request indicates that ownership of the data resource is transferred from a first object to a second object; receiving a first feedback message sent by the server, the first feedback message indicating that the transfer request has been executed, the server being configured to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, no other transfer requests for the data resource other than the transfer request are executed, and executing a main transaction of the transfer request, and if the execution is successful, unlocking the data resource, the main transaction indicating that a resource status of the data resource is updated to ownership being transferred; A second feedback message sent by the server is received, wherein the second feedback message indicates that the ownership of the data resource belongs to the second object, and the server is further used to execute a slave transaction of the transfer request, wherein the slave transaction indicates that the resource state of the data resource is updated to that the ownership belongs to the second object.
8. The method according to claim 7, characterized in that The method further comprises at least one of the following: Based on the first feedback message, displaying first prompt information, wherein the first prompt information indicates that the transfer request has been executed; Based on the second feedback message, in response to a viewing operation on the data resource, second prompt information is displayed, wherein the second prompt information indicates that the ownership of the data resource belongs to the second object.
9. A data resource processing device, characterized in that: Applied to a server, the device comprises: A locking module, configured to lock the data resource in response to a transfer request for the data resource, so that during the locking of the data resource, no other transfer request for the data resource other than the transfer request is executed, wherein the transfer request indicates that the ownership of the data resource is transferred from the first object to the second object; A first execution module, configured to execute the main transaction of the transfer request, unlock the data resource if the execution is successful, and send a first feedback message, wherein the main transaction indicates that the resource status of the data resource is updated to ownership being transferred, and the first feedback message indicates that the transfer request has been executed; The second execution module is used to execute the slave transaction of the transfer request. If the execution is successful, a second feedback message is sent. The slave transaction indicates that the resource status of the data resource is updated to the ownership belongs to the second object, and the second feedback message indicates that the ownership of the data resource belongs to the second object.
10. A data resource processing device, characterized in that: Applied to a terminal, the device comprises: A sending module, configured to send a transfer request for a data resource to a server, wherein the transfer request indicates that the ownership of the data resource is transferred from a first object to a second object; a receiving module, configured to receive a first feedback message sent by the server, the first feedback message indicating that the transfer request has been executed, the server being configured to lock the data resource in response to the transfer request, so that during the period when the data resource is locked, no other transfer request other than the transfer request for the data resource is executed, and execute a main transaction of the transfer request, and if the execution is successful, unlock the data resource, and the main transaction indicates that the resource status of the data resource is updated to the ownership being transferred; The receiving module is further used to receive a second feedback message sent by the server, wherein the second feedback message indicates that the ownership of the data resource belongs to the second object. The server is further used to execute a slave transaction of the transfer request, wherein the slave transaction indicates that the resource status of the data resource is updated to that the ownership belongs to the second object.
11. A computer device, characterized in that: The computer device includes a processor and a memory, the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the data resource processing method according to any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the data resource processing method according to any one of claims 1 to 8.
13. A computer program product, characterized in that The computer program product includes at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the data resource processing method according to any one of claims 1 to 8.
