Storage space computing method and apparatus, computer device and storage medium
By obtaining and calculating incremental and expired storage record information in real time, the storage space of each user is quickly updated, which solves the problems of slow speed and large resource utilization when calculating storage space, and improves the stability and user experience of storage services.
Patent Information
- Application Number
- PCT/CN2024/122866
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-17
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-20
AI Technical Summary
In large IoT platforms, when calculating the storage space of storage users, the calculation results are slow and take up more resources, which affects the stability of storage services and user experience.
By obtaining incremental storage record information and expired storage record information in real time, calculate the accumulated storage value and free space value, calculate the difference to obtain the space value to be updated, and update the current storage space value to achieve rapid update of each user's storage space.
This method can quickly update the storage space of each user, reduce resource usage, avoid affecting the stability of storage services, and improve user experience.
Smart Images

Figure CN2024122866_20022025_PF_FP_ABST
Abstract
Description
Storage space calculation method, device, computer equipment and storage medium Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a storage space calculation method, device, computer equipment and storage medium. Background Art
[0002] Large-scale IoT platforms typically host over 100 million devices and over 100,000 users. To reduce storage costs for massive amounts of device messages, they deploy one or more big data storage services to share and store all user device messages. A single storage service can store device messages from tens of thousands of users. Counting each user's storage usage would significantly consume storage service resources, impacting storage service stability, reducing the user experience, and introducing significant latency in calculation results.
[0003] Summary of the Invention
[0004] The embodiments of the present application provide a storage space calculation method, apparatus, computer equipment, and storage medium, which aim to solve the current problem of slow calculation results and high resource usage when calculating the storage space of a storage user.
[0005] In a first aspect, an embodiment of the present application provides a storage space calculation method, the method comprising:
[0006] Acquire incremental storage record information and expired storage record information in real time, wherein both the incremental storage record information and the expired storage record information include stored users and message sizes;
[0007] Calculating the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage accumulation value, and calculating the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value;
[0008] Calculating the difference between the stored accumulated value and the released space value to obtain a to-be-updated space value;
[0009] A current storage space value is acquired, and the current storage space value and the to-be-updated space value are summed to update the current storage space value.
[0010] In a second aspect, an embodiment of the present application further provides a storage space calculation device, the device comprising:
[0011] A storage record acquisition unit, configured to acquire incremental storage record information and expired storage record information in real time, wherein both the incremental storage record information and the expired storage record information include storage users and message sizes;
[0012] a space calculation unit, configured to calculate the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage accumulation value, and to calculate the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value;
[0013] a first calculation unit, configured to calculate a difference between the stored accumulated value and the released space value to obtain a space value to be updated;
[0014] The updating unit is configured to obtain a current storage space value, and sum the current storage space value and the space value to be updated to update the current storage space value.
[0015] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.
[0017] The embodiments of the present application provide a storage space calculation method, apparatus, computer device, and storage medium. The method includes: acquiring incremental storage record information and expired storage record information in real time, wherein the incremental storage record information and the expired storage record information both include storage users and message sizes; calculating the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage accumulation value, and calculating the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value; subtracting the storage accumulation value from the released space value to obtain a space value to be updated; acquiring a current storage space value, and summing the current storage space value and the space value to be updated to update the current storage space value. The embodiment of the present application can obtain incremental storage record information and expired storage record information in real time. One piece of incremental storage record information or one piece of expired storage record information corresponds to one message, and both the incremental storage record information and the expired storage record information include the storage user and the message size. The sum of all message sizes corresponding to each storage user can be calculated to obtain the storage accumulation value and the released space value. The storage accumulation value is the added space value, and the released space value is the deleted space value. The current space value can be updated according to the current space value, the storage accumulation value and the released space value, thereby quickly updating the storage space of each user, and occupying fewer resources, which will not affect the stability of the storage service. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] FIG1 is a flow chart of a storage space calculation method provided in an embodiment of the present application;
[0020] FIG2 is a schematic block diagram of a storage space calculation device provided in an embodiment of the present application;
[0021] FIG3 is a schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0023] It will be understood that when used in this specification and the appended claims, the terms “include” and “comprising” indicate the presence of described features, integers, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, operations, elements, components and / or groups thereof.
[0024] It should also be understood that the terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, including and including these combinations.
[0025] Please refer to Figure 1, which is a schematic diagram of the storage space calculation method provided in an embodiment of the present application. The storage space calculation method of the embodiment of the present application is applied to a central IoT platform and can calculate the storage space of each storage user in real time. As shown in Figure 1, the method includes steps S110 to S140.
[0026] S110, acquiring incremental storage record information and expired storage record information in real time, wherein both the incremental storage record information and the expired storage record information include stored users and message sizes.
[0027] In an embodiment of the present application, the distributed cache Redis Cluster, the distributed message queue Pulsar, the distributed small file system minio, and the stream processing engine Flink can be deployed in advance. Create message queues mTopic and rTopic on the distributed message queue, mTopic is used to receive incremental storage messages, and rTopic is used to receive expired storage messages. The incremental storage record message is used to record the information of the incremental storage message, and the expired storage record information is used to record the expired storage message. The incremental storage record information may include the storage user ID: uId, the message size: mSize, and the storage time: mTime. The expired storage record information may include the storage user ID: uId and the message size: mSize. After the deployment is completed, when the device message is written to the storage service normally, each new message will be sent to mTopic to form an incremental storage message, and each expired message will be sent from the distributed small file system to rTopic to form an expired storage message. The above-mentioned new messages are written to mTopic and expired messages are written to rTopic, and the incremental storage record information of the incremental storage messages and the expired storage record information of the expired storage information can be obtained from the message queue in real time, where one incremental storage message corresponds to one incremental storage record information, and one expired storage information corresponds to one expired storage record information.
[0028] For incremental storage records, each piece of incremental storage record information is newly created, and the storage time is used to record the time. For example, "Stored User A, December 12, 2000, 12:31:21, 1KB" indicates that the storage user of this newly added message is A, the storage time is December 12, 2000, 12:31:21, and the size is 1KB. For expired storage records, it can be "Stored User A, 20KB" to indicate that at the current time, the messages stored by user A, which are 20KB in total, have expired.
[0029] S120, calculate the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage cumulative value, and calculate the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value.
[0030] In an embodiment of the present application, the incremental storage record information and expired storage record information obtained simultaneously may be in the hundreds or thousands. When calculating, a calculation window may be set, for example, one minute, and the acquired incremental storage record information and expired storage record information are calculated once every one minute. When calculating, a stream processing engine may be used for real-time streaming calculation to avoid occupying storage space. Preferably, when calculating the size of the incremental storage record information, the message size within the window may be accumulated according to the storage user and time dimension mMin (calculated once per minute), and the storage user, time, and accumulated value may be output. For example, if the incremental storage record information obtained within one minute from 12:20:00 on December 12, 2000 to 12:21:00 on December 12, 2000 includes storage user A and storage user B, and storage user A has 10 messages, each of 1 KB, and storage user B has 20 messages, each of 1 KB, then the cumulative storage value for storage user A within one minute is 10 KB, and the cumulative storage value for storage user B is 20 KB. For expired storage record information, since expired messages exist at all times, the calculation method can be referred to the incremental storage record information and will not be repeated here.
[0031] In some embodiments, such as this embodiment, step S120 may include the following steps:
[0032] Calculating the sum of the message sizes corresponding to each of the stored users in all the incremental storage record information at preset intervals to obtain the storage cumulative value;
[0033] The total message size corresponding to each storage user in all the expired storage record information is calculated at preset intervals to obtain the released space value.
[0034] In an embodiment of the present application, the preset interval can be one second, ten seconds, thirty seconds or one minute. Preferably, it can be calculated once every one minute, so that it can be updated once a minute, which can reduce resource usage and also achieve near real-time update of storage space.
[0035] S130: Calculate the difference between the stored accumulated value and the released space value to obtain a space value to be updated.
[0036] In the embodiment of the present application, the obtained storage accumulation value is the size of the space to be occupied, and the obtained released space value is the size of the space to be released. Then, the storage accumulation value and the released space value can be subtracted to obtain a space value to be updated. For example, if the storage accumulation value is 20KB and the released space value is 10KB, the result of subtracting the storage accumulation value and the released space value is 10KB, indicating that 10KB of space has been newly occupied. If the storage accumulation value is 10KB and the released space value is 20KB, the result of subtracting the storage accumulation value and the released space value is -10KB, indicating that 10KB of space has been released.
[0037] S140: Acquire a current storage space value, and sum the current storage space value and the space value to be updated to update the current storage space value.
[0038] In the embodiment of the present application, if the current storage space value is 1000KB and the space value to be updated is 10KB, the updated current storage space value is 1010KB; if the space value to be updated is -10KB, the updated current storage space value is 9990KB.
[0039] In some embodiments, such as this embodiment, the incremental storage record information also includes storage time. The storage space calculation method of the embodiment of the present application further includes the following steps:
[0040] Classifying the incremental storage record information and the storage accumulated value according to storage cycle type to obtain a plurality of first-category storage record information;
[0041] Classifying the first category of storage record information according to a time dimension to obtain a plurality of second category storage record information;
[0042] The storage user in the second type of storage record information and the storage accumulated value corresponding to the user are written into the storage system.
[0043] In the embodiment of the present application, the storage period types generally include a 30-day storage period, a 60-day storage period, and a 180-day storage period. One storage user corresponds to one storage period, and the storage period of each user is set in advance in the system. After calculating the storage cumulative value, the incremental storage record information and the storage cumulative value are classified according to the storage period type to obtain the first category of storage record information, that is, the storage users with a storage period of 30 days and the storage cumulative values corresponding to the storage users are classified into one category, and the storage users with a storage period of 60 days and the storage cumulative values corresponding to the storage users are classified into one category. The first category of storage record information is then reclassified according to the time dimension. The time dimension can refer to classification by minutes or hours, which is generally consistent with the calculation window. For example, if the storage cumulative value is calculated at the minute level, the first category of storage record information can be reclassified at the minute level to obtain the second category of storage record information. The second category of storage record information is shown in Table (1):
[0044] Table (1)
[0045] As shown in Table (1), the time dimension of December 12, 2000, at 21:00 refers to the sum of the incremental storage record information of the storage users counted from 20:00 on December 12, 2000 to 21:00 on December 12, 2000. In the time dimension of December 12, 2000, at 21:00, the total message size of storage user A is 10KB, and the total message size of storage user B is 13KB. As can be seen from Table (1), in the second category of storage record information, it has been classified according to the storage period and time dimension. Therefore, the storage users and storage accumulation values in the second category of storage users can be written into the storage system, that is, the distributed small file system. In the distributed small file system minio, the storage period type can be set in advance, that is, different directories can be created in the distributed small file system minio in advance, and messages of different storage periods are stored in the corresponding directories. For example, in the distributed small file system minio, three directories, sData30, sData90, and sData180, are created. sData30 indicates a storage period of 30 days, sData90 indicates a storage period of 90 days, and sData180 indicates a storage period of 180 days. In each storage directory, a subdirectory is created as the natural day increases to store the messages of the day, that is, each day corresponds to a subdirectory. For example, on December 12, 2000, a subdirectory is created in the sData30 directory, with 20001212 as the name of the subdirectory. Then, the incremental storage record information generated on December 12, 2000 can be stored in this directory, that is, the storage users and storage cumulative values corresponding to December 12, 2000 in the second category of storage record information are all written to this subdirectory. Since the classification is carried out in advance according to the time dimension and storage period type, there is no need to write time information when writing, which further saves storage space.
[0046] In some embodiments, such as this embodiment, the storage space calculation method of the embodiment of the present application further includes the following steps:
[0047] Obtaining expired data from a storage system and deleting the expired data from the storage system;
[0048] The expired data is parsed to obtain the expired storage record information.
[0049] In an embodiment of the present application, the storage system may be a distributed small file system, and the storage period type may be set in advance in the distributed small file system minio, that is, different directories may be created in advance in the distributed small file system minio, and messages of different storage periods are stored in the corresponding directories. For example, three directories, sData30, sData90, and sData180, are created in the distributed small file system minio, where sData30 indicates a storage period of 30 days, sData90 indicates a storage period of 90 days, and sData180 indicates a storage period of 180 days. A subdirectory is created under each storage directory as the natural day increases, and the name of the subdirectory is the time of creation. It is then possible to confirm whether the subdirectory is expired based on the name of the subdirectory. For example, if multiple subdirectories are created under the sData30 storage directory, the storage period of each subdirectory under this storage directory is 30 days. If the creation time of a subdirectory is greater than 30 days, it indicates that all files under this subdirectory are expired files. In this case, the files in this subdirectory can be extracted and the subdirectory can be deleted. If the creation time of the subdirectory is equal to 30 days, it can be further determined whether the creation time of the files under the subdirectory is greater than 30 days. Files older than 30 days can be extracted and deleted. The extracted expired data is then parsed to obtain expired storage record information, which includes the stored user and message size.
[0050] In some embodiments, such as this embodiment, the storage space calculation method of the embodiment of the present application further includes the following steps:
[0051] Acquire the stored data in the storage system and confirm the storage period and storage time of the stored data;
[0052] If the storage time of the stored data is greater than the storage period, the stored data is extracted as the expired data.
[0053] In an embodiment of the present application, when determining whether the stored data is expired, it can be determined by the relationship between the creation time and the storage period. When the creation time is greater than the storage period, it indicates that it is expired data. It can also be determined directly by the name.
[0054] In some embodiments, such as this embodiment, the storage space calculation method of the embodiment of the present application further includes the following steps:
[0055] Creating a storage data directory in the storage system according to the storage cycle type, wherein one storage cycle corresponds to one storage data directory;
[0056] A storage data subdirectory is created in the storage data directory every day, and the storage data subdirectory is used to store data generated on that day.
[0057] In an embodiment of the present application, the storage system can be a distributed small file system, and the storage period type can be set in advance in the distributed small file system minio, that is, different directories can be created in advance in the distributed small file system minio, and messages of different storage periods are stored in the corresponding directories. For example, three directories sData30, sData90, and sData180 are created in the distributed small file system minio, sData30 indicates that the storage period is 30 days, sData90 indicates that the storage period is 90 days, and sData180 indicates that the storage period is 180 days. In each storage directory, a subdirectory is created as the number of natural days increases, that is, if there are three storage directories in total, a subdirectory is created in each storage directory as the number of natural days increases. The storage directory can also be 360 days, and the specific number of days is not limited here.
[0058] Figure 2 is a schematic block diagram of a storage space calculation device 100 provided in an embodiment of the present application. As shown in Figure 2 , corresponding to the above storage space calculation method, the present application also provides a storage space calculation device 100. This storage space calculation device 100 includes units for executing the above storage space calculation method. Specifically, referring to Figure 2 , this storage space calculation device 100 includes a storage record acquisition unit 110, a space calculation unit 120, a first calculation unit 130, and an update unit 140.
[0059] Among them, the storage record acquisition unit 110 is used to acquire incremental storage record information and expired storage record information in real time, wherein the incremental storage record information and the expired storage record information both include storage users and message sizes; the space calculation unit 120 is used to calculate the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage cumulative value, and calculate the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value; the first calculation unit 130 is used to calculate the difference between the storage cumulative value and the released space value to obtain a space value to be updated; the update unit 140 is used to obtain the current storage space value, and sum the current storage space value and the space value to be updated to update the current storage space value.
[0060] In some embodiments, such as this embodiment, the spatial calculation unit 120 includes a second calculation unit and a third calculation unit.
[0061] Among them, the second calculation unit is used to calculate the sum of the message sizes corresponding to each storage user in all the incremental storage record information according to the preset interval to obtain the storage cumulative value; the third calculation unit is used to calculate the sum of the message sizes corresponding to each storage user in all the expired storage record information according to the preset interval to obtain the released space value.
[0062] Another embodiment of the present application further provides a storage space calculation device. The storage space calculation device of this embodiment is based on the above embodiment and adds a first creation unit, a first acquisition unit, a first writing unit and a first storage unit.
[0063] Among them, the first creation unit is used to classify the incremental storage record information and the storage accumulated value according to the storage cycle type to obtain multiple first-category storage record information; the first acquisition unit is used to classify the first-category storage record information according to the time dimension to obtain multiple second-category storage record information; the first writing unit is used to write the storage users in the second-category storage record information and the storage accumulated values corresponding to the users into the storage system.
[0064] Another embodiment of the present application further provides a storage space calculation device. The storage space calculation device of this embodiment is based on the above embodiment and adds a second acquisition unit and a first parsing unit.
[0065] The second acquiring unit is used to acquire expired data from the storage system and delete the expired data in the storage system; the first parsing unit is used to parse the expired data to acquire the expired storage record information.
[0066] In some embodiments, such as this embodiment, the second acquisition unit includes a third acquisition unit and a second extraction unit.
[0067] Among them, the third acquisition unit is used to obtain the storage data in the storage system and confirm the storage period and storage time of the storage data; the second extraction unit is used to extract the storage data as the expired data if the storage time of the storage data is greater than the storage period.
[0068] Another embodiment of the present application further provides a storage space calculation device. The storage space calculation device of this embodiment adds a second creation unit and a third creation unit on the basis of the above embodiment.
[0069] Among them, the second creation unit is used to create a storage data directory in the storage system according to the storage cycle type, wherein one storage cycle corresponds to one storage data directory; the third creation unit is used to create a storage data subdirectory in the storage data directory every day, and the storage data subdirectory is used to store the data generated on that day.
[0070] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned storage space calculation device and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of the description, it will not be repeated here.
[0071] The storage space calculation device can be implemented in the form of a computer program, which can be run on a computer device as shown in FIG3 .
[0072] Please refer to Figure 3, which is a schematic block diagram of a computer device provided in an embodiment of the present application. Referring to Figure 3, the computer device 500 includes a processor 502, a memory, and an interface 507 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and an internal memory 504.
[0073] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a storage space calculation method.
[0074] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
[0075] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a storage space calculation method.
[0076] The interface 505 is used to communicate with other devices. Those skilled in the art will understand that the structure shown in FIG3 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0077] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (FSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0078] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the steps in the method of the above-described embodiment.
[0079] Therefore, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program implements any embodiment of the above-mentioned method for training a speech conversion model based on domain separation.
[0080] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.
[0081] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and other division methods may be used in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not implemented.
[0083] The steps in the method of the embodiment of the present application can be adjusted in order, combined, and deleted according to actual needs. The units in the device of the embodiment of the present application can be combined, divided, and deleted according to actual needs. In addition, the functional units in the various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a single unit.
[0084] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device to execute all or part of the steps of the method described in each embodiment of the present application.
[0085] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0086] Obviously, those skilled in the art may make various modifications and variations to this application without departing from the spirit and scope of this application. Thus, as long as these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
[0087] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A storage space calculation method, characterized in that: The method comprises: Acquire incremental storage record information and expired storage record information in real time, wherein the incremental storage record information and the expired storage record information both include storage users and message sizes; Calculate the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage cumulative value, and calculate the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value; Subtracting the stored accumulated value from the released space value to obtain a space value to be updated; A current storage space value is obtained, and the current storage space value and the to-be-updated space value are summed to update the current storage space value.
2. The method according to claim 1, characterized in that The incremental storage record information also includes storage time, and the method further includes: Classifying the incremental storage record information and the storage accumulated value according to the storage cycle type to obtain a plurality of first-category storage record information; Classifying the first category of storage record information according to the time dimension to obtain a plurality of second category storage record information; The storage user in the second type of storage record information and the storage accumulated value corresponding to the user are written into the storage system.
3. The method according to claim 1, characterized in that The method further comprises: Acquire expired data from a storage system, and delete the expired data from the storage system; The expired data is parsed to obtain the expired storage record information.
4. The method according to claim 3, characterized in that The step of obtaining expired data from the storage system includes: Acquire the storage data in the storage system, and confirm the storage period and storage time of the storage data; If the storage time of the stored data is greater than the storage period, the stored data is extracted as the expired data.
5. The method according to claim 1, characterized in that The step of calculating the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage cumulative value comprises: The sum of the message sizes corresponding to each of the storage users in all the incremental storage record information is calculated at preset intervals to obtain the storage cumulative value.
6. The method according to claim 1, characterized in that The step of calculating the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain the released space value comprises: The sum of the message sizes corresponding to each storage user in all the expired storage record information is calculated at preset intervals to obtain the released space value.
7. The method according to claim 1, characterized in that The method further comprises: Creating a storage data directory in the storage system according to the storage cycle type, wherein one storage cycle corresponds to one storage data directory; A storage data subdirectory is created in the storage data directory every day, and the storage data subdirectory is used to store the data generated on that day.
8. A storage space calculation device, characterized in that: The device comprises: A storage record acquisition unit, used to acquire incremental storage record information and expired storage record information in real time, wherein the incremental storage record information and the expired storage record information both include storage users and message sizes; A space calculation unit, used for calculating the sum of the message sizes corresponding to each storage user in all the acquired incremental storage record information to obtain a storage cumulative value, and calculating the sum of the message sizes corresponding to each storage user in all the acquired expired storage record information to obtain a released space value; A first calculation unit, configured to calculate a difference between the stored accumulated value and the released space value to obtain a space value to be updated; The updating unit is used to obtain a current storage space value, and sum the current storage space value and the space value to be updated to update the current storage space value.
9. A computer device, characterized in that: The computer device comprises a memory and a processor connected to the memory; the memory is used to store a computer program; the processor is used to run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 can be implemented on a computer device having a capacitive touch screen.
Citation Information
Patent Citations
Method and apparatus for managing storage space
CN109241178A
Storage space adjustment method and device for cloud storage resource pool and cloud storage system
CN110300134A
Storage management method and device of application program, storage medium and product
CN116028452A
Storage space calculation method and device, computer equipment and storage medium
CN117075807A