Resource data processing method and device, storage medium and electronic equipment

By setting only one first storage area for storing resource data in the solid state memory and performing erasing processing when the to-stored area is the same as the stored area, the problem of excessive erasing frequency of solid state memory is solved, and the write performance and capacity utilization of SSD are improved.

CN119847450AActive Publication Date: 2025-04-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202510314486.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-04-18
Estimated Expiration
2045-03-17

AI Technical Summary

Technical Problem

The erase frequency of solid-state memory is too high, resulting in the impact of write performance.

Method used

Only one first storage area for storing resource data is provided in the solid state memory, and an erase process is performed when the to-stored area is the same as the already-stored area to be stored to reduce the number of unnecessary erases.

Benefits of technology

It effectively reduces the number of erases of solid-state memory and improves the write performance and capacity utilization of SSD.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847450A_ABST
    Figure CN119847450A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource data processing method and device, a storage medium and electronic equipment, relates to the field of computers, is applied to a solid-state memory, and only sets a first storage area for storing resource data in the solid-state memory, and comprises the following steps: receiving a resource transfer request carrying to-be-stored resource data, wherein the resource transfer request is used for storing to-be-stored resource data to a first storage area; in response to the resource transfer request, determining a to-be-stored area of the first storage area; the to-be-stored area is an area where to-be-stored resource data is to be stored in the first storage area; under the condition that the to-be-stored area of the first storage area is the same as the set stored area, erasing the first storage area; the stored area is an area in which resource data is stored in the first storage area; and storing the to-be-stored resource data to the erased first storage area. And the performance of the solid-state memory is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the computer field, and specifically, to a method and device for processing resource data, a storage medium, and an electronic device. Background Art

[0002] In the field of storage systems, solid-state storage (SSD) is a storage device that uses semiconductor flash memory as the core storage medium and has been widely used in recent years. It is different from traditional mechanical hard disks (HHD) in terms of performance, power consumption, and reliability. From the perspective of flash memory operation characteristics, the difference between SSD and HHD lies mainly in the processing of write operations. SSD cannot perform overwrite operations on any physical address like HHD, and can only erase the entire block of data in units of blocks.

[0003] In order to allow SSD to support read and write operations at any location, a garbage collection mechanism is introduced in the relevant technology. When a user wants to overwrite data at a written location in the SSD, the internal software control layer of the SSD maps the location to a new physical address to provide it for the user to write, and marks the original address as garbage data. When the amount of garbage data in the entire block of data reaches a certain threshold, the garbage collection process is started, and the valid data in the block of data is moved to other unused locations, and then the entire block of data is erased, and the entire block of physical addresses is re-marked as unused locations for subsequent use, and the recycling is completed. Obviously, the proportion of garbage data in the entire block of data directly determines the capacity loss of the SSD, and too frequent garbage collection processing will cause losses to the operating performance of the SSD.

[0004] Therefore, the high erasing frequency of current solid-state memories, which seriously affects the performance of solid-state memories, has become a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present application provide a method and device for processing resource data, a storage medium, and an electronic device, so as to at least solve the problem that the erasing frequency of the solid-state memory is too high, which affects the writing performance of the solid-state memory.

[0006] According to one embodiment of the present application, a method for processing resource data is provided, which is applied to a solid-state memory, in which only one first storage area for storing resource data is set in the solid-state memory, comprising: receiving a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area; in response to the resource transfer request, determining a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the resource data to be stored is to be stored in the first storage area; in a case where the to-be-stored area of ​​the first storage area is the same as a set stored area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored; and storing the resource data to be stored in the first storage area after the erasure process.

[0007] In an exemplary embodiment, the area to be stored is determined by a first pointer parameter recorded for the first storage area; the stored area is determined by a second pointer parameter recorded for the first storage area; the first pointer parameter is used to record the storage position of the resource data to be stored in the first storage area; the second pointer parameter is used to record the storage position of the oldest resource data among the resource data stored in the first storage area; when the area to be stored in the first storage area is the same as the set stored area, erasing the first storage area includes: when the first pointer parameter is equal to the second pointer parameter, erasing the first storage area.

[0008] In an exemplary embodiment, a second storage area for storing at least resource status parameters associated with resource data stored in the first storage area is also provided in the solid-state memory; the erasing process of the first storage area includes: determining the data to be erased in the first storage area; updating the resource status parameters in the second storage area according to the data to be erased, and writing the updated resource status parameters into the second storage area; when writing the updated resource status parameters into the second storage area, erasing the first storage area based on the determined data to be erased.

[0009] In an exemplary embodiment, after writing the updated resource status parameters into the second storage area, it also includes: updating the record pointer associated with the second storage area; when the record pointer associated with the second storage area reaches a preset first record pointer threshold, erasing the second storage area.

[0010] In an exemplary embodiment, before erasing the second storage area, the method also includes: determining the storage capacity of the second storage area and the single data length of the second storage area; the single data length is the maximum data length set to be written to the second storage area at one time; and determining the first record pointer threshold based on the quotient of the storage capacity and the single data length.

[0011] In an exemplary embodiment, the method further includes: when the to-be-stored area of ​​the first storage area is different from the set stored area, directly writing the to-be-stored resource data into the to-be-stored area of ​​the first storage area.

[0012] In an exemplary embodiment, the solid-state memory is also provided with a third storage area for storing a first pointer parameter and a second pointer parameter; the method further includes: obtaining a power-off instruction; wherein the power-off instruction is an instruction generated by the solid-state memory when it enters a stop working state; based on the power-off instruction, determining the storage location of the resource data in the first storage area, and updating the first pointer parameter and the second pointer parameter in the third storage area according to the storage location.

[0013] In an exemplary embodiment, after updating the first pointer parameter and the second pointer parameter in the third storage area, it also includes: updating the record pointer associated with the third storage area; when the record pointer associated with the third storage area reaches a preset second record pointer threshold, erasing the third storage area.

[0014] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, it also includes at least one of the following: clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; resetting a first pointer parameter, a second pointer parameter, a record pointer associated with the second storage area, and a record pointer associated with the third storage area recorded in the first storage area; writing an empty record in the first storage area; initializing resource status parameters in the second storage area;

[0015] In an exemplary embodiment, the method further includes: responding to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; based on the resource query request, determining a query result matching the resource query request.

[0016] In an exemplary embodiment, determining the query result that matches the resource query request based on the resource query request includes: when the resource query request includes the resource change query request, based on the resource change query request, determining the resource first change record that matches the resource change query request from the resource status parameters stored in the second storage area; determining the address of the resource first change record; according to the address, determining the query result corresponding to the resource change query request; when the resource query request includes a resource storage query request, directly determining the resource storage parameters from the memory corresponding to the solid-state storage.

[0017] In an exemplary embodiment, before determining the area to be stored in the first storage area in response to the resource transfer request, it also includes: storing the resource data to be stored in a cache; wherein the cache is a buffer area set for the solid-state memory; when it is determined that the amount of resource data in the cache reaches a set quantity threshold, determining the area to be stored in the first storage area in response to the resource transfer request.

[0018] According to another embodiment of the embodiment of the present application, a resource data processing device is also provided, including: a receiving module, used to receive a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area; a determining module, used to determine the to-be-stored area of ​​the first storage area in response to the resource transfer request; the to-be-stored area is the area where the resource data to be stored is to be stored in the first storage area; an erasing module, used to erase the first storage area when the to-be-stored area of ​​the first storage area is the same as the set stored area; the stored area is the area in the first storage area where resource data has been stored; a storage module, used to store the resource data to be stored in the first storage area after the erasure processing.

[0019] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0020] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0021] According to another embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0022] Through the present application, a resource transfer request carrying resource data to be stored is received, wherein the resource transfer request is used to store the resource data to be stored in a first storage area, wherein the first storage area is a storage area for storing resource data that is only set in the solid-state memory; in response to the resource transfer request, the to-be-stored area of ​​the first storage area is determined; the to-be-stored area is the area where the resource data to be stored is to be stored in the first storage area; the first storage area will be erased only when the to-be-stored area of ​​the first storage area is the same as the set stored area, the stored area is the area in the first storage area where resource data has been stored, and the resource data to be stored is stored in the first storage area after the erasure process. In other words, the present application will only start erasing when it is determined that the area to be stored in the first storage area is the same as the set area where resource data has been stored. Compared with the erasing method based on the garbage collection mechanism in the traditional technology, it effectively reduces the number of erasures and improves the performance of the SSD. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0024] Figure 1 It is a hardware structure block diagram of a server device of a resource data processing method according to an embodiment of the present application;

[0025] Figure 2 is a flow chart of a method for processing resource data according to an embodiment of the present application;

[0026] Figure 3 It is a schematic diagram of the state change of the blockchain in the related technology;

[0027] Figure 4 is a schematic diagram of a storage example of a first storage area according to an embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a link structure of a linked list according to an embodiment of the present application;

[0029] Figure 6 It is a structural block diagram of a resource data processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0032] The resource data processing method embodiment provided in the embodiment of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a resource data processing method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0033] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the processing methods of resource data in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, the above-mentioned method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory, wherein only one first storage area for storing resource data is set in the solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0034] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0035] In order to solve the above problems existing in the related art, a method for processing resource data is provided in this embodiment, which is applied to a solid-state memory. Only a first storage area for storing resource data is set in the solid-state memory. The execution subject includes but is not limited to an SSD controller of the solid-state memory. The solid-state memory and the SSD controller can be deployed in Figure 1 In the server device shown, Figure 2 As shown, the process includes the following steps S202-S210:

[0036] Step S202: receiving a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area;

[0037] The resource data may include information about the resource transferor, information about the resource transferee, and resource amount, a pointer to the next record of the resource transfer-out linked list, and a pointer to the next record of the resource transfer-in linked list. The resource transfer-out linked list is used to record the transfer-out status of the user's resource data, and the resource transfer-in linked list is used to record the receipt status of the user's resource data. For each user, a resource transfer-out linked list and a resource transfer-in linked list may be set. When there is a resource transfer request, the resource transfer-out linked list and the resource transfer-in linked list will be updated, and the pointer to the next record of the resource transfer-out linked list and the pointer to the next record of the resource transfer-in linked list will be recorded.

[0038] In some embodiments, when there is a resource transfer request, if the resource transfer request is a request for transferring resource data, the resource transfer-out linked list of the resource transferor is updated accordingly, and the next record pointer of the resource transfer-out linked list is recorded; at the same time, for the resource transfer request, in addition to the resource transferor, there will also be a resource receiver, so it is also necessary to update the resource receiver's resource receiving linked list accordingly, and record the next record pointer of the resource receiving linked list. By recording the next record pointer, when querying the resource transfer record later, it can be queried in the order of resource transfer according to the recorded next record pointer.

[0039] In some embodiments, the area capacity of the first storage area can be pre-set. It is understandable that when the first storage area is full of resource data, or the resource data stored in the first storage area has occupied a preset proportion of the area capacity, for example, it has occupied eighty percent of the area capacity, then the first storage area can be erased. When specifically setting the area capacity of the first storage area, various influencing factors can be considered, such as the data length of the resource data to be stored at a time. Since the information included in the resource data is consistent, such as including the information of the resource transferor, the information of the resource transferor, and the resource amount, the next record pointer of the resource transfer list, and the next record pointer of the resource transfer list, the data length of the resource data to be stored at a time can also be set to a fixed value, that is, the data length of the resource data stored each time is consistent by default. In addition to the data length of the resource data to be stored, it is also necessary to consider the total number of users with resource transfer business needs, the maximum resource quota of each user, etc., which are not limited in the embodiments of the present application.

[0040] In some embodiments, the first storage area is used to store all resource data, and the resource data may specifically refer to a transfer record. When the resource data is a transfer record, each resource data to be stored may include the following data: transfer-out account number; transfer-in account number; transfer amount; pointer to the next record of the resource transfer-out linked list; pointer to the next record of the resource receiving linked list. The length of each resource data is lr, and lr at least satisfies: lr ≥ α + 2β +2γ.

[0041] Among them, α refers to the number of bytes occupied by each transfer amount; β refers to the number of bytes occupied by each account number (including the transfer-out account number and the transfer-in account number); γ refers to the number of bytes occupied by the next record pointer. The area capacity of the first storage area can be defined as: n1:=r*lr, where r is the number of transfer records determined based on the number of users and the account user limit, and ":=" is a symbol indicating the meaning of the definition. Set lr|Cb (Cb can divide lr, Cb is the erase unit, and the size of Cb is determined by the hardware properties of the SSD itself); , where rb represents the number of transfer records contained in each erase block. And set rb|r (which means r can divide rb); , where rc represents the number of erase blocks contained in the entire first storage area.

[0042] In some embodiments, it can be set as follows: α = 8; β = 2; γ = 4; Cb = 20MB = 20× 2 20 ; Then lr = 20, m = 264, n = 216, r = 232, which just satisfies lr|Cb, so rb = 220 , which also satisfies rb|r, so rc =2 12 The calculated capacity of the first storage area is: n1 = 80 GB.

[0043] Step S204: In response to the resource transfer request, determine a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area.

[0044] It is understandable that, based on the fact that the area capacity of the first storage area is already determined, how much resource data can be stored in the first storage area can also be determined. In the first storage area, the first storage area can be divided into multiple storage areas according to the area capacity and the data length of the pre-calculated resource data.

[0045] The area to be stored is the area determined to store the resource data in the first storage area, that is, the location where the data to be stored is to be written. When determining the area to be stored, it can be determined based on the first pointer parameter of the first storage area.

[0046] It is understandable that the first pointer parameter can be represented by numbers, letters, and feature codes, etc. The first pointer parameter can correspond to a storage area in the first storage area. For example, the first storage area includes a total of 12 storage areas. When the first pointer parameter is represented by numbers, the pointer parameters are 0, 1, 2...11, respectively, where 0 can correspond to the first storage area and 11 can correspond to the twelfth storage area. When writing the resource data to be stored into the first storage area, it can be written in sequence, for example, first writing the resource data to be stored into the first storage area, then writing the resource data to be stored into the second storage area... and so on, until writing into the twelfth storage area, which indicates that the first storage area has been filled.

[0047] It should be noted that before storing the resource data to be stored in the first storage area, it is necessary to determine the first pointer parameter and determine the storage area according to the first pointer parameter. If the determined first pointer parameter is 0, it can indicate that the storage area is the first storage area.

[0048] Optionally, each storage area can store multiple resource data. The specific amount of resource data that can be stored can be determined by the area capacity of the storage area, the data length of the resource data, etc.

[0049] Step S206: When the to-be-stored area of ​​the first storage area is the same as the set stored area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored.

[0050] The stored area is an area in the determined first storage area where resource data has been stored. When determining the stored area, it can be determined based on the second pointer parameter recorded for the first storage area.

[0051] It is understandable that the second pointer parameter may be represented by numbers, letters, and feature codes, etc. The second pointer parameter may correspond to a storage area in the first storage area.

[0052] Optionally, the second pointer parameter may correspond to the storage area in the first storage area where the resource data is first stored, that is, the second pointer parameter points to the oldest storage area, which may be understood as the location where the resource data is first written in the first storage area.

[0053] In an exemplary embodiment, the area to be stored is determined by a first pointer parameter recorded for the first storage area; the stored area is determined by a second pointer parameter recorded for the first storage area; the first pointer parameter is used to record the storage position of the resource data to be stored in the first storage area; the second pointer parameter is used to record the storage position of the oldest resource data among the resource data stored in the first storage area; when the area to be stored in the first storage area is the same as the set stored area, erasing the first storage area includes: when the first pointer parameter is equal to the second pointer parameter, erasing the first storage area.

[0054] The oldest resource data may be understood as the resource data first written into the first storage area. As the erasing process is completed, the second pointer parameter will change, and the oldest resource data will also change.

[0055] Specifically, the first pointer parameter is used to characterize the storage area that will be used to store the resource data to be stored, and the second pointer parameter is used to characterize the storage area of ​​the oldest resource data in the first storage area, that is, it points to the oldest stored area in the first storage area. When the first pointer parameter is equal to the second pointer parameter, it indicates that the storage space of the first storage area is full, that is, when the area to be stored in the first storage area is the same as the oldest stored area pointed to by the second pointer parameter, it is necessary to erase the resource data already stored in the first storage area so that the resource data to be stored can be written into the first storage area.

[0056] In the above embodiment, when determining whether the first storage area needs to be erased, it is only necessary to obtain the first pointer parameter and the second pointer parameter. By comparing the first pointer parameter and the second pointer parameter, if the first pointer parameter and the second pointer parameter are the same, the first storage area can be erased, thereby improving the processing efficiency of resource data.

[0057] In an exemplary embodiment, a second storage area for storing at least resource status parameters associated with resource data stored in the first storage area is also provided in the solid-state memory; the erasing process of the first storage area includes: determining the data to be erased in the first storage area; updating the resource status parameters in the second storage area according to the data to be erased, and writing the updated resource status parameters into the second storage area; when writing the updated resource status parameters into the second storage area, erasing the first storage area based on the determined data to be erased.

[0058] The resource status parameters may include the first resource transfer record of each resource account, i.e., the initialization record, and the initial resource amount of each resource account, etc., wherein the resource account may initiate a resource transfer operation as a resource transferor, or may receive a resource transfer as a resource receiver. Before the data to be erased is erased, the initial resource amount of the resource account related to the data to be erased, the first resource transfer record, etc. may be updated accordingly.

[0059] In some embodiments, in addition to storing resource status parameters, the second storage area may also store the following system control parameters, which may be constants set based on the hardware performance of the SSD, such as the number of bytes occupied by the resource amount of each resource transferor, the number of bytes occupied by the account number of each resource transferor and resource recipient, the number of bytes occupied by the transfer record number, etc.

[0060] It is understandable that after determining the data to be erased, the resource status parameters in the second storage area are updated according to the data to be erased, so that even if the data to be erased is erased later, its resource status parameters are updated, ensuring the accuracy of the subsequent resource query process.

[0061] In the above embodiment, after the data to be erased is determined, the resource status parameters in the second storage area are also updated based on the data to be erased, thereby avoiding errors such as resource amount due to data erasure processing and effectively improving the processing accuracy of resource data.

[0062] In an exemplary embodiment, determining the data to be erased in the first storage area includes: determining the length of the data to be erased based on the properties of the solid-state memory; and determining the data to be erased of the data length from the first storage area according to the storage time of the resource data stored in the first storage area.

[0063] Specifically, the attribute of the solid-state memory refers to the hardware performance of the solid-state memory, and the data length of the resource data that can be deleted at one time is determined by the hardware performance of the solid-state memory.

[0064] In the above embodiment, the data length of the data that can be erased each time the erasure process is performed is determined by the hardware performance of the solid-state memory, and the data length of the data to be erased each time is further determined, thereby effectively improving the data erasure efficiency.

[0065] In an exemplary embodiment, after writing the updated resource status parameters into the second storage area, it also includes: updating a record pointer associated with the second storage area; and erasing the second storage area when the record pointer associated with the second storage area reaches a preset first record pointer threshold.

[0066] The record pointer associated with the second storage area is used to record the number of times the resource status parameter is updated, and each time the updated resource status parameter is written into the second storage area, the record pointer will be updated accordingly. For example, the record pointer associated with the second storage area can be represented by a number, and the initial value of the record pointer associated with the second storage area can be set to 0. After each new resource status parameter is written, the record pointer associated with the second storage area will be increased by 1.

[0067] The first pointer record threshold is a threshold set to determine whether the second storage area is full. After the updated record pointer associated with the second storage area reaches the first record pointer threshold, the second storage area can be erased.

[0068] In the above embodiment, by updating the record pointer associated with the second storage area, when the record pointer reaches the first record pointer threshold, it can be determined that the second storage area is full, and the second storage can be erased in time, thereby improving the processing efficiency and accuracy of resource data.

[0069] Specifically, when determining the first pointer record threshold, it may be determined according to the storage capacity of the second storage area.

[0070] In an exemplary embodiment, before erasing the second storage area, the method further includes: determining the storage capacity of the second storage area and the single data length of the second storage area; the single data length is the maximum data length set to be written to the second storage area at one time; and determining the first record pointer threshold based on the quotient of the storage capacity and the single data length.

[0071] Specifically, the storage capacity of the second storage area can be set to the size of an erase unit, and the erase unit can be the smallest erase unit set according to the performance of the SSD. Relatively speaking, the storage capacity of the second storage area is smaller than that of the first storage area. The quotient obtained by dividing the storage capacity of the second storage area by the single data length is determined as the first record pointer threshold.

[0072] Step S208: storing the resource data to be stored in the first storage area after the erasure process.

[0073] In an exemplary embodiment, storing the resource data to be stored in the first storage area after erasure includes: determining a new area to be stored from the first storage area after erasure; and writing the resource data to be stored into the new area to be stored in the first storage area.

[0074] In an exemplary embodiment, the method further includes: when the to-be-stored area of ​​the first storage area is different from the set stored area, directly writing the to-be-stored resource data into the to-be-stored area of ​​the first storage area.

[0075] In the above steps S202-S208, a resource transfer request carrying resource data to be stored is received, wherein the resource transfer request is used to store the resource data to be stored in the first storage area, wherein the first storage area is a storage area for storing resource data that is only set in the solid-state memory; in response to the resource transfer request, the to-be-stored area of ​​the first storage area is determined; the to-be-stored area is the area where the resource data to be stored is to be stored in the first storage area; only when the to-be-stored area of ​​the first storage area is the same as the set stored area, the first storage area will be erased, the stored area is the area in the first storage area where resource data has been stored, and the resource data to be stored is stored in the first storage area after the erasure process. That is, the present application will erase the first storage area only when the to-be-stored area of ​​the first storage area is the same as the set stored area, that is, only when it is determined that the area to be stored in the first storage area is the same as the set area where resource data has been stored, will the erasure be carried out. Compared with the erasure method based on the garbage collection mechanism in the traditional technology, the number of erasures is effectively reduced and the performance of the SSD is improved.

[0076] In an exemplary embodiment, the solid-state memory is also provided with a third storage area for storing a first pointer parameter and a second pointer parameter; the method further includes: obtaining a power-off instruction; wherein the power-off instruction is an instruction generated by the solid-state memory when it enters a stop working state; based on the power-off instruction, determining the storage location of the resource data in the first storage area, and updating the first pointer parameter and the second pointer parameter in the third storage area according to the storage location.

[0077] It is understandable that the solid-state memory may enter the stopped working state when the solid-state memory enters sleep mode normally or when receiving a shutdown operation. Of course, the solid-state memory may also enter the stopped working state when an abnormal power failure occurs to the solid-state memory. Regardless of the reason for the solid-state memory to enter the stopped working state, the storage location of the resource data in the first storage area is determined, and the first pointer parameter and the second pointer parameter in the third storage area are updated according to the storage location.

[0078] In the above embodiment, by updating the first pointer parameter and the second pointer parameter when power is turned off, when the solid-state memory works normally later, the storage of resource data can be expanded based on the recorded first pointer parameter and the second pointer parameter, thereby improving storage efficiency.

[0079] In an exemplary embodiment, after updating the first pointer parameter and the second pointer parameter in the third storage area, it also includes: updating the record pointer associated with the third storage area; when the record pointer associated with the third storage area reaches a preset second record pointer threshold, erasing the third storage area.

[0080] The second record pointer is used to record the number of times the first pointer parameter and the second pointer parameter are updated. After each time the updated first pointer parameter and the second pointer parameter are written into the third storage area, the record pointer associated with the third storage area will also be updated accordingly. For example, a number can be used to represent the record pointer associated with the third storage area. The initial value of the record pointer associated with the third storage area can be set to 0. After each new resource status parameter is written, the record pointer associated with the third storage area will be increased by 1.

[0081] The second pointer record threshold is a threshold set to determine whether the third storage area is full. After the updated record pointer associated with the third storage area reaches the second record pointer threshold, the second storage area can be erased.

[0082] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, it also includes at least one of the following: clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; resetting the first pointer parameter, the second pointer parameter, the record pointer associated with the second storage area, and the record pointer associated with the third storage area recorded in the first storage area; writing an empty record in the first storage area; initializing the resource status parameters in the second storage area.

[0083] In the above embodiment, before receiving a resource transfer request carrying resource data to be stored, the memory variables of the solid-state storage device can be initialized. Through the initialization process, the normal operation of the subsequent solid-state storage device can be ensured and the processing accuracy of the resource data can be improved.

[0084] In an exemplary embodiment, the method further includes: responding to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; based on the resource query request, determining a query result matching the resource query request.

[0085] It is understandable that, for the solid-state memory, in addition to the request to write resource data into the solid-state memory, a resource query request may also be issued to the solid-state memory. The resource query request may include at least one of a resource change query request and a resource storage query request.

[0086] In an exemplary embodiment, determining the query result that matches the resource query request based on the resource query request includes: when the resource query request includes the resource change query request, based on the resource change query request, determining the resource first change record that matches the resource change query request from the resource status parameters stored in the second storage area; determining the address of the resource first change record; according to the address, determining the query result corresponding to the resource change query request; when the resource query request includes a resource storage query request, directly determining the resource storage parameters from the memory corresponding to the solid-state storage.

[0087] It should be noted that the resource change query request may include a request generated when a resource is transferred out or transferred in. For the resource change query request, the resource first change record that matches the resource change query request may be first determined from the resource state parameters stored in the second storage area, that is, the resource first change record of the resource transferor in the resource change request. After determining the resource first change record, the address of the resource first change record may be determined based on the resource transfer-out linked list and the resource transfer-in linked list of the resource transferor, thereby obtaining the query result.

[0088] In an exemplary embodiment, for any resource account numbered K, when querying all its deposit (debit) records, the main execution process is: obtaining the number of the first deposit record of account K from the data in the second storage area and the number of the first outgoing record of account K from the data in the first storage area, and finding the first deposit (debit) record of account K from the first storage area according to the number of the first deposit record and the number of the first outgoing record; tracking each deposit (debit) record along the deposit (debit) record linked list, reading the transfer-in account, transfer-out account and transfer amount information therefrom and returning them to the user.

[0089] In an exemplary embodiment, before determining the area to be stored in the first storage area in response to the resource transfer request, it also includes: storing the resource data to be stored in a cache; wherein the cache is a buffer area set for the solid-state memory; when it is determined that the amount of resource data in the cache reaches a set quantity threshold, determining the area to be stored in the first storage area in response to the resource transfer request.

[0090] It is understandable that there are different data granularities for flash memory (i.e., solid-state memory) write operations, which may not necessarily be aligned with the minimum write granularity of the flash memory. In order to avoid the actual write granularity exceeding the demand and thus causing too many writes, in the specific implementation, a cache mechanism is introduced to collect various write operations. When a sufficient number of write operations are collected in the cache, the write from the cache to the flash memory is implemented.

[0091] In some embodiments, all data in the second storage area and the third storage area can be updated and read in the cache. Synchronization with the flash memory is performed only when necessary. If the user needs to perform too many operations of querying the account (in / out) records, the following data can be cached in part or in whole: the complete account (in / out) records of some frequently queried accounts; the latest partial account (in / out) records of all accounts to avoid calling multiple query operations on the flash memory.

[0092] Obviously, the above-described embodiments are only embodiments of a part of the present invention, rather than all embodiments. In order to better understand the above method, the above process is described below in conjunction with embodiments, but it is not intended to limit the technical solutions of the embodiments of the present invention, specifically:

[0093] In related technologies, in order for SSD (solid-state storage) to support read and write operations at any location, a garbage collection mechanism needs to be introduced. When a user wants to overwrite data that has been written to a certain location in a block, the SSD introduces a garbage collection mechanism to mark the data that has been written to the location as garbage data. When the amount of garbage data reaches a certain amount, the unmarked data in the entire block is transferred to other free blocks, and then the entire block is erased. Due to the randomness of SSD reading and writing data, many blocks of the SSD may contain garbage data. In this way, not only do many blocks need to be transferred, but they also need to be erased, which seriously affects the performance of the SSD.

[0094] Blockchain technology has received widespread attention in recent years. It is essentially a distributed accounting storage. From the user's perspective, a blockchain is essentially a complete virtual machine that is operable to all users on the entire network, but in fact it may be deployed in any corner of the entire Internet. It uses a certain authentication mechanism based on voting (such as PoW, PoS or PoA). PoW, PoS, and PoA are three different authentication mechanisms of blockchain, which refer to workload-based authentication, mortgage-based authentication, and authority-based authentication, respectively, to ensure that there is a unique acceptable state at any time. Its core implementation mechanism is to strictly record every state change (Transaction) of the virtual machine, determine the state set, and then assemble a certain number of Transactions into Blocks according to time and capacity requirements, select the accepted Blocks according to the authentication mechanism, and further assemble the Blocks into chains to save the history of state changes, such as Figure 3 As shown, there are different state changes (Transaction): Trans1…TransN, and the corresponding state sets, Stat1…StatN. Currently, this type of technology is mainly used in the financial field. For example, it can ensure the credibility and traceability of each transaction without a centralized certification agency.

[0095] Inspired by blockchain technology, this application considers using SSD exclusively for bookkeeping storage, that is, storing resource data. Assume that there are several fixed accounts, each of which corresponds to a certain amount of deposits. Bookkeeping storage means not only recording the deposit amount of each account, but also recording the transfer history between accounts. The dedicated SSD is hereinafter referred to as ASSD (Account Solid State Drive). Similar to the implementation strategy of blockchain, this type of storage demand can adopt incremental storage, that is, each transfer operation only needs to add a new record of the transfer amount (that is, the resource amount), the source account (the resource transferor) and the target account (the resource receiver), and modify the information of the source account itself as little as possible, which is just suitable for the operation characteristics of the SSD storage medium regarding erasure. Therefore, if the SSD is dedicated to bookkeeping storage, the generation of garbage data can be avoided as much as possible, thereby avoiding the capacity loss caused by garbage collection operations. ASSD can be bound to a specific application of an SSD with FDP (Flexible Data Placement, customizable data arrangement) function and a specific RUG in the SSD to achieve that part of the storage space of the SSD is dedicated to ASSD without affecting the use of the remaining storage space.

[0096] For the above storage application, this application includes the following basic steps: 1. Format ASSD, that is, initialize the accounting storage; 2. Add a transfer record to ASSD; 3. Query all incoming records of an account; 4. Query all outgoing records of an account; 5. Query the deposit balance of an account; 6. When the transfer record space is insufficient, a certain number of the oldest transfer records need to be erased and the corresponding account information needs to be updated at the same time; 7. Power on; 8. Power off.

[0097] In this application, for the sake of clarity, the following assumptions are made about the flash memory space organization (i.e., storage area) structure in ASSD: the flash memory space organization is a one-dimensional linear structure [0, Ca) ⊂ Z. For flash memory media that actually have a high-dimensional structure, the high-dimensional structure can be expanded into a one-dimensional structure in any way. Where Ca is the capacity of the entire flash memory user space. The erase operation unit of the flash memory is a continuous interval in the above one-dimensional structure, i.e., [iCb, (i +1)Cb), i=0, 1, ..., Ca / Cb.

[0098] Where Cb is the space size of an erase unit, satisfying Cb|Ca. The erase unit is referred to as an erase block below. All capacities and space sizes in this application are in bytes. The addresses described below refer to the above linear addresses. Assume that a total of α bytes are used to store account balances and transfer amounts. That is, the maximum balance of each account is m:=28 α . Assume the total number of accounts is n:=28 β. That is, use β bytes to store the account number, and the account number range is [0, n-1]. The number n-1 represents a special source account, that is, the amount can be generated and eliminated arbitrarily from this account. Suppose that γ≥β bytes are used to store the transfer record pointer (number), that is, a maximum of r:=2 can be stored 8γ transfer records. The user flash memory space of the entire ASSD is divided into three areas. The first storage area is used to save all transfer records. Each record includes the following data: transfer-out account number, transfer-in account number, transfer amount, pointer to the next record in the income record linked list, pointer to the next record in the expenditure record linked list. Assume that the length of each transfer record is lr, then lr at least satisfies lr ≥ α + 2β + 2γ. Note that the first transfer record of each account is an initialization record, that is, the transfer-in account number is n – 1, indicating a special account. Since this area is used cyclically, the system maintains a set of head and tail pointers to manage write behavior. The head pointer points to the current position to be written, denoted as pr, and the tail pointer points to the oldest record position, denoted as pt. Reference Figure 4 As shown, the innermost circle shows a storage example of the first storage area. The data area stores resource data. By selecting the erase area from the data area, a blank area can be obtained. Each block represents a continuous storage space of size lr. Because the block will be used cyclically, it is shown as a ring. In this example, rb=4, rc=3, and r=12.

[0099] The second storage area contains an erase block, which is used to store the system control information of the entire system. Assume that the length of the system control information is ls, which satisfies ns:=⌊Cls⌋≥1. A pointer ps to the position to be written can be maintained, which is used cyclically in the entire area according to mod ns, and ps:=ps +1mod ns is set after each write. After each ns write, the entire block is erased and the latest written data is rewritten to the erased space, and ps is updated once more. The system control information includes the write time and ps.

[0100] The third storage area stores the record pointer information, that is, the location of the new record to be written in the second storage area, in units of records, and the size is an erase block. The storage method is similar to the first storage area. Let the length of each write be lp, and define np:=⌊Cblp⌋≥1, which is the number of times the entire third storage area can be written. Each time the power is turned off, the record pointer information needs to be written to the third storage area once. The system maintains a pointer p to the location to be written p The pointer is used in the entire area in a circular manner according to mod np, and p is set after each write. p := p p+1mod np. After completing np writes, the entire block is erased and the latest written data is rewritten to the erased space, and p is updated once more. p Each write contains the following information: the write management pointer pr, pt ∈ [0, r) of the second area; the time when the pointer information is updated: p p ∈[0,np). So lp≥4×2 + 8 + γ. For the above example, lp = 20, np = 1M. That is, the third storage area needs to be erased once every 1 million power-offs. For the second storage area and the third storage area, each time the power is on, the firmware system will traverse all the control information records in the area, and take out the record with the latest writing time and load it into the system. Statistics show that the system control information located in the first storage area must at least include the following content: α, β, γ, ls, lr, lp, rb,rc, r, ns, np and other constant information; the writing time of this system control information; the writing position of the next system control information ps ∈ [0, ns); the first transfer record (initialization record) of all accounts uk ∈ [0, r), k ∈ [0, n); the original amount of all accounts O k ∈ [0,m), k ∈ [0,n).

[0101] Considering that all data except time are stored in 4 bytes, and time data is stored in 8 bytes, at least ls = 4 × 12 + 8 + n(α + γ) bytes need to be written each time, ls = 12 × 216 + 48 + 8 = 786488, ns = 26. When the second storage area is full, the system needs to perform an erase operation. At this time, the system control information will be updated and written once. Every time the system control information is written ns−1 times, the first storage area needs to perform an erase operation. In this example, every time the first storage area performs 25 erase operations, the second storage area needs to perform an erase operation.

[0102] In order to maintain the linked list of all historical deposit and withdrawal records of each account, it is necessary to save the head and tail pointers of the linked list of each account in memory, which are recorded as , , , . Where k is the record number, The address of the earliest existing entry record. The address of the latest entry record. is the earliest existing payment record address, The address of the latest existing payment record. Figure 5The link structure of the linked list is shown. In the figure, it is assumed that there are three accounts, Account 1, Account 2, and Account 3. Figure 5 The structure diagram of the linked list of entry and exit records for each account is as follows: It is the earliest existing entry record address of account 1 in the Nand physical medium. It is the earliest entry record address of account 1 in the memory variable. Similarly, It is the earliest entry record address of account 2 in the Nand physical medium. It is the earliest entry record address of account 2 in the memory variable. It is the earliest existing entry record address of account 3 in the Nand physical medium. It is the address of the earliest existing account record of account 3 in the memory variable. The solid line connection represents the next transfer record with the income account of this transfer record as the transfer destination account, and the dotted line connection represents the next transfer record with the expenditure account of this transfer record as the transfer source account. Traverse along the link until a null pointer is encountered, which means that all the account records with a certain account as the destination (source) have been traversed. For example, all the account records of account 2 in the figure are numbered {3, 14}, and all the account records are numbered {6, 17}. The record numbers here are the same as Figure 2 The innermost numbers in the have the same meaning, indicating the record address in area 1. At the same time, in order to facilitate the query of account balances, the balance of each account must also be maintained in the memory. k .

[0103] First, consider the ASSD formatting (initialization) operation. This operation mainly includes the following processes: 1. Clear the storage space of the three storage areas; 2. Confirm the correctness of the above values ​​of α, β, γ, ls, lr, lp, rb, rc, r, ns, np, etc.; 3. Reset pointer p s =0, p t = 0, pr = 1, pp = 0; 4. Write an empty record at record position 0 in the first storage area; 5. Initialize account information O in the second storage area k , , ;6. Initialize memory variables , , , , d k .

[0104] Next, consider adding a transfer record to ASSD. The main process of this operation is as follows: 1. Query the account balance of the transfer source account to determine whether the balance meets the requirements of the pending transfer record. If not, terminate the execution and return failure to the user. 2. Determine whether the storage space of the first storage area is full (pt = pr). If it is full, execute the following erasure process. 3. Write the transfer-in account number, transfer-out account number and transfer amount to the record position pointed to by pr. Note that the two linked list record pointer fields are kept empty. 4. According to the direction of the transfer operation, write to or The linked list record pointer field in the record pointed to is written with the address of this transfer record. 5. Update or is the address of this transfer record; 6. Update the account balance d in the memory k .

[0105] Next, consider querying all the deposit (debit) records of an account numbered k. The main execution process is as follows: 1. Get the data from the second storage area , 2. According to , Find the first entry (exit) record of account k from the first storage area; 3. Track each entry (exit) record along the entry (exit) record chain list, read the transfer-in account, transfer-out account, and transfer amount information from it and return it to the user.

[0106] The main process of querying the deposit balance of an account numbered k is as follows: 1. Directly return the d in the memory k ;

[0107] When the transfer record space is insufficient, it is necessary to execute a first storage area erasure process, and its execution process can be described as follows: 1. Merge the transfer records of the area to be erased into the original total amount of each account, and then update the original total amount of each account. k (amount of each account); 2. Update , ; 3. Update memory variables , ; 4. Perform an erase operation on the current to-be-erased area of ​​the first storage area; 5. Set a new to-be-erased area for the first storage area; 6. Perform a system control information write on the second storage area, update p s .

[0108] Each time the system is powered on, the following operations need to be performed: 1. Read the latest system control information from area 2, including system constants and account information. k , , ; 2. Read the latest record pointer information from area 3 and assign it to variables pt and pr; 3. k , , Update variables in memory , , , , specifically: (a) = , = (b) By tracing the income (expenditure) list of account k to the last record, we can obtain , 4. Scan all the deposit records of each account and calculate the total deposit amount ti; 5. Scan all the withdrawal records of each account and calculate the total withdrawal amount to; 6. Update d k :=O k + ti – to.

[0109] Each time the system is powered off, the following operations need to be performed: 1. According to the variable p t , p r , write the record pointer information to the third storage area once and update Pp.

[0110] Through the resource data processing method of the present application, the amount of garbage data in ASSD is significantly lower than that in general SSD. With the reduction of the amount of garbage data, the number of erasure operations performed per unit time will also decrease, thereby extending the service life of the SSD. The amount of garbage in the general SSD is theoretically evaluated and then compared with the amount of garbage in the ASSD. Secondly, it can be seen from the power-on and power-off process that the power-off process of the ASSD is simple to operate, which is conducive to powering off through limited capacitor power during abnormal power-off. Under this setting, only when the transfer record fills the first storage area will the first storage area be erased once. Accordingly, after the first storage area is erased once, the control information stored in the second storage area will be updated, wherein the second storage area maintains a record parameter, and each time the control information stored in the first storage area is updated once, the record parameter will be increased by 1, and when the number of the updated record parameter reaches the set number, the second storage area will be erased once. As for the third storage area, the third storage area also maintains a record parameter. Whenever the SSD system is powered off, the record pointer stored in the third storage area will be updated once, and the record parameter will be increased by 1. When the number of the updated record parameter reaches the set number, the third storage area will be erased.

[0111] Compared with the garbage collection mechanism in the prior art, when an area is not full, it is possible to erase the area. The present application can effectively reduce the number of erasures and improve the performance of SSD. When all the locations of a physical block in the system are filled, garbage collection is required. From the vacant state of the block (i.e., just recovered) to the full state, how many repeated writes are generated in the physical address range of the block. Because each repeated write will result in the generation of a unit of garbage data, the above number is equal to the amount of garbage data generated during this period, which is called the amount of garbage generated. In other words, if a recycling strategy is adopted in which garbage collection is started only after the data block is fully filled, as the recycled block gradually increases, the ratio of the amount of garbage generated data to the amount of data in the entire block tends to infinity. Table 1 shows the ESm calculated by taking different values ​​of m when n = 1000, where n refers to the maximum data capacity in the data block, m refers to the data occupancy threshold for starting garbage collection, and ESm refers to the ratio of the amount of garbage generated data to the amount of data in the entire block. For ASSD, all garbage data is concentrated in the second storage area and the third storage area. Since the size of the second storage area and the third storage area is limited to two erase blocks, the amount of garbage data is also less than the size of two erase blocks. If a general SSD is used for bookkeeping storage, all erase blocks of user data will generate garbage data, and the amount of garbage data will increase with the growth of transfer records. Therefore, for bookkeeping storage, using ASSD is significantly better than general SSD in terms of the amount of garbage data generated.

[0112] Table 1

[0113]

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0115] In the present embodiment, a processing device for resource data is also provided to realize the above-mentioned embodiment and preferred implementation mode, and the descriptions which have been made are not repeated here. As used below, the term "module" can realize the combination of software and / or hardware of the predetermined function. Although the modules described in the following embodiments are preferably realized with software, the realization of hardware, or the combination of software and hardware is also possible and conceived.

[0116] Figure 6 : is a structural block diagram of a resource data processing device according to an embodiment of the present application, the device comprising:

[0117] The receiving module 602 is used to receive a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area;

[0118] A determination module 604 is used to determine, in response to the resource transfer request, a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area;

[0119] An erasing module 606 is configured to perform an erasing process on the first storage area when the to-be-stored area of ​​the first storage area is the same as the set stored area; the stored area is an area in the first storage area where resource data has been stored;

[0120] The storage module 608 is used to store the resource data to be stored in the first storage area after the erasure process.

[0121] The above-mentioned device receives a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in a first storage area, wherein the first storage area is a storage area for storing resource data that is only set in a solid-state memory; in response to the resource transfer request, determines the to-be-stored area of ​​the first storage area; the to-be-stored area is the area where the resource data to be stored is to be stored in the first storage area; only when the to-be-stored area of ​​the first storage area is the same as the set stored area, the first storage area will be erased, the stored area is the area in the first storage area where resource data has been stored, and the resource data to be stored is stored in the first storage area after the erasure process. That is, the present application will erase the first storage area only when the to-be-stored area of ​​the first storage area is the same as the set stored area, that is, only when it is determined that the area to be stored in the first storage area is the same as the set area where resource data has been stored, will the erasure be carried out. Compared with the erasure method based on the garbage collection mechanism in the traditional technology, the number of erasures is effectively reduced and the performance of the SSD is improved.

[0122] In an exemplary embodiment, the area to be stored is determined by a first pointer parameter recorded for the first storage area; the stored area is determined by a second pointer parameter recorded for the first storage area; the first pointer parameter is used to record the storage location of the resource data to be stored in the first storage area; the erasing module 606 is also used to erase the first storage area when the first pointer parameter is equal to the second pointer parameter.

[0123] In an exemplary embodiment, a second storage area for storing at least resource status parameters associated with the resource data stored in the first storage area is also provided in the solid-state memory; the erasing module 606 is also used to determine the data to be erased in the first storage area; according to the data to be erased, the resource status parameters in the second storage area are updated, and the updated resource status parameters are written into the second storage area; when the updated resource status parameters are written into the second storage area, the first storage area is erased based on the determined data to be erased.

[0124] In an exemplary embodiment, the erasing module 606 is further used to update a record pointer associated with the second storage area; when the record pointer associated with the second storage area reaches a preset first record pointer threshold, the second storage area is erased.

[0125] In an exemplary embodiment, the device also includes a threshold calculation module; the threshold calculation module is used to determine the storage capacity of the second storage area and the single data length of the second storage area; the single data length is the maximum data length set to be written to the second storage area at one time; based on the quotient of the storage capacity and the single data length, the first record pointer threshold is determined.

[0126] In an exemplary embodiment, the storage module 608 is further configured to directly write the resource data to be stored into the to-be-stored area of ​​the first storage area when the to-be-stored area of ​​the first storage area is different from the set stored area.

[0127] In an exemplary embodiment, the solid-state memory is also provided with a third storage area for storing a first pointer parameter and a second pointer parameter; the device also includes an update module; the update module is used to obtain a power-off instruction; wherein the power-off instruction is an instruction generated by the solid-state memory when it enters a stop working state; based on the power-off instruction, the storage location of the resource data in the first storage area is determined, and the first pointer parameter and the second pointer parameter in the third storage area are updated according to the storage location.

[0128] In an exemplary embodiment, the erasing module 606 is further used to update a record pointer associated with the third storage area; when the record pointer associated with the third storage area reaches a preset second record pointer threshold, the third storage area is erased.

[0129] In an exemplary embodiment, the solid-state memory includes a first storage area, a second storage area and a third storage area; the device also includes an initialization module, which is used to clear the first storage area, the second storage area and the third storage area of ​​the solid-state memory; reset the first pointer parameter, the second pointer parameter, the record pointer associated with the second storage area and the record pointer associated with the third storage area recorded in the first storage area; write an empty record in the first storage area; and initialize the resource status parameters in the second storage area.

[0130] In an exemplary embodiment, the device also includes a query module, which is used to respond to a resource query request; the resource query request includes at least one of a resource change query request and a resource storage query request; based on the resource query request, determine a query result that matches the resource query request.

[0131] In an exemplary embodiment, the query module is also used to determine, when the resource query request includes the resource change query request, from the resource status parameters stored in the second storage area based on the resource change query request, a resource first change record that matches the resource change query request; determine the address of the resource first change record; determine the query result corresponding to the resource change query request according to the address; and when the resource query request includes a resource storage query request, directly determine the resource storage parameters from the memory corresponding to the solid-state storage device.

[0132] In an exemplary embodiment, the device also includes a cache module; the cache module is used to store the resource data to be stored in a cache; wherein the cache is a buffer zone set for the solid-state memory; when it is determined that the amount of resource data in the cache reaches a set quantity threshold, in response to the resource transfer request, the area to be stored in the first storage area is determined.

[0133] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0134] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0135] Optionally, in this embodiment, the computer program may be configured to perform the following steps by means of the computer program:

[0136] S1, receiving a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area;

[0137] S2, in response to the resource transfer request, determining a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area;

[0138] S3, when the to-be-stored area of ​​the first storage area is the same as the set stored area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored;

[0139] S4, storing the resource data to be stored in the first storage area after the erasure process.

[0140] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0141] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the steps in any one of the above method embodiments through the computer program.

[0142] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0143] S1, receiving a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area;

[0144] S2, in response to the resource transfer request, determining a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area;

[0145] S3, when the to-be-stored area of ​​the first storage area is the same as the set stored area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored;

[0146] S4, storing the resource data to be stored in the first storage area after the erasure process.

[0147] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0148] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0149] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0150] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.

[0151] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0152] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for processing resource data, characterized in that: Applied to a solid-state memory, in which only one first storage area for storing resource data is provided, the method comprises: receiving a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area; In response to the resource transfer request, determining a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area; When the to-be-stored area of ​​the first storage area is the same as the set stored area, erasing the first storage area; the stored area is an area in the first storage area where resource data has been stored; The resource data to be stored is stored in the first storage area after the erasure process.

2. The method according to claim 1, characterized in that The area to be stored is determined by a first pointer parameter recorded for the first storage area; the area already stored is determined by a second pointer parameter recorded for the first storage area; the first pointer parameter is used to record the storage location of the resource data to be stored in the first storage area; The second pointer parameter is used to record the storage location of the oldest resource data among the resource data stored in the first storage area; When the to-be-stored area of ​​the first storage area is the same as the set stored area, erasing the first storage area includes: When the first pointer parameter is equal to the second pointer parameter, the first storage area is erased.

3. The method according to claim 1, characterized in that A second storage area for storing at least resource status parameters associated with the resource data stored in the first storage area is also provided in the solid-state memory; The erasing process on the first storage area includes: determining the data to be erased in the first storage area; According to the data to be erased, the resource status parameters in the second storage area are updated, and the updated resource status parameters are written into the second storage area; When the updated resource status parameter is written into the second storage area, the first storage area is erased based on the determined data to be erased.

4. The method according to claim 3, characterized in that After writing the updated resource status parameter into the second storage area, the method further includes: updating a record pointer associated with the second storage area; When the record pointer associated with the second storage area reaches a preset first record pointer threshold, the second storage area is erased.

5. The method according to claim 4, characterized in that Before erasing the second storage area, the method further includes: Determine the storage capacity of the second storage area and the single data length of the second storage area; the single data length is the maximum data length set to be written to the second storage area at one time; The first record pointer threshold is determined based on the quotient of the storage capacity and the single data length.

6. The method according to claim 1, characterized in that The method further comprises: When the to-be-stored area of ​​the first storage area is different from the set stored area, the resource data to be stored is directly written into the to-be-stored area of ​​the first storage area.

7. The method according to claim 1, characterized in that The solid-state memory is also provided with a third storage area for storing the first pointer parameter and the second pointer parameter; the method further comprises: Obtaining a power-off instruction; wherein the power-off instruction is an instruction generated when the solid-state memory enters a stop working state; Based on the power-off instruction, a storage location of the resource data in the first storage area is determined, and a first pointer parameter and a second pointer parameter in the third storage area are updated according to the storage location.

8. The method according to claim 7, characterized in that After the updating of the first pointer parameter and the second pointer parameter in the third storage area, the method further includes: updating a record pointer associated with the third storage area; When the record pointer associated with the third storage area reaches a preset second record pointer threshold, the third storage area is erased.

9. The method according to claim 1, characterized in that: The solid-state memory includes a first storage area, a second storage area, and a third storage area; before receiving a resource transfer request carrying resource data to be stored, it also includes at least one of the following: Clearing the first storage area, the second storage area, and the third storage area of ​​the solid-state memory; Resetting a first pointer parameter, a second pointer parameter, a record pointer associated with the second storage area, and a record pointer associated with the third storage area recorded in the first storage area; Writing an empty record in the first storage area; Initialize resource status parameters in the second storage area.

10. The method according to claim 1, characterized in that The method further comprises: Responding to a resource query request; the resource query request at least includes at least one of a resource change query request and a resource storage query request; Based on the resource query request, a query result matching the resource query request is determined.

11. The method according to claim 10, characterized in that The determining, based on the resource query request, a query result matching the resource query request comprises: In the case where the resource query request includes the resource change query request, based on the resource change query request, determining a resource first change record matching the resource change query request from the resource state parameters stored in the second storage area; Determine the address of the first change record of the resource; Determining, according to the address, a query result corresponding to the resource change query request; In the case where the resource query request includes a resource storage query request, the resource storage parameter is directly determined from the memory corresponding to the solid-state storage.

12. The method according to claim 1, characterized in that Before determining the to-be-stored area of ​​the first storage area in response to the resource transfer request, the method further includes: Storing the resource data to be stored in a cache; wherein the cache is a buffer area set for the solid-state memory; When it is determined that the data volume of the resource data in the cache reaches a set quantity threshold, in response to the resource transfer request, a to-be-stored area of ​​the first storage area is determined.

13. A resource data processing device, applied to a solid-state memory, wherein only one first storage area for storing resource data is provided in the solid-state memory, characterized in that: include: A receiving module, configured to receive a resource transfer request carrying resource data to be stored, wherein the resource transfer request is used to store the resource data to be stored in the first storage area; A determination module, configured to determine, in response to the resource transfer request, a to-be-stored area of ​​the first storage area; the to-be-stored area is an area where the to-be-stored resource data is to be stored in the first storage area; an erasing module, configured to perform erasing processing on the first storage area when the to-be-stored area of ​​the first storage area is the same as the set stored area; the stored area is an area in the first storage area where resource data has been stored; The storage module is used to store the resource data to be stored in the first storage area after the erasure process.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 12 when executed by a processor.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Solid state disk, configuration data management method and device thereof and storage medium

    CN110658995A

  • Resource processing method and device

    CN114647384A

  • Resource transfer method and device, computer equipment and storage medium

    CN116362733A

  • Resource state processing method and device, electronic equipment and storage medium

    CN116894010A

  • Resource transfer processing method and device and computer equipment

    CN117114664A