Resource processing method, device, terminal device and computer-readable storage medium
By setting access permissions for plug-ins and generating isolation identifiers, the problem of resource competition between plug-ins is solved, and stable allocation of system resources and stability of plug-in operation are achieved.
Patent Information
- Application Number
- CN202211662111.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2042-12-23
AI Technical Summary
When plug-ins are running in the system, they are prone to resource contention, which cannot be effectively alleviated by existing technologies, resulting in uneven system resource usage and potential crash risks.
By setting access permissions for the target plug-in and generating an isolation identifier, only the target plug-in is allowed to access specific resources to prevent other plug-ins from competing. The isolation identifier is generated using the plug-in identifier and resource identifier to ensure that the plug-in has exclusive access to resources.
It effectively avoids resource contention between plug-ins, ensures stable allocation of system resources, prevents system crashes, and improves the stability and efficiency of plug-in operation.
Smart Images

Figure CN116244002B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource processing method, apparatus, terminal device, and computer-readable storage medium. Background Art
[0002] With the advancement of computer technology, an increasing number of plug-in programs have emerged to facilitate program development and increase its diversity. The benefit of plug-in-based programs is that they facilitate installation and uninstallation. However, there are two issues with plug-ins freely accessing system resources. First, plug-ins are typically custom programs developed on a custom basis, and therefore are often incompatible with each other. This can easily lead to contention for system resources when different plug-ins are running in a system. Second, plug-ins are typically developed based on the functionality they need to achieve. Therefore, plug-ins typically prioritize the efficient completion of their intended functionality, regardless of sufficient system resources. Consequently, plug-ins will maximize their use of system resources to complete their tasks. This suggests that when plug-ins are running, they cannot effectively mitigate the resource usage of the system, and competition for system resources between different plug-ins is also likely to occur.
[0003] In the prior art, in order to avoid resource competition between plug-ins, the system generally needs to limit the efficiency of plug-in access to resources to prevent a plug-in from accessing too many resources at the same time. This can reserve more resources for other plug-ins to access or call. Summary of the Invention
[0004] The resource processing method provided in this application sets permissions for the target resource accessed by the target plug-in, so that only the target plug-in can access or call the target resource, which can effectively prevent other plug-ins from competing for the target resource.
[0005] In a first aspect, the present application provides a resource processing method, the method comprising:
[0006] Obtaining an access key sent by a target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources;
[0007] Determine the access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key;
[0008] Determining, according to the access interface, a target resource to be accessed by the target plug-in;
[0009] An access permission is set for the target resource, where the access permission indicates that only the target plug-in is allowed to access the resource.
[0010] In some embodiments of the present application, setting access rights for the target resource includes:
[0011] Generate an isolation identifier according to the plug-in identifier of the target plug-in;
[0012] Setting access permissions for the target resource according to the isolation identifier;
[0013] Alternatively, an isolation identifier is generated based on the resource identifier corresponding to the target resource, and access permissions are set for the target resource.
[0014] In some embodiments of the present application, setting access rights for the target resource includes:
[0015] Generate an isolation identifier according to the plug-in identifier of the target plug-in and the resource identifier corresponding to the target resource;
[0016] Access permissions are set for the target resource according to the isolation identifier.
[0017] In some embodiments of the present application, after setting access permissions for the target resource, the method further includes:
[0018] Determining function information for the target plug-in to access the target resource;
[0019] Generate a unique temporary call identifier for the target plug-in to call the target resource according to the function information;
[0020] The unique temporary call identifier is sent to the target plug-in, so that the target plug-in calls the target resource according to the unique temporary call identifier.
[0021] In some embodiments of the present application, determining the function information for the target plug-in to access the target resource includes:
[0022] The function information is determined according to the type of the target plug-in and the target resource to be accessed.
[0023] In some embodiments of the present application, sending the unique temporary call identifier to the target plug-in includes:
[0024] Detecting whether the target plug-in starts calling the target resource;
[0025] If the target plug-in starts to call the target resource, the unique temporary call identifier is sent to the target plug-in.
[0026] In some embodiments of the present application, after setting access permissions for the target resource, the method further includes:
[0027] Detecting whether the target plug-in stops running;
[0028] If the target plug-in stops running, the target plug-in's access permission to the target resource is revoked.
[0029] In a second aspect, the present application further provides a resource processing device, the device comprising:
[0030] An acquisition module, configured to acquire an access key sent by a target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources;
[0031] A first determining module is configured to determine an access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key;
[0032] A second determining module is used to determine the target resource to be accessed by the target plug-in according to the access interface;
[0033] The setting module is used to set access rights for the target resource, where the access rights indicate that only the target plug-in is allowed to access the resource.
[0034] In some embodiments of the present application, the setting module is specifically used to:
[0035] Generate an isolation identifier according to the plug-in identifier of the target plug-in;
[0036] Setting access permissions for the target resource according to the isolation identifier;
[0037] Alternatively, an isolation identifier is generated based on the resource identifier corresponding to the target resource, and access permissions are set for the target resource.
[0038] In some embodiments of the present application, the setting module is further configured to:
[0039] Generate an isolation identifier according to the plug-in identifier of the target plug-in and the resource identifier corresponding to the target resource;
[0040] Access permissions are set for the target resource according to the isolation identifier.
[0041] In some embodiments of the present application, the resource processing device further includes a sending module, and the sending module is specifically configured to:
[0042] Determining function information for the target plug-in to access the target resource;
[0043] Generate a unique temporary call identifier for the target plug-in to call the target resource according to the function information;
[0044] The unique temporary call identifier is sent to the target plug-in, so that the target plug-in calls the target resource according to the unique temporary call identifier.
[0045] In some embodiments of the present application, the sending module is further configured to:
[0046] The function information is determined according to the type of the target plug-in and the target resource to be accessed.
[0047] In some embodiments of the present application, the sending module is further configured to:
[0048] Detecting whether the target plug-in starts calling the target resource;
[0049] If the target plug-in starts to call the target resource, the unique temporary call identifier is sent to the target plug-in.
[0050] In some embodiments of the present application, the resource processing device further includes a release module, and the release module is specifically configured to:
[0051] Detecting whether the target plug-in stops running;
[0052] If the target plug-in stops running, the target plug-in's access permission to the target resource is revoked.
[0053] In a third aspect, the present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and runnable on the processor, wherein the processor executes the computer program to implement the steps in any one of the resource processing methods.
[0054] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the steps in any one of the resource processing methods.
[0055] The resource processing method provided in this application determines the target resource that the plug-in needs to call after receiving the key of the plug-in calling interface when the plug-in is running, and sets a permission for the target resource corresponding to the plug-in that only the plug-in can access, thereby avoiding other plug-ins from accessing the system resources that the plug-in needs to access at the same time, and avoiding the problem of other plug-ins competing for the target resource. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 This is a schematic diagram of a scenario of a resource processing system provided in an embodiment of the present application;
[0058] Figure 2 This is a flow chart of an embodiment of a resource processing method in an embodiment of the present application;
[0059] Figure 3 This is a schematic diagram of a functional module of a resource processing device in an embodiment of the present application;
[0060] Figure 4 It is a structural diagram of the terminal device in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0062] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise specifically defined.
[0063] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. At the same time, it is understood that in the specific implementation of this application, when user information, user data, and other related data are involved, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data must comply with relevant laws, regulations, and standards of relevant countries and regions.
[0064] The following description is provided to enable any person skilled in the art to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that one of ordinary skill in the art will recognize that the present application can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.
[0065] The present application provides a resource processing method, apparatus, device, and storage medium, which are described in detail below.
[0066] See also Figure 1 , Figure 1 This is a schematic diagram of a scenario of a resource processing system provided in an embodiment of the present application. The resource processing system may include a terminal device 100 and a storage device 200. The storage device 200 may transmit data to the terminal device 100. Figure 1 The terminal device 100 in the storage device 200 can obtain the system resources stored in the storage device 200 to execute the resource processing method in this application.
[0067] In the embodiment of the present application, the terminal device 100 includes but is not limited to a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a tablet computer, a wireless terminal device, an embedded device, etc.
[0068] In an embodiment of the present application, communication between the terminal device 100 and the storage device 200 can be achieved through any communication method, including but not limited to mobile communications based on the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), and Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP).
[0069] It should be noted that Figure 1The scenario diagram of the resource processing system shown is only an example. The resource processing system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the resource processing system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0070] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of a resource processing method in an embodiment of the present application. The resource processing method may include the following steps 201 to 204:
[0071] 201. Obtain an access key sent by a target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources.
[0072] In the embodiment of the present application, the target plug-in is the plug-in that has just started running in the plug-in loading system. After the plug-in starts running, it needs to call resources or data in the system to execute the tasks in the plug-in. Moreover, the plug-in needs to use the API to call the system resources, that is, the plug-in needs an interface to call the resources in the system. Therefore, in order for the plug-in to call data through the API, the plug-in usually includes a key, that is, a secret key, so that the corresponding system resources can be obtained through the API. Therefore, when the plug-in starts to verify the secret key, it can be determined that the plug-in has started running.
[0073] Of course, in addition to the solution in the embodiment of the present application, the detection of whether a plug-in is running can also be carried out by detecting the usage of system resources. As is well known, if a system program is enabled, the usage of system resources will increase. Therefore, the change in the usage of system resources can be detected. If the proportion of system resource usage increases, it can be determined which specific plug-in is causing the increase in system usage, and the specific plug-in can be determined.
[0074] In addition, detecting whether the plug-in is running may include other methods, which are not specifically limited here.
[0075] 202. Determine the access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key.
[0076] In the embodiment of the present application, the plug-in calls the corresponding interface through a key. In other words, only when the plug-in has a key can it obtain the corresponding system resources through the interface. In the specific implementation process, there are multiple pre-set interfaces in the system. After the plug-in is running, the system can determine the specific goals that the plug-in needs to achieve based on the operation of the plug-in. Based on the goals to be achieved by the plug-in, the interface corresponding to the plug-in goal that can be achieved is allocated to the plug-in for use by the plug-in. Among them, since the plug-in loading system can be an open system, such a system can allow any third-party plug-in to run in the system. However, in actual situations, there are malicious plug-ins that can easily cause the system to crash and even become unusable. Therefore, when a plug-in needs to call a certain interface, the system will not directly provide the interface to the plug-in. Usually, the plug-in needs to provide permission to call the interface, and this permission is the key in the embodiment of the present application. Only when the plug-in includes the key and the system completes the verification of the key can it be determined that the plug-in has the permission to call the interface corresponding to the key.
[0077] For example, the system contains interfaces A, B, and C. If a plugin A starts running and wishes to call interface A to perform a specific operation, the system can verify the key of plugin A and check whether the plugin has permission to call interface A. If plugin A has permission to call interface A, then interface A is determined to be the interface corresponding to the key.
[0078] Of course, in actual situations, a plug-in may include multiple keys, and one key may correspond to the calling permission of one interface.
[0079] 203. Determine the target resource to be accessed by the target plug-in according to the access interface.
[0080] After the interface corresponding to the plug-in is determined, the interface will interact with the system and feed back the results of the interaction to the plug-in. Specifically, since the interaction content between each interface and the system is different, in other words, each interface will usually only achieve a specific goal in the future. For example: if there is interface A in the system, and the purpose of interface A during compilation is to feed back data A to the calling plug-in. At this time, if plug-in A corresponds to interface A according to the key, interface A will automatically provide data A to plug-in A for use. Therefore, data A is the target resource in the embodiment of the present application.
[0081] Of course, the above description is for ease of understanding only. In practice, the system or interface operates automatically according to the relevant program code, and the specific description is not provided here. Furthermore, the system may also include different interfaces, such as Interface B and Interface C. Interface B corresponds to a specific interaction with the system, and Interface C corresponds to a specific interaction with the system.
[0082] 204. Set access permissions for the target resource, where the access permissions indicate that only the target plug-in is allowed to access the resource.
[0083] However, according to the background technology, after the plug-in obtains the relevant system resources or the relevant system resource usage rights according to the interface, the plug-in can perform relevant processing operations based on these system resources, that is, the target resources, to achieve the relevant purpose. However, not only the operation of the plug-in exists in the system, but also the operation of other plug-ins. If there is another plug-in B at this time, which has the key to call interface A, and the plug-in B also needs to obtain the corresponding system resources through interface A, then the other plug-in B will have a resource conflict with plug-in A, which may easily lead to a system crash or a plug-in crash. Therefore, in order to avoid this situation, after plug-in A corresponds to the target system resource through interface A, it is necessary to set a permission for the target resource so that only plug-in A can call the target resource, so that other plug-ins B can avoid competing for the resources of plug-in A at the same time.
[0084] Specifically, setting unique access rights can be achieved through resource isolation. For example, the target resource corresponding to plugin A can be moved to an isolated folder. In this case, when another plugin B calls the target resource through interface A, interface A cannot call the target resource because the target resource has been moved to the isolated folder. Therefore, the other plugin B cannot compete with plugin A for the resource.
[0085] The resource processing method provided in this application determines the target resource that the plug-in needs to call after receiving the key of the plug-in calling interface when the plug-in is running, and sets a permission for the target resource corresponding to the plug-in that only the plug-in can access, thereby avoiding other plug-ins from accessing the system resources that the plug-in needs to access at the same time, and avoiding the problem of other plug-ins competing for the target resource.
[0086] To better implement the embodiments of the present application, in one embodiment of the present application, setting access permissions for a target resource includes:
[0087] An isolation identifier is generated based on the plug-in identifier of the target plug-in; access permissions are set for the target resource based on the isolation identifier; or, an isolation identifier is generated based on the resource identifier corresponding to the target resource, and access permissions are set for the target resource.
[0088] According to the above embodiments, in the embodiments of the present application, the target resource corresponding to the target plug-in can be granted isolation permissions to achieve a solution in which other plug-ins cannot call the target resource. In addition to the above implementation methods, the present application also provides a method for isolating the target resource by adding an isolation identifier. When the system detects the isolation identifier, the system can index the corresponding target resource through the isolation identifier, and at this time the system can prohibit other plug-ins from calling the target resource.
[0089] Specifically, adding an isolation identifier may include the following methods, for example: when each plug-in is created, in order to facilitate system identification, each plug-in will have its own identification method, including some plug-in identification codes, etc. Therefore, assuming that the identification code corresponding to a plug-in is 123, at this time, an association method can be established between the target resource and the identification code 123 of the plug-in, and a unique temporary access right can be added to the association method. If other plug-ins want to call the target resource at this time, since the target resource has established an association relationship with the identification code 123, the system can determine that the target resource is being called by the plug-in with the identification code 123 based on the association relationship. Therefore, the system can deny other plug-ins access to the target resource, so as to achieve the effect of isolating the target resource.
[0090] Of course, the system can also authorize temporary permissions based on the plug-in's key. Suppose that the plug-in's identification code is still 123, and the key for the plug-in to call the target resource through the API is test-key, then the system can add the plug-in's identification code to the key. For example, the added key can be 123-test-key. At this time, the system modifies the calling permissions so that all plug-ins in the system can only call the corresponding target resource through the API through the key 123-test-key. This can prevent other plug-ins from calling the corresponding resource by calling the API. This can also achieve the effect that other plug-ins cannot call the target resource when the target plug-in calls the target resource. This method is also because, at this time, since only the modified key can call the API, it is equivalent to generating a temporary permission for the API call, avoiding other plug-ins from calling the API, and further reducing the problem of other plug-ins interfering with the work of the current plug-in. It should be noted that there are many ways to add the identification code to the key, which are not limited here.
[0091] In addition, in order for the system to be able to identify resources, resources can also have corresponding identification codes. At this time, the plug-in identification code can be replaced with the resource identification code. Other methods of establishing isolation permissions are the same as those described above, and the details will not be repeated here.
[0092] To better implement the embodiments of the present application, in one embodiment of the present application, setting access permissions for a target resource includes:
[0093] An isolation identifier is generated according to the plug-in identifier of the target plug-in and the resource identifier corresponding to the target resource; and access permissions are set for the target resource according to the isolation identifier.
[0094] According to the above embodiment, the identification code of the plug-in or the identification code of the resource can be used alone to generate corresponding permissions for isolation.
[0095] Assume that the plug-in's identification code is still 123, while the target resource's identification code is now 456, and the plug-in's key for calling the target resource through the API is still test-key, then the system can add the plug-in's identification code and the resource's identification code to the key. For example, the added key can be 123-test-key-456. At this time, the system modifies the calling permissions so that all plug-ins in the system can only call the corresponding target resource through the API through the key 123-test-key-456. This prevents other plug-ins from calling the corresponding resource by calling the API, and also achieves the effect that other plug-ins cannot call the target resource when the target plug-in calls the target resource. This method is also because, since only the modified key can call the API, it is equivalent to generating a temporary permission for the API call, avoiding other plug-ins from calling the API, further reducing the problem of other plug-ins interfering with the current plug-in's work. In addition, since the resource's identification code is also added to directly associate the target resource with the target plug-in, it can also solve the problem of other non-plug-in programs, or programs that do not need to go through the API, directly calling the target resource.
[0096] To better implement the embodiments of the present application, in one embodiment of the present application, after setting access permissions for the target resource, the method further includes:
[0097] Determine function information for the target plug-in to access the target resource; generate a unique temporary call identifier for the target plug-in to call the target resource based on the function information; and send the unique temporary call identifier to the target plug-in so that the target plug-in calls the target resource based on the unique temporary call identifier.
[0098] The above embodiment provides a practical way to isolate resources. However, in actual situations, the plug-in not only needs to be implemented through the resources of the system, but also requires some functions provided by the system to complete the realization of the goal. For example: if the plug-in is an information sending plug-in, when the information sending plug-in is loaded, the system detects that the information sending plug-in starts to run. At this time, the system can isolate the target resources according to the method of the above embodiment, that is, give the information sending plug-in a unique permission to call the target resource. For example, the target resource can be a communication directory, and these communication directories can be the objects to which the plug-in needs to send information. At this time, the plug-in only knows who to send it to, and the plug-in does not know how to send it, or what content to send to the target. At this time, the system can provide some relevant functional functions for the plug-in to write the sending content, and send the completed sending content to the target through the system's information sending tool.
[0099] As we all know, when tools are used by others, their own use of those tools will be affected. The same applies to plugins. If these functions are used by other plugins, the target plugin will also be affected if it uses these functions. To prevent the target plugin from being called by other functions, which would render the target function unusable, it is necessary to set permissions for the functions required by the plugin to achieve function isolation.
[0100] In this case, based on the plugin's interaction with the API, the system can also determine which specific functions in the system the plugin needs to call. In this case, the system can isolate the functions that the target plugin needs to call, preventing other plugins from finding the functions that the target plugin needs to call when calling them, thereby also preventing competition for functions between different plugins. For example, the target function to be called by the target plugin can be placed in a folder, a temporary call identifier can be added to the folder, and the temporary call identifier can be associated with the target plugin, allowing only the target plugin to call functions in the isolated folder.
[0101] Alternatively, the unique temporary call identifier can be generated based on the modified key described above. Specifically, after determining the target function that the target plug-in needs to call, some of the function's parameters are incorporated into the modified key, such as some of the function's identifiers, to form a unique temporary call identifier. For example, if the modified key is called "changed-key," and the identifier corresponding to the function A to be called is "789," then the function's identifier and the modified key are combined to create a unique temporary call identifier that includes "789-changed-key." The system then generates a temporary call permission for this unique temporary call identifier, effectively allowing only the target plug-in to call function A. If the system receives a request from another plug-in to call function A and does not detect the identifier "789" included in the key, it will determine that the other plug-in does not have permission to call function A. Once the system has completed the permission modification, it sends the unique temporary call identifier to the target plug-in. When the target plug-in needs to call the function, it sends the unique temporary call identifier to the system. After verification, the system allows the target plug-in to call function A. Function isolation can also be achieved through other methods, which are not specifically defined here.
[0102] To better implement the embodiments of the present application, in one embodiment of the present application, determining function information for a target plug-in to access a target resource includes:
[0103] Determine the function information based on the target plug-in type and the target resource to be accessed.
[0104] Because different plugins implement different functions, the system can determine which functions are likely to be called by the target plugin based on their functionality. For example, if the target plugin is a message-sending plugin, the system can isolate the functions that implement the sending functionality, eliminating the need for the plugin to interact with the API before determining which functions the plugin will call.
[0105] In order to better implement the embodiment of the present application, in one embodiment of the present application, sending the unique temporary call identifier to the target plug-in includes:
[0106] Detect whether the target plug-in starts to call the target resource; if the target plug-in starts to call the target resource, send a unique temporary call identifier to the target plug-in.
[0107] In actual situations, the plug-in may take a long time to load, and for various reasons, the plug-in will not immediately call the target resources and related functions after it is run. Therefore, the system does not need to immediately send the unique temporary call identifier to the plug-in. The advantage of this is that if the current target plug-in does not call the relevant resources or functions for a long time, other plug-ins can call them first. In addition, it should be noted that in the embodiment of the present application, sending the unique temporary call identifier to the target plug-in can be understood as, if it is detected that the target plug-in needs to call the relevant resources and functions, then modifying the call permissions in the system, and sending the unique temporary call identifier that can pass the permission verification to the target plug-in. In this way, the problem that other plug-ins can only use the same resources or functions after the target plug-in can be solved.
[0108] Furthermore, in the embodiments of this application, plugins are collections of programs. Therefore, plugins request system resources and functions based on the execution of these programs. Therefore, when the system receives a plugin-related call request, it can determine that the conditions are met to send a unique temporary call identifier to the target plugin. Afterwards, the sending operation can be performed.
[0109] To better implement the embodiments of the present application, in one embodiment of the present application, after setting access permissions for the target resource, the method further includes:
[0110] Check whether the target plug-in has stopped running; if the target plug-in has stopped running, revoke the target plug-in's access rights to the target resource.
[0111] To prevent the target resource from remaining in an isolated state, when the system detects that the target plug-in has stopped running, it will remove the isolated resources associated with the target plug-in. For example, this could include restoring the isolated folder to its original location or deleting the permissions associated with the isolation identifier. Specifically, permissions can be adjusted based on the actual situation, and the specifics are not specified here.
[0112] In summary, in order to further understand the content of the embodiments of the present application, we can take the reading and writing of the Redis database through the running unit in the plug-in as an example.
[0113] First, define the Redis read and write API. This API is defined in the SDK, making it visible to both the plugin and the system. Next, define the API implementation class within the system. To achieve data isolation, prepend the identifier of the running unit to the Redis key. For example, if the running unit is a channel instance and a key-value pair with the key test_key is set within the channel instance, the key actually set in Redis is 109__SEP__test_key. 109 is the ID of the channel instance.
[0114] When the system generates an object for the channel instance, it injects an object generation expression of the API implementation class into the plug-in, calls the expression to generate the object, and injects the expression into the running context of the channel instance.
[0115] When the channel instance within the plugin is actually running, calling the API will automatically detect whether the API object exists. If not, the expression is used to generate the object. Then, the Redis operation method of the object can be called. Key assembly and other processes are not affected by the calls within the plugin.
[0116] In order to better implement the resource processing method in the embodiment of the present application, in addition to the resource processing method, the embodiment of the present application also provides a resource processing device, such as Figure 3 As shown, the apparatus 300 includes:
[0117] The acquisition module 301 is used to obtain the access key sent by the target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources;
[0118] The first determining module 302 is configured to determine the access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key;
[0119] The second determining module 303 is used to determine the target resource to be accessed by the target plug-in according to the access interface;
[0120] The setting module 304 is used to set access rights for the target resource. The access rights indicate that only the target plug-in is allowed to access the resource.
[0121] The resource processing decorative paper provided in this application receives the key for sending the plug-in calling interface through the acquisition module 301, and then determines the target resource that the plug-in needs to call through the first determination module 302 and the second determination module 303, and sets the target resource corresponding to the plug-in with a permission that only the plug-in can access through the setting module 304, thereby avoiding other plug-ins from accessing the system resources that the plug-in needs to access at the same time, and avoiding the problem of other plug-ins competing for the target resource.
[0122] In some embodiments of the present application, the setting module 304 is specifically used to:
[0123] Generate an isolation identifier based on the plug-in identifier of the target plug-in;
[0124] Set access permissions for target resources based on the isolation identifier;
[0125] Alternatively, an isolation identifier is generated based on the resource identifier corresponding to the target resource, and access permissions are set for the target resource.
[0126] In some embodiments of the present application, the setting module 304 is further configured to:
[0127] Generate an isolation identifier based on the plugin identifier of the target plugin and the resource identifier corresponding to the target resource;
[0128] Set access permissions for target resources based on the isolation identifier.
[0129] In some embodiments of the present application, the resource processing device further includes a sending module 305, which is specifically configured to:
[0130] Determine the function information of the target plug-in to access the target resource;
[0131] Generate a unique temporary call identifier for the target plug-in to call the target resource based on the function information;
[0132] The unique temporary call identifier is sent to the target plug-in, so that the target plug-in calls the target resource according to the unique temporary call identifier.
[0133] In some embodiments of the present application, the sending module 305 is further configured to:
[0134] Determine the function information based on the target plug-in type and the target resource to be accessed.
[0135] In some embodiments of the present application, the sending module 305 is further configured to:
[0136] Check whether the target plug-in starts calling the target resource;
[0137] If the target plug-in starts to call the target resource, the unique temporary call identifier is sent to the target plug-in.
[0138] In some embodiments of the present application, the resource processing device further includes a release module 306, which is specifically configured to:
[0139] Check whether the target plug-in stops running;
[0140] If the target plug-in stops running, revoke the target plug-in's access rights to the target resources.
[0141] The present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the steps of any one of the resource processing methods in the present application. Figure 4 , which shows a schematic diagram of the structure of the terminal device involved in the embodiment of the present application, specifically:
[0142] The terminal device may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 4 The terminal device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0143] Processor 401 is the control center of the terminal device. It connects the various components of the entire terminal device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, processor 401 may include one or more processing cores. Processor 401 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0144] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0145] The terminal device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0146] The terminal device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0147] Although not shown, the terminal device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the terminal device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions, such as:
[0148] Get the access key sent by the target plug-in; the target plug-in represents the plug-in that is running and waiting to access resources;
[0149] According to the access key, determine the access interface that the target plug-in wants to access; each access interface is set with an access key;
[0150] Determine the target resource to be accessed by the target plug-in based on the access interface;
[0151] Set access permissions for the target resource. The access permissions indicate that only the target plug-in is allowed to access the resource.
[0152] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0153] To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk, or an optical disk. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps of any resource processing method provided in the embodiment of the present application. For example, the computer program loaded by the processor may execute the following steps:
[0154] Get the access key sent by the target plug-in; the target plug-in represents the plug-in that is running and waiting to access resources;
[0155] According to the access key, determine the access interface that the target plug-in wants to access; each access interface is set with an access key;
[0156] Determine the target resource to be accessed by the target plug-in based on the access interface;
[0157] Set access permissions for the target resource. The access permissions indicate that only the target plug-in is allowed to access the resource.
[0158] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above and will not be repeated here.
[0159] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to implement as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments and will not be repeated here.
[0160] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0161] The above is a detailed introduction to a resource processing method and device provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core ideas. At the same time, for technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A resource processing method, characterized in that: The method comprises: Obtaining an access key sent by a target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources; Determine the access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key; Determining, according to the access interface, a target resource to be accessed by the target plug-in; Setting access permissions for the target resource, wherein the access permissions indicate that only the target plug-in is allowed to access the resource; The step of setting access rights for the target resource includes: Generate an isolation identifier according to the plug-in identifier of the target plug-in; Access permissions are set for the target resource according to the isolation identifier.
2. The resource processing method according to claim 1, characterized in that: The step of setting access permissions for the target resource includes: Generate an isolation identifier according to the plug-in identifier of the target plug-in and the resource identifier corresponding to the target resource; Access permissions are set for the target resource according to the isolation identifier.
3. The resource processing method according to claim 1, characterized in that: After setting access permissions for the target resource, the method further includes: Determining function information for the target plug-in to access the target resource; Generate a unique temporary call identifier for the target plug-in to call the target resource according to the function information; The unique temporary call identifier is sent to the target plug-in, so that the target plug-in calls the target resource according to the unique temporary call identifier.
4. The resource processing method according to claim 3, characterized in that: The determining the function information for the target plug-in to access the target resource includes: The function information is determined according to the type of the target plug-in and the target resource to be accessed.
5. The resource processing method according to claim 3, characterized in that: The sending the unique temporary call identifier to the target plug-in includes: Detecting whether the target plug-in starts calling the target resource; If the target plug-in starts to call the target resource, the unique temporary call identifier is sent to the target plug-in.
6. The resource processing method according to claim 1, characterized in that: After setting access permissions for the target resource, the method further includes: Detecting whether the target plug-in stops running; If the target plug-in stops running, the target plug-in's access permission to the target resource is revoked.
7. A resource processing device, characterized in that: The device comprises: An acquisition module, configured to acquire an access key sent by a target plug-in; the target plug-in represents a plug-in that is running and waiting to access resources; A first determining module is configured to determine an access interface to be accessed by the target plug-in according to the access key; each access interface is correspondingly provided with an access key; A second determining module is used to determine the target resource to be accessed by the target plug-in according to the access interface; A setting module, configured to set access rights for the target resource, wherein the access rights indicate that only the target plug-in is allowed to access the resource; The setting module is further configured to generate an isolation identifier according to the plug-in identifier of the target plug-in; and set access rights for the target resource according to the isolation identifier.
8. A terminal device, characterized in that: The terminal device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of the resource processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in the resource processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Information terminal device, information terminal management system, and storage medium in which program is stored
CN102667405A
Method and system for improving resource effectiveness of server cluster
CN104573428A