PSR model component resource processing method and device, computer equipment and storage medium
By locking component resources and recording reference counts during PSR model loading, the problem of unstable business loading in PSR model component resource processing is solved, achieving higher stability.
Patent Information
- Application Number
- CN202410999604.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-12
AI Technical Summary
In existing PSR model component resource processing methods, when the underlying component resources are referenced by multiple upper-level PSR models, business loading is prone to instability due to resource changes.
When the PSR model is loaded, the referenced component resources are set to a locked state, and the reference count is recorded through a reference counter. The reference count is updated in response to the unbinding request, and the lock is only unlocked when the component resources are no longer referenced.
This improves the stability of service loading in the PSR model and avoids service loading failures caused by changes in component resources.
Smart Images

Figure CN118939452A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a PSR model component resource processing method, apparatus, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] With the development of computer technology, a technical solution for product design based on the PSR model, namely the product-service-resource model, has emerged. The design concept of the PSR model is to decouple resources, services, and products in layers, and assemble and design them based on the underlying cloud network capabilities to form services and provide communication services / products to the outside world.
[0003] In traditional technology, a certain underlying component resource may be set to be referenced by multiple upper-level PSR models at the same time. If the underlying component resource is in an editable state at this time, the upper-level PSR model that references the underlying component resource may not be able to load the business smoothly due to the change of the underlying component resource. Therefore, in the existing PSR model component resource processing method, the business loading stability of the PSR model is low. Summary of the invention
[0004] Based on this, it is necessary to provide a PSR model component resource processing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the business loading stability of the PSR model in response to the above technical problems.
[0005] In a first aspect, the present application provides a PSR model component resource processing method, comprising:
[0006] When the target PSR model is loaded, obtaining a first component resource referenced by the target PSR model;
[0007] Setting the first component resource to a locked state indicating that the resource cannot be edited, and updating a first reference count of the first component resource by each PSR model;
[0008] In response to an unbinding request initiated for releasing a component resource reference relationship for the target PSR model, obtaining a second component resource associated with the unbinding request, and updating a second reference count of the second component resource being referenced by each PSR model;
[0009] When the updated second reference count indicates that the second component resource has not been referenced, the second component resource is set to an unlocked state indicating that it can be edited.
[0010] In one embodiment, the first number of references and the second number of references are stored via a reference counter; the updating of the first number of references of the first component resource referenced by each PSR model includes: when the first component resource is referenced by a PSR model for the first time, setting the first number of references to 1 and storing it in the reference counter; when the first component resource is not referenced by a PSR model for the first time, updating the first number of references stored in the reference counter; the updating of the second number of references of the second component resource referenced by each PSR model includes: updating the second number of references stored in the reference counter.
[0011] In one embodiment, before updating the first number of references of the first component resource by each PSR model, it also includes: obtaining a first component resource identifier corresponding to the first component resource; detecting whether a component resource identifier matching the first component resource identifier is stored in a preset distributed storage device; the distributed storage device is used to store a mapping relationship between a component resource identifier and a PSR model identifier, and the mapping relationship is used to characterize that the component resource corresponding to the component resource identifier is referenced by the PSR model corresponding to the PSR model identifier; when the distributed storage device does not store a component resource identifier matching the first component resource identifier, determining that the first component resource is referenced by the PSR model for the first time; when the distributed storage device stores a component resource identifier matching the first component resource identifier, determining that the first component resource is not referenced by the PSR model for the first time.
[0012] In one embodiment, when the first component resource is not referenced by the PSR model for the first time, updating the first reference count stored in the reference counter includes: when the first component resource is not referenced by the PSR model for the first time, obtaining a PSR model identifier stored in the distributed storage device that has a mapping relationship with the first component resource identifier; when the PSR model identifier that has a mapping relationship with the first component resource identifier does not include a target PSR model identifier corresponding to the target PSR model, adding 1 to the first reference count stored in the reference counter as the updated first reference count stored in the reference counter.
[0013] In one embodiment, after obtaining the PSR model identifier stored in the distributed storage device and having a mapping relationship with the first component resource identifier, it also includes: when the PSR model identifier having a mapping relationship with the first component resource identifier includes the target PSR model identifier, stopping updating the first number of references stored in the reference counter.
[0014] In one embodiment, the PSR model component resource processing method further includes: when the distributed storage device does not store a component resource identifier that matches the first component resource identifier, creating a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device; when the PSR model identifier to which the first component resource identifier has a mapping relationship does not contain a target PSR model identifier corresponding to the target PSR model, creating a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device.
[0015] In one embodiment, after obtaining the second component resource associated with the unbinding request, it also includes: obtaining a second component resource identifier corresponding to the second component resource, and a target PSR model identifier corresponding to the target PSR model; and deleting the mapping relationship between the second component resource identifier and the target PSR model identifier in the distributed storage device.
[0016] In one embodiment, updating the second reference count stored in the reference counter includes: subtracting 1 from the second reference count stored in the reference counter as the updated second reference count stored in the reference counter; and setting the second component resource to an unlocked state indicating that it can be edited when the updated second reference count indicates that the second component resource has not been referenced, includes: setting the second component resource to an unlocked state indicating that it can be edited when the updated second reference count stored in the reference counter is zero.
[0017] In one embodiment, after updating the second number of references of the second component resource by each PSR model, the method further includes: when the updated second number of references indicates that the second component resource is still referenced by the PSR model, stopping setting the second component resource to an unlocked state indicating that it can be edited.
[0018] In a second aspect, the present application also provides a PSR model component resource processing device, including:
[0019] A first resource acquisition module, used for acquiring a first component resource referenced by the target PSR model when the target PSR model is loaded;
[0020] A component resource locking module, used to set the first component resource to a locked state indicating that it cannot be edited, and update a first reference count of the first component resource by each PSR model;
[0021] A second resource unbinding module is used to respond to an unbinding request initiated for releasing a component resource reference relationship for the target PSR model, obtain a second component resource associated with the unbinding request, and update a second reference count of the second component resource being referenced by each PSR model;
[0022] The component resource unlocking module is used to set the second component resource to an unlocked state indicating that it can be edited when the updated second reference number indicates that the second component resource has not been referenced.
[0023] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method as described in any one of the embodiments of the first aspect when executing the computer program.
[0024] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method as described in any one of the embodiments of the first aspect.
[0025] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method as described in any one of the embodiments of the first aspect.
[0026] The above-mentioned PSR model component resource processing method, apparatus, computer equipment, computer-readable storage medium and computer program product obtain the first component resource referenced by the target PSR model when the target PSR model is loaded; set the first component resource to a locked state indicating that it cannot be edited, and update the first number of references of the first component resource by each PSR model; in response to an unbinding request initiated for the target PSR model to release the component resource reference relationship, obtain the second component resource associated with the unbinding request, and update the second number of references of the second component resource by each PSR model; when the updated second number of references indicates that the second component resource has not been referenced, set the second component resource to an unlocked state indicating that it can be edited. The present application can set the first component resource referenced by the loaded PSR model to a locked state that cannot be edited when the PSR model is loaded, and update the first reference count of the first component resource. Thereafter, when the component resource reference of the PSR model is released, the unbound second component resource can be determined, and the reference count of the second component resource can be updated. The second component resource is not set to an editable unlocked state until the updated second reference count indicates that the second component resource is not referenced. In this way, it can be ensured that the component resource is in a non-editable state when it is referenced by the PSR model, and is not in an editable state until all reference relationships of the component resource are released. Therefore, it can be avoided that the PSR model cannot load the business smoothly due to changes in the referenced component resources, thereby improving the business loading stability of the PSR model. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions 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 related drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 A schematic diagram of a process of processing a PSR model component resource in one embodiment;
[0029] Figure 2 A schematic diagram of a flow chart of updating a first reference count of a first component resource in one embodiment;
[0030] Figure 3 A schematic diagram of a process for determining whether a first component resource is referenced for the first time in one embodiment;
[0031] Figure 4 A schematic diagram of the architecture of a PSR model in one embodiment;
[0032] Figure 5 A schematic diagram of a process for locking component resources in an embodiment;
[0033] Figure 6 A schematic diagram of a process for unlocking a component resource in one embodiment;
[0034] Figure 7 A structural block diagram of a PSR model component resource processing device in an embodiment;
[0035] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0037] In one embodiment, Figure 1 As shown, a PSR model component resource processing method is provided. This embodiment uses the method applied to a server as an example for illustration. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0038] Step S101: when the target PSR model is loaded, obtain the first component resource referenced by the target PSR model.
[0039] Among them, the target PSR model refers to the PSR model that is newly loaded online after the design is completed, and the first component resource can be various component resources referenced by the target PSR model. Specifically, when the user designs the target PSR model, the referenced component resources can be selected according to the functions implemented by the PSR model. Therefore, when the target PSR model is designed and loaded, the server can obtain the component resources referenced by the target PSR model as the first component resource.
[0040] Step S102: setting the first component resource to a locked state indicating that the first component resource cannot be edited, and updating a first reference count of the first component resource by each PSR model.
[0041] The first reference count refers to the number of times the first component resource is referenced by various PSR models loaded online, and the locked state refers to the state in which the first component resource cannot be edited. When the target PSR model is loaded, in order to avoid changes in the first component resource referenced by the PSR model, which may cause the PSR model that references the first component resource, such as the target PSR model, to be unable to load the business smoothly, when the server completes the design of a certain PSR model and loads it, it can initiate a lock request to lock the first component resource referenced by the target PSR model, thereby setting the first component resource to a locked state. In this state, the first component resource is in an uneditable state, and since the first component resource is referenced by the target PSR model, that is, the number of times the first component resource is referenced by the PSR model has also increased, it is necessary to update the first reference count corresponding to the first component resource.
[0042] Step S103, in response to an unbinding request initiated for releasing a component resource reference relationship for a target PSR model, obtaining a second component resource associated with the unbinding request, and updating a second reference count of the second component resource by each PSR model.
[0043] An unbinding request refers to a request for releasing the reference relationship between a certain PSR model, which may be a target PSR model and the component resource it references, and the second component resource refers to the component resource whose reference relationship is released by the unbinding request. For example, a certain PSR model has a reference relationship with both component resource A and component resource B. If the user needs to release the reference relationship between the PSR model and component resource A, an unbinding request for the PSR model can be initiated. The PSR model then serves as the target PSR model, and component resource A serves as the second component resource.
[0044] The second number of citations refers to the number of times the second component resource is referenced by each PSR model. Similar to the first number of citations, since the reference relationship between the second component resource and the target PSR model is unbound, the number of times the second component resource is referenced by the PSR model is also reduced, so the second number of citations corresponding to the second component resource needs to be updated.
[0045] Step S104: When the updated second reference count indicates that the second component resource has not been referenced, the second component resource is set to an unlocked state indicating that it can be edited.
[0046] The unlocked state refers to the state in which the second component resource can be edited. If the second component resource is not referenced by any PSR model, even if the component resource changes, it will not affect the loading of the PSR model business. Therefore, in this case, the server allows the user to edit the component resource, thereby setting it to the unlocked state. Specifically, after the server completes the update of the second reference count, if the updated second reference count indicates that the second component resource has not been referenced, for example, the second reference count is 0, the server can set the second component resource to the unlocked state indicating that it can be edited.
[0047] In the above-mentioned PSR model component resource processing method, when the target PSR model is loaded, the first component resource referenced by the target PSR model is obtained; the first component resource is set to a locked state indicating that it cannot be edited, and the first number of references to the first component resource by each PSR model is updated; in response to an unbinding request initiated for the target PSR model to release the component resource reference relationship, the second component resource associated with the unbinding request is obtained, and the second number of references to the second component resource by each PSR model is updated; when the updated second number of references indicates that the second component resource has not been referenced, the second component resource is set to an unlocked state indicating that it can be edited. The present application can set the first component resource referenced by the loaded PSR model to a locked state that cannot be edited when the PSR model is loaded, and update the first reference count of the first component resource. Thereafter, when the component resource reference of the PSR model is released, the unbound second component resource can be determined, and the reference count of the second component resource can be updated. The second component resource is not set to an editable unlocked state until the updated second reference count indicates that the second component resource is not referenced. In this way, it can be ensured that the component resource is in a non-editable state when it is referenced by the PSR model, and is not in an editable state until all reference relationships of the component resource are released. Therefore, it can be avoided that the PSR model cannot load the business smoothly due to changes in the referenced component resources, thereby improving the business loading stability of the PSR model.
[0048] In one embodiment, the first reference count and the second reference count are stored by a reference counter; Figure 2 As shown, step S102 may further include:
[0049] Step S201: When a first component resource is referenced by a PSR model for the first time, a first reference count is set to 1 and stored in a reference counter.
[0050] The reference counter is a counter used to store the number of times each component resource is referenced by the PSR model. In this embodiment, both the first reference count and the second reference count can be stored in the reference counter. Therefore, updating the first reference count and the second reference count is to update the first reference count and the second reference count stored in the reference counter.
[0051] Specifically, if a first component resource is referenced by a PSR model for the first time, that is, the target PSR model is the first PSR model that references the first component resource, there is no count value for the first component resource in the reference counter. Therefore, the server can directly set the first reference count to 1 and store it in the reference counter.
[0052] Step S202: when the first component resource is not referenced by the PSR model for the first time, update the first reference count stored in the reference counter.
[0053] If a first component resource is not referenced by the PSR model for the first time, that is, the reference counter has already recorded the first reference count value corresponding to the first component resource, then the server can update the first reference count stored in the reference counter, for example, by adding 1 to the original first reference count, to achieve the update of the first reference count.
[0054] Step S103 may further include: updating a second reference count stored in the reference counter.
[0055] Similarly, when the second reference count is updated, the second reference count stored in the reference counter is updated, and since the second component resource has been already included in the target PSR model, the reference counter must store the reference count of the second component resource pre-stored. At this time, the server can update the second reference count stored in the reference counter, for example, by subtracting 1 from the original second reference count to achieve the update of the second reference count.
[0056] In this embodiment, the server can also store the first reference count and the second reference count through a reference counter, and update the first reference count and the second reference count by updating the reference count stored in the reference counter. In this way, the accuracy of the reference count update can be improved.
[0057] In addition, if Figure 3 As shown, before step S102, the following may also be included:
[0058] Step S301: Obtain a first component resource identifier corresponding to a first component resource.
[0059] The first component resource identifier refers to the identification information used to uniquely identify the first component resource, for example, it can be the encoding information of the component resource, and the encoding information can be used to distinguish different components and ensure uniqueness in the storage device. Specifically, after the server determines the first component resource referenced by the target PSR model, it can also obtain the build resource identifier corresponding to the first component resource.
[0060] Step S302, detecting whether a component resource identifier matching the first component resource identifier is stored in a preset distributed storage device; the distributed storage device is used to store a mapping relationship between the component resource identifier and the PSR model identifier, and the mapping relationship is used to indicate that the component resource corresponding to the component resource identifier is referenced by the PSR model corresponding to the PSR model identifier;
[0061] Step S303: if no component resource identifier matching the first component resource identifier is stored in the distributed storage device, determining that the first component resource is referenced by the PSR model for the first time;
[0062] Step S304: when a component resource identifier matching the first component resource identifier is stored in the distributed storage device, determine that the first component resource is not referenced by the PSR model for the first time.
[0063] A distributed storage device refers to a storage device used to store the reference relationship between component resources and PSR models. The reference relationship can be represented by a mapping relationship. By creating a mapping relationship between a component resource identifier and a PSR model identifier in a distributed storage device, it can be indicated that the PSR model references the component resource. For example, if a mapping relationship between component resource identifier A and PSR model identifier 1 is stored in a distributed storage device, it means that PSR model 1 references component resource A.
[0064] That is to say, if the distributed storage device has already stored a component resource identifier that matches the first component resource identifier, for example, has stored a component resource identifier that is identical to the first component resource identifier, then it means that the first component resource has been referenced by the PSR model, and it must not be the first time that it is referenced by the PSR model. If the distributed storage device does not store a component resource identifier that matches the first component resource identifier, that is, does not store a component resource identifier that is identical to the first component resource identifier, then it indicates that the first component resource has not been referenced by the PSR model, that is, it means that the first component resource is referenced by the PSR model for the first time.
[0065] Specifically, after the server obtains the first component resource identifier, it can use the first component resource identifier to detect whether the preset distributed storage device stores a component resource identifier that matches the first component resource identifier. If a component resource identifier that matches the first component resource identifier is stored, it indicates that the first component resource is not referenced by the PSR model for the first time. If a component resource identifier that matches the first component resource identifier is not stored, it indicates that the first component resource is referenced by the PSR model for the first time.
[0066] In this embodiment, the reference relationship between the component resource and the PSR model can also be stored by storing the mapping relationship between the component resource identifier and the PSR model identifier in a distributed storage device, and it is also possible to determine whether the first component resource is referenced by the PSR model for the first time by detecting whether the first component resource identifier corresponding to the first component resource is stored in the distributed storage device. In this way, the efficiency of identifying whether the first component resource is referenced for the first time can be improved.
[0067] Furthermore, step S202 may further include: when the first component resource is not referenced by the PSR model for the first time, obtaining a PSR model identifier stored in a distributed storage device that has a mapping relationship with the first component resource identifier; when the PSR model identifier that has a mapping relationship with the first component resource identifier does not include a target PSR model identifier corresponding to the target PSR model, adding 1 to the first reference count stored in the reference counter as the updated first reference count stored in the reference counter.
[0068] Since the first number of references refers to the number of times the first component resource is referenced by each PSR model, and the same PSR model may reference the same component resource multiple times, in this case the reference counter has calculated the number of times the first component resource is referenced by the PSR model. Therefore, in this embodiment, the server only updates the first number of references stored in the reference counter when a PSR model references the first component resource for the first time.
[0069] Specifically, if the first component resource is not referenced by the PSR model for the first time, that is, a PSR model identifier that is mapped to the first component resource identifier is stored in the distributed storage device, then the server can first obtain the PSR model identifier, and determine whether the above-mentioned PSR model identifier already contains the PSR model identifier corresponding to the target PSR model, that is, the target PSR model identifier. If the target PSR model identifier is not included, the server can add 1 to the first reference count stored in the reference counter and store it as the updated first reference count to update the first reference count.
[0070] In this embodiment, the server can also determine whether the number of times the first component resource is referenced by the target PSR model has been stored in the reference counter through the PSR model identifier stored in the distributed storage device and mapped to the first component resource identifier. Only when the reference number is not stored, the first reference number is updated in the reference counter. In this way, the accuracy of the first reference number record can be further ensured.
[0071] In addition, after obtaining the PSR model identifier stored in the distributed storage device and having a mapping relationship with the first component resource identifier, it also includes: when the PSR model identifier that has a mapping relationship with the first component resource identifier includes the target PSR model identifier, stopping updating the first number of references stored in the reference counter.
[0072] Similarly, if the PSR model identifier to which the first component resource identifier has a mapping relationship already includes the target PSR model identifier, if the target PSR model identifier is not included, that is, the reference counter has already stored the number of times the first component resource is referenced by the target PSR model, then the server will stop updating the first number of references stored in the reference counter to ensure the accuracy of the stored first number of references.
[0073] In this embodiment, if the reference counter has stored the number of times the first component resource is referenced by the target PSR model, the server can stop updating the first reference number, thereby further ensuring the accuracy of the first reference number record.
[0074] In addition, the PSR model component resource processing method may also include: when there is no component resource identifier matching the first component resource identifier stored in the distributed storage device, creating a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device; when the PSR model identifier to which the first component resource identifier has a mapping relationship does not contain the target PSR model identifier corresponding to the target PSR model, creating a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device.
[0075] In this embodiment, in order to ensure that the mapping relationship between all component resource identifiers and PSR model identifiers can be stored in the distributed storage device, that is, to ensure that the reference relationship between all component resources and PSR models can be stored in the distributed storage device, when the first component resource is referenced by the target PSR model for the first time, it is necessary to create a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device.
[0076] And the first time the first component resource is referenced by the target PSR model can include two situations. The first is that the first component resource is not referenced by any PSR model, that is, when the distributed storage device does not store a component resource identifier that matches the first component resource identifier, a mapping relationship between the first component resource identifier and the target PSR model identifier is constructed. The other is that the first component resource has been referenced by other PSR models, but is referenced by the target PSR model for the first time, that is, when the PSR model identifier with which the first component resource identifier has a mapping relationship does not contain the target PSR model identifier corresponding to the target PSR model, a mapping relationship between the first component resource identifier and the target PSR model identifier is constructed.
[0077] Specifically, the distributed storage device may store the above mapping relationship in a key-value pair, i.e., a key-value pair, wherein the key is used to store the component resource identifier, and the value is used to store the PSR model identifier. After obtaining the first component resource identifier, the server may first detect whether there is a key identical to the first component resource identifier in the distributed storage device. If not, it indicates that the distributed storage device does not store a component resource identifier that matches the first component resource identifier. At this time, a key-value pair with the first component resource identifier as the key and the target PSR model identifier as the value may be added to the distributed storage device to realize the construction of the mapping relationship between the first component resource identifier and the target PSR model identifier.
[0078] If the key identical to the first component resource identifier exists in the distributed storage device, the server can query the value corresponding to the key identical to the first component resource identifier to determine whether the target PSR model identifier exists in the value. If not, it means that the PSR model identifier with which the first component resource identifier has a mapping relationship does not contain the target PSR model identifier corresponding to the target PSR model. At this time, a key-value pair with the first component resource identifier as the key and the target PSR model identifier as the value can also be added to the distributed storage device to realize the construction of the mapping relationship between the first component resource identifier and the target PSR model identifier. If the target PSR model identifier already exists in the value, stop adding the above key-value pair and stop updating the first reference count stored in the reference counter.
[0079] In this embodiment, when a component resource identifier matching the first component resource identifier is not stored in the distributed storage device, or when the PSR model identifier to which the first component resource identifier has a mapping relationship does not contain a target PSR model identifier corresponding to the target PSR model, a mapping relationship between the first component resource identifier and the target PSR model identifier can be created in the distributed storage device. In this way, it can be ensured that the mapping relationship between the first component resource identifier and the target PSR model identifier is created in the distributed storage device, further ensuring the integrity of the storage of the reference relationship between the component resource and the PSR model.
[0080] In one embodiment, after obtaining the second component resource associated with the unbinding request, it can also include: obtaining the second component resource identifier corresponding to the second component resource, and the target PSR model identifier corresponding to the target PSR model; deleting the mapping relationship between the second component resource identifier and the target PSR model identifier in the distributed storage device.
[0081] The second component resource identifier refers to the identification information used to uniquely identify the second component resource, for example, it can be the encoding information of the second component resource, and the target PSR model identifier is used to uniquely identify the identification information of the target PSR model, for example, it can be the model encoding of the target PSR model. Since the reference relationship between the target PSR model and the second component resource has been stored in the distributed storage device when the target PSR model is loaded, and the reference relationship has been untied at present, it is also necessary to synchronously delete the above reference relationship stored in the distributed storage device to ensure the accuracy of the information stored in the distributed storage device.
[0082] Specifically, after obtaining the second component resource associated with the unbinding request, the server can further obtain the second component resource identifier corresponding to the second component resource, and the target PSR model identifier corresponding to the target PSR model. After that, the mapping relationship between the second component resource identifier and the target PSR model identifier stored in the distributed storage device can be queried, and the mapping relationship can be deleted from the distributed storage device to ensure the accuracy of the information stored in the distributed storage device.
[0083] In this embodiment, after receiving the unbinding request and obtaining the second component resource, the server can further obtain the second component resource identifier corresponding to the second component resource and the target PSR model identifier corresponding to the target PSR model, thereby deleting the mapping relationship between the above-mentioned second component resource identifier and the target PSR model identifier stored in the distributed storage device. In this way, the accuracy of the information stored in the distributed storage device can be improved.
[0084] In one embodiment, updating the second reference count stored in the reference counter may further include: decrementing the second reference count stored in the reference counter by 1 as the updated second reference count stored in the reference counter; step S103 may further include: when the updated second reference count stored in the reference counter is zero, setting the second component resource to an unlocked state indicating that it can be edited.
[0085] In this embodiment, the second reference count can be updated by subtracting 1 from the second reference count originally stored in the reference counter, thereby obtaining and storing the updated second reference count. For example, before the second component resource is released from the target PSR model, the second reference count stored in the reference counter is 5. Then, after the second component resource is released from the reference relationship with the target PSR model, the second reference count of the second component resource will become 4, that is, the second reference count stored in the reference counter is subtracted by 1 as the updated second reference count.
[0086] Afterwards, if the updated second reference count stored in the reference counter is zero, it can represent that the second component resource is no longer referenced by any PSR model. In this case, the server can set the second component resource to an editable unlocked state.
[0087] In this embodiment, the process of updating the second number of references can be achieved by subtracting 1 from the second number of references stored in the reference counter, and when the second number of references stored in the reference counter is 0, it can be determined that the second component resource is no longer referenced by any PSR model, thereby setting the second component resource to an unlocked state that can be edited. In this way, the accuracy of unlocking the second component resource can be improved.
[0088] In addition, after step S103, the method may further include: when the updated second reference count indicates that the second component resource is still referenced by the PSR model, stopping setting the second component resource to an unlocked state indicating that it can be edited.
[0089] If the updated second reference count indicates that the second component resource is still referenced by some PSR models, for example, the second component resource is referenced by both PSR model 1 and PSR model 2, after the reference relationship between the component resource and PSR model 1 is released, since PSR model 2 still references the component resource, in order to ensure the stability of business loading of PSR model 2, in this case, the user is still not allowed to edit the second component resource. Therefore, it is still necessary to keep the second component resource locked, that is, stop setting the second component resource to the unlocked state indicating that it can be edited.
[0090] In this embodiment, if the updated second reference count still indicates that the second component resource is referenced by the PSR model, the server will continue to keep the second component resource in a locked state that cannot be edited, i.e., stop setting the second component resource to an unlocked state that indicates that it can be edited.
[0091] In one embodiment, a method for implementing PSR model component resource locking based on a reference counter is also provided, which can be applied to Figure 4 The PSR model shown includes a three-layer architecture, namely product-service-resource, wherein services may include network services and business services, multiple resources constitute a network service, one or more network services constitute a business service, and one or more businesses constitute a communication service / product.
[0092] In this embodiment, the PSR model can select different underlying component resources for assembly according to the functions to be implemented. When the PSR model design is successfully loaded online, a mapping relationship is established between the underlying component resources and the PSR model and saved in a distributed storage medium. At the same time, the component locking module will lock the currently referenced underlying component resources. The locked component resources cannot be modified and are in an uneditable state.
[0093] The same underlying component resource will be referenced by multiple PSR models at the same time. The reference counter module records the number of times the component resource is referenced and the detailed mapping relationship. The number of references is incremented or decremented according to the current mapping relationship of the component resource. When the characteristics of the PSR model change and the old component resource reference is unbound, the component unlocking module deletes the corresponding mapping relationship in the distributed storage medium and adjusts the number of references. When the number of references is greater than 0, the component resource is in a locked state and cannot be modified; when the number of references is equal to 0, the component resource is in an unlocked state, and the basic information, attributes, rule parameters and other data of the component resource can be modified on the client.
[0094] like Figure 5 As shown, the locking process can be implemented through the following modules:
[0095] Component Locking Module:
[0096] When designing a PSR model, choose to reference different underlying component resources according to the functions to be implemented by the current model. When the model design is successfully loaded online, the client sends a lock request to the component locking module on the server. After receiving the client's request, the locking module parses the underlying component resources referenced in the PSR model and extracts the unique identification information: component resource code (this coding information is used to distinguish different components and is guaranteed to be unique in the storage medium), and determines whether there is a key with the same name as the component resource code in the distributed storage medium. If not, create a mapping relationship between the component resource and the current PSR model in the distributed storage medium, and set the current number of references to: 1, flip the component resource to an uneditable state, and return the lock success information to the current client; if it exists, pass the current PSR model information, component resource information, etc. to the reference counter module.
[0097] Reference counter module:
[0098] Receive the PSR model information and component resource information transmitted by the component locking module. Retrieve the Value corresponding to the Key with the same name in the distributed storage device according to the component resource code, and determine whether the Value has the same value as the current PRS model code; if not, create a mapping relationship between the component resource and the current PSR model in the distributed storage medium, and at the same time, perform +1 operation on the current number of references, and return the reference success information to the client; if it exists, return the lock success information to the client.
[0099] like Figure 6 As shown, the unlocking process can be implemented through the following modules:
[0100] Component unlocking module:
[0101] When the characteristics of the PSR model change, unbind the old underlying component resources according to the functions that the new characteristics need to have. Retrieve the mapping relationship between the component resource and the currently selected PSR model in the distributed storage device and delete it, and at the same time, do a -1 operation on the current reference count. When the reference count is 0, the component resource is in an unlocked state, and the basic information, attributes, rule parameters and other data of the component resource can be modified on the client; when the reference count is greater than 0, the component resource is in a locked state and no operations can be performed.
[0102] In this embodiment, the concept of underlying component resource locking can be introduced into the traditional PSR model design, which can effectively improve the correctness, integrity, and availability of the upper-level PSR model. At the same time, compared with traditional distributed locks, the reference counter better records the interdependence and reference relationship between component resources and PSR models, and can play a better role in many-to-many relationship models. In addition, the component resource locking mode introduced in this embodiment can effectively prevent component resources from being modified at will, so that the PSR model can support multiple people online designing at the same time, greatly shortening the model design cycle and effectively improving the delivery rate.
[0103] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0104] Based on the same inventive concept, the embodiment of the present application also provides a PSR model component resource processing device for implementing the PSR model component resource processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more PSR model component resource processing device embodiments provided below can refer to the limitations of the PSR model component resource processing method above, and will not be repeated here.
[0105] In one embodiment, Figure 7 As shown, a PSR model component resource processing device is provided, including: a first resource acquisition module 701, a component resource locking module 702, a second resource unbinding module 703 and a component resource unlocking module 704, wherein:
[0106] The first resource acquisition module 701 is used to acquire the first component resource referenced by the target PSR model when the target PSR model is loaded;
[0107] A component resource locking module 702 is used to set the first component resource to a locked state indicating that the first component resource cannot be edited, and to update a first reference count of the first component resource by each PSR model;
[0108] The second resource unbinding module 703 is used to respond to the unbinding request initiated for releasing the component resource reference relationship initiated for the target PSR model, obtain the second component resource associated with the unbinding request, and update the second reference count of the second component resource referenced by each PSR model;
[0109] The component resource unlocking module 704 is configured to set the second component resource to an unlocked state indicating that the second component resource can be edited when the updated second reference count indicates that the second component resource has not been referenced.
[0110] In one embodiment, the first number of references and the second number of references are stored via a reference counter; the component resource locking module 702 is further used to set the first number of references to 1 and store it in the reference counter when the first component resource is referenced by the PSR model for the first time; when the first component resource is not referenced by the PSR model for the first time, the first number of references stored in the reference counter is updated; the second resource unbinding module 703 is further used to update the second number of references stored in the reference counter.
[0111] In one embodiment, the component resource locking module 702 is also used to obtain a first component resource identifier corresponding to a first component resource; detect whether a component resource identifier matching the first component resource identifier is stored in a preset distributed storage device; the distributed storage device is used to store a mapping relationship between the component resource identifier and the PSR model identifier, and the mapping relationship is used to characterize that the component resource corresponding to the component resource identifier is referenced by the PSR model corresponding to the PSR model identifier; when a component resource identifier matching the first component resource identifier is not stored in the distributed storage device, it is determined that the first component resource is referenced by the PSR model for the first time; when a component resource identifier matching the first component resource identifier is stored in the distributed storage device, it is determined that the first component resource is not referenced by the PSR model for the first time.
[0112] In one embodiment, the component resource locking module 702 is further used to obtain a PSR model identifier stored in a distributed storage device and having a mapping relationship with the first component resource identifier, when the first component resource is not referenced by the PSR model for the first time; and when the PSR model identifier having a mapping relationship with the first component resource identifier does not include a target PSR model identifier corresponding to the target PSR model, the first reference count stored in the reference counter is incremented by 1 as the updated first reference count stored in the reference counter.
[0113] In one embodiment, the component resource locking module 702 is further configured to stop updating the first reference count stored in the reference counter when the PSR model identifier to which the first component resource identifier has a mapping relationship includes the target PSR model identifier.
[0114] In one embodiment, the component resource locking module 702 is also used to create a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device when no component resource identifier matching the first component resource identifier is stored in the distributed storage device; and to create a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device when the PSR model identifier to which the first component resource identifier has a mapping relationship does not contain the target PSR model identifier corresponding to the target PSR model.
[0115] In one embodiment, the second resource unbinding module 703 is also used to obtain the second component resource identifier corresponding to the second component resource and the target PSR model identifier corresponding to the target PSR model; and delete the mapping relationship between the second component resource identifier and the target PSR model identifier in the distributed storage device.
[0116] In one embodiment, the second resource unbinding module 703 is further used to reduce the second reference count stored in the reference counter by 1 as the updated second reference count stored in the reference counter; the component resource unlocking module 704 is further used to set the second component resource to an unlocked state indicating that it can be edited when the updated second reference count stored in the reference counter is zero.
[0117] In one embodiment, the component resource unlocking module 704 is further configured to stop setting the second component resource to an unlocked state indicating that it can be edited, when the updated second reference count indicates that the second component resource is still referenced by the PSR model.
[0118] Each module in the above-mentioned PSR model component resource processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0119] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store component resource reference relationship data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a PSR model component resource processing method is implemented.
[0120] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0121] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0123] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0125] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0126] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0127] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A PSR model component resource processing method, characterized in that: The method comprises: When the target PSR model is loaded, obtaining a first component resource referenced by the target PSR model; Setting the first component resource to a locked state indicating that the resource cannot be edited, and updating a first reference count of the first component resource by each PSR model; In response to an unbinding request initiated for releasing a component resource reference relationship for the target PSR model, obtaining a second component resource associated with the unbinding request, and updating a second reference count of the second component resource being referenced by each PSR model; When the updated second reference count indicates that the second component resource has not been referenced, the second component resource is set to an unlocked state indicating that it can be edited.
2. The method according to claim 1, characterized in that: The first reference count and the second reference count are stored via a reference counter; The updating of the first reference count of the first component resource by each PSR model includes: When the first component resource is referenced by the PSR model for the first time, the first reference count is set to 1 and stored in the reference counter; If the first component resource is not referenced by the PSR model for the first time, updating the first reference count stored in the reference counter; The updating of the second reference count of the second component resource being referenced by each PSR model includes: The second reference count stored in the reference counter is updated.
3. The method according to claim 2, characterized in that Before updating the first reference count of the first component resource being referenced by each PSR model, the method further includes: Obtaining a first component resource identifier corresponding to the first component resource; Detecting whether a component resource identifier matching the first component resource identifier is stored in a preset distributed storage device; the distributed storage device is used to store a mapping relationship between the component resource identifier and the PSR model identifier, the mapping relationship being used to indicate that the component resource corresponding to the component resource identifier is referenced by the PSR model corresponding to the PSR model identifier; In a case where the distributed storage device does not store a component resource identifier matching the first component resource identifier, determining that the first component resource is referenced by the PSR model for the first time; In a case where a component resource identifier matching the first component resource identifier is stored in the distributed storage device, it is determined that the first component resource is not referenced by the PSR model for the first time.
4. The method according to claim 3, characterized in that When the first component resource is not referenced by the PSR model for the first time, updating the first reference count stored in the reference counter includes: When the first component resource is not referenced by the PSR model for the first time, obtaining a PSR model identifier stored in the distributed storage device and having a mapping relationship with the first component resource identifier; If the PSR model identifier to which the first component resource identifier has a mapping relationship does not include the target PSR model identifier corresponding to the target PSR model, the first reference count stored in the reference counter is incremented by 1 as the updated first reference count stored in the reference counter.
5. The method according to claim 4, characterized in that After obtaining the PSR model identifier stored in the distributed storage device and having a mapping relationship with the first component resource identifier, the method further includes: When the PSR model identifier to which the first component resource identifier has a mapping relationship includes the target PSR model identifier, updating of the first reference count stored in the reference counter is stopped.
6. The method according to claim 4, characterized in that The method further comprises: In a case where a component resource identifier matching the first component resource identifier is not stored in the distributed storage device, creating a mapping relationship between the first component resource identifier and the target PSR model identifier in the distributed storage device; When the PSR model identifier to which the first component resource identifier has a mapping relationship does not include the target PSR model identifier corresponding to the target PSR model, a mapping relationship between the first component resource identifier and the target PSR model identifier is created in the distributed storage device.
7. The method according to claim 3, characterized in that After obtaining the second component resource associated with the unbinding request, the method further includes: Obtaining a second component resource identifier corresponding to the second component resource and a target PSR model identifier corresponding to the target PSR model; The mapping relationship between the second component resource identifier and the target PSR model identifier is deleted in the distributed storage device.
8. The method according to claim 2, characterized in that: The updating of the second reference count stored in the reference counter comprises: Subtract 1 from the second reference count stored in the reference counter to obtain the updated second reference count stored in the reference counter; When the updated second reference count indicates that the second component resource has not been referenced, setting the second component resource to an unlocked state indicating that it can be edited includes: When the updated second reference count stored in the reference counter is zero, the second component resource is set to an unlocked state indicating that the resource can be edited.
9. The method according to claim 1, characterized in that: After the updating of the second reference count of the second component resource being referenced by each PSR model, the method further includes: When the updated second reference count indicates that the second component resource is still referenced by the PSR model, the second component resource is stopped from being set to an unlocked state indicating that it can be edited.
10. A PSR model component resource processing device, characterized in that: The device comprises: A first resource acquisition module, used for acquiring a first component resource referenced by the target PSR model when the target PSR model is loaded; A component resource locking module, used to set the first component resource to a locked state indicating that it cannot be edited, and update a first reference count of the first component resource by each PSR model; A second resource unbinding module is used to respond to an unbinding request initiated for releasing a component resource reference relationship for the target PSR model, obtain a second component resource associated with the unbinding request, and update a second reference count of the second component resource being referenced by each PSR model; The component resource unlocking module is used to set the second component resource to an unlocked state indicating that it can be edited when the updated second reference count indicates that the second component resource has not been referenced.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
