CN-121996351-A - Virtual resource amount management method and device, electronic equipment and storage medium
Abstract
The invention discloses a virtual resource unit management method, a device, electronic equipment and a storage medium, which relate to the technical field of blockchain and are used for solving the problem of poor flexibility of a virtual resource unit management mode. The method comprises the steps of obtaining a first target queue under the condition that a data sharing party uploads first data, wherein the first target queue comprises at least one element, the element is used for storing a first-use credit value, the first-use credit value is determined based on virtual resource credits consumed when the data sharing party downloads the data, the first target queue is updated based on a later-supplement credit value to obtain a second target queue, and the later-supplement credit value is the virtual resource credit obtained by uploading the first data to the data sharing party. The embodiment of the invention can improve the flexibility of virtual resource limit management.
Inventors
- NIU DONG
Assignees
- 中移动金融科技有限公司
- 中国移动通信集团有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260104
Claims (10)
- 1. The virtual resource amount management method is characterized by comprising the following steps: Under the condition that a data sharing party uploads first data, a first target queue is obtained, the first target queue comprises at least one element, the element is used for storing a first-use credit value, and the first-use credit value is determined based on a virtual resource credit consumed when the data sharing party downloads the data; And updating the first target queue based on a post-supplement credit value to obtain a second target queue, wherein the second pre-supplement credit value is the difference between the first pre-supplement credit value and the post-supplement credit value when the post-supplement credit value is smaller than or equal to the first pre-supplement credit value, the second pre-supplement credit value is 0 when the post-supplement credit value is larger than the first pre-supplement credit value, the first pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the first target queue, and the second pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the second target queue, and the post-supplement credit value is the virtual resource credit obtained by uploading the first data by the data sharing party.
- 2. The method of claim 1, wherein updating the first target queue based on the post-credit value to obtain a second target queue comprises: Performing at least one iterative updating operation on the first target queue and the post-compensation value unit until the updated first target queue is empty or the updated post-compensation value unit is 0; and determining the updated first target queue as the second target queue.
- 3. The method of claim 2, wherein the iterative updating operation comprises: Acquiring a first element from the first target queue, wherein the first element comprises a first pre-use credit value, and the first pre-use credit value is determined based on a virtual resource credit consumed by the data sharing party when downloading second data; Removing the first element from the first target queue and subtracting the first pre-use credit from the current post-credit value to obtain an updated post-credit value when the current post-credit value is greater than or equal to the first pre-use credit value; And under the condition that the current post-supplement credit value is smaller than the first pre-use credit value, subtracting the current post-supplement credit value from the current first pre-use credit value to obtain the updated first pre-use credit value, and determining the updated post-supplement credit value as 0.
- 4. The method of claim 3, wherein the first target queue has a length K, the first target queue includes M elements, K is a positive integer, M is an integer less than or equal to K, and the first element is an element with a minimum corresponding priority value among the M elements.
- 5. A method according to claim 3, wherein, in the case of uploading the first data by the data sharing party, before the first target queue is acquired, the method further comprises: acquiring a third target queue under the condition that the data sharing party requests the second data, wherein the third target queue comprises N elements, and N is an integer less than or equal to K; Judging whether N is smaller than K or not under the condition that the third target queue is not empty; creating the first element based on a first pre-use credit value, wherein the first pre-use credit value is a virtual resource credit consumed by downloading the second data; and adding the first element to the third target queue to obtain the first target queue.
- 6. The method of claim 5, wherein, in the case where N is less than K, before creating the first element based on the first pre-use credit value, the method further comprises: Acquiring at least one second element from the N elements under the condition that N is equal to K, wherein the second element comprises a second first-use credit value; Adding a current third first-use credit value with the second first-use credit value to obtain an updated third first-use credit value, wherein the third first-use credit value is a first-use credit value included in the third element, and the third element is an element except the second element in the N elements; The second element is removed from the third target queue.
- 7. The method of claim 5, wherein, in the case where the second data is requested by the data sharing party, before the third target queue is acquired, the method further comprises: Determining a credit value of the data sharing party based on the data downloading amount of the data sharing party in a preset period and the data uploading amount of the data sharing party in the preset period; and under the condition that the credit value is larger than a credit threshold value, constructing the third target queue corresponding to the data sharing party.
- 8. A virtual resource line management apparatus, comprising: The first acquisition module is used for acquiring a first target queue under the condition that a data sharing party uploads first data, wherein the first target queue comprises at least one element, the element is used for storing a first-use credit value, and the first-use credit value is determined based on a virtual resource credit consumed when the data sharing party downloads the data; And the updating module is used for updating the first target queue based on a post-supplement credit value to obtain a second target queue, wherein the second pre-supplement credit value is the difference value between the first pre-supplement credit value and the post-supplement credit value when the post-supplement credit value is smaller than or equal to the first pre-supplement credit value, the second pre-supplement credit value is 0 when the post-supplement credit value is larger than the first pre-supplement credit value, the first pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the first target queue, the second pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the second target queue, and the post-supplement credit value is the virtual resource credit obtained by uploading the first data by the data sharing party.
- 9. An electronic device comprising a memory, a processor and a program stored on the memory and executable on the processor, characterized in that, The processor is configured to read a program in a memory to implement the steps in the virtual resource unit management method according to any one of claims 1 to 7.
- 10. A readable storage medium storing a program, wherein the program, when executed by a processor, implements the steps in the virtual resource amount management method as defined in any one of claims 1 to 7.
Description
Virtual resource amount management method and device, electronic equipment and storage medium Technical Field The present invention relates to the field of blockchain technologies, and in particular, to a virtual resource unit management method, device, electronic apparatus, and storage medium. Background In the process of sharing the data of the blockchain, the blockchain members acquire corresponding virtual resource units through uploading the data, and the corresponding virtual resource units are required to be consumed when the data is downloaded. To ensure fairness of data sharing, the prior art is generally an incentive-based data sharing scheme, in which the amount of virtual resources available to a data sharing party is strictly limited to be greater than or equal to the amount of virtual resources to be consumed by the data to be downloaded by the data sharing party, otherwise, the corresponding data cannot be downloaded. The incentive-based data sharing scheme keeps real-time fairness of data sharing, but hinders realization of data sharing to a certain extent, because the virtual resource availability of a requester continues to increase along with subsequent data uploading, but the current virtual resource amount management mode only determines the available virtual resource amount according to the current data uploading amount and downloading amount, so that the management mode of the virtual resource amount is poor in flexibility, and the flexibility of the data sharing scheme is poor. Disclosure of Invention The embodiment of the invention provides a virtual resource unit management method, a device, electronic equipment and a storage medium, which are used for solving the problem of poor flexibility of a virtual resource unit management mode. In order to solve the technical problems, the application is realized as follows: In a first aspect, an embodiment of the present application provides a method for managing a virtual resource unit, including: Under the condition that a data sharing party uploads first data, a first target queue is obtained, the first target queue comprises at least one element, the element is used for storing a first-use credit value, and the first-use credit value is determined based on a virtual resource credit consumed when the data sharing party downloads the data; And updating the first target queue based on a post-supplement credit value to obtain a second target queue, wherein the second pre-supplement credit value is the difference between the first pre-supplement credit value and the post-supplement credit value when the post-supplement credit value is smaller than or equal to the first pre-supplement credit value, the second pre-supplement credit value is 0 when the post-supplement credit value is larger than the first pre-supplement credit value, the first pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the first target queue, and the second pre-supplement credit value is the sum of the pre-supplement credit values of all elements in the second target queue, and the post-supplement credit value is the virtual resource credit obtained by uploading the first data by the data sharing party. Optionally, the updating the first target queue based on the post-supplement amount value to obtain a second target queue includes: Performing at least one iterative updating operation on the first target queue and the post-compensation value unit until the updated first target queue is empty or the updated post-compensation value unit is 0; and determining the updated first target queue as the second target queue. Optionally, the iterative updating operation includes: Acquiring a first element from the first target queue, wherein the first element comprises a first pre-use credit value, and the first pre-use credit value is determined based on a virtual resource credit consumed by the data sharing party when downloading second data; Removing the first element from the first target queue and subtracting the first pre-use credit from the current post-credit value to obtain an updated post-credit value when the current post-credit value is greater than or equal to the first pre-use credit value; And under the condition that the current post-supplement credit value is smaller than the first pre-use credit value, subtracting the current post-supplement credit value from the current first pre-use credit value to obtain the updated first pre-use credit value, and determining the updated post-supplement credit value as 0. Optionally, the length of the first target queue is K, the first target queue includes M elements, K is a positive integer, M is an integer less than or equal to K, and the first element is an element with the smallest corresponding priority value unit value among the M elements. Optionally, before the first target queue is acquired in the case that the data sharing party uploads the first data, the method further inc