A data storage method, device, storage medium and automobile

By calculating the maximum storage space for the target date and performing data deletion and compression, the system anomalies and data loss caused by insufficient storage space were resolved, thus optimizing the time and space of data storage.

CN115756310BActive Publication Date: 2026-04-28GREAT WALL MOTOR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GREAT WALL MOTOR CO LTD
Filing Date
2022-11-01
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing technologies, when storing data, devices such as camera surveillance data and electronic control units are prone to system malfunctions due to insufficient storage space. On the other hand, reducing the storage time can lead to the loss of important data. Therefore, a more optimized data storage method is needed to balance storage time and space.

Method used

The maximum storage space corresponding to the target date is calculated by using a preset ratio and the number of historical days corresponding to the data stored in the total storage space. The total storage space is then deleted to obtain the target storage space, and the data within the target date is saved. At the same time, the data is compressed to save space.

Benefits of technology

While saving storage space, it can save data for several days and avoid data loss, thus achieving a balance between data storage time and space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756310B_ABST
    Figure CN115756310B_ABST
Patent Text Reader

Abstract

The application discloses a data storage method and device, a storage medium and a car. The method comprises the following steps: calculating the maximum storage space corresponding to a target date based on a preset ratio and historical days corresponding to the storage data in the total storage space; performing a deletion process on the storage data in the total storage space to obtain a target storage space satisfying the maximum storage space corresponding to the target date; and storing target data generated within the target date in the target storage space. By using the application, the maximum planning storage space corresponding to each day is planned through the preset ratio and the days corresponding to the storage data in the storage space, so that the data of multiple days is saved while the storage space is saved, data loss is avoided, and the time and space of data storage are considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data storage method, apparatus, storage medium, and automobile. Background Technology

[0002] Camera monitoring data and in-vehicle electronic control units (ECUs) typically need to monitor daily data and save data for a period of time for easy maintenance and retrieval. However, saving too much data and occupying too much storage space can easily lead to system malfunctions. If the data storage time is reduced, important data may be lost. Therefore, a more optimized data storage method is needed. Summary of the Invention

[0003] This application provides a data storage method, apparatus, storage medium, and electronic device. It allows for the planning of the maximum daily storage space by using a preset ratio and the number of days corresponding to the stored data. This saves storage space while preserving data from multiple days and preventing data loss, thus achieving a balance between the time and space requirements of data storage. The technical solution is as follows:

[0004] In a first aspect, embodiments of this application provide a data storage method, the method comprising:

[0005] Based on the preset ratio and the number of historical days corresponding to the data stored in the total storage space, calculate the maximum storage space corresponding to the target date;

[0006] Delete stored data in the total storage space to obtain a target storage space that meets the maximum storage space corresponding to the target date;

[0007] The target data generated within the target date is stored in the target storage space.

[0008] Secondly, embodiments of this application provide a data storage device, the device comprising:

[0009] The storage space calculation module is used to calculate the maximum storage space corresponding to the target date based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space.

[0010] The data deletion module is used to delete stored data in the total storage space to obtain the target storage space that meets the maximum storage space corresponding to the target date;

[0011] The data storage module is used to store the target data generated within the target date in the target storage space.

[0012] Thirdly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.

[0013] Fourthly, embodiments of this application provide an automobile that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.

[0014] The beneficial effects of the technical solutions provided in some embodiments of this application include at least the following:

[0015] In one or more embodiments of this application, based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space, the maximum storage space corresponding to the target date is calculated. The stored data in the total storage space is then deleted to obtain a target storage space that satisfies the maximum storage space corresponding to the target date. The target data generated within the target date is then stored in the target storage space. By using a preset ratio and the number of days corresponding to the stored data in the storage space to plan the maximum planned storage space for each day, storage space is saved while preserving data from multiple days, preventing data loss, and thus achieving a balance between the time and space considerations for data storage. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is an example diagram illustrating data storage according to a storage cycle, provided in an embodiment of this application.

[0018] Figure 2 This is a flowchart illustrating a data storage method provided in an embodiment of this application;

[0019] Figure 3 This is a flowchart illustrating a data storage method provided in an embodiment of this application;

[0020] Figure 4 This is an example diagram illustrating a deletion process provided in an embodiment of this application;

[0021] Figure 5 This is an example diagram illustrating a maximum storage space provided in an embodiment of this application;

[0022] Figure 6This is an example diagram illustrating a compression process provided in an embodiment of this application;

[0023] Figure 7 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application;

[0024] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] The data storage device can be a car, or an electronic device or module on a car for performing data storage methods. The data storage device can be used to store ECU data generated by the Electronic Control Unit (ECU) in the car during operation in a storable device on the car. The storable device on the car can be an Embedded Multi Media Card (EMMC), which is a standard for flash memory cards. It defines the physical architecture, access interface and protocol of the storage system based on the embedded multimedia card. The data storage device can store the ECU data generated when the car is locked in the ECU EMMC. Understandably, the capacity of the ECU EMMC is limited. The data storage device can store ECU data in the total storage space of the ECU EMMC according to the storage cycle. The total storage space is the storage space planned for ECU data in the ECU EMMC. The data storage device can only store ECU data of the total storage space size in the ECU EMMC at most. The size of the total storage space is less than or equal to the total capacity of the ECU EMMC. The size of the total storage space can be the initial setting of the data storage device, or it can be set by the user or relevant personnel. For example, the total storage space can be half of the total capacity of the ECU EMMC, which can avoid the ECU EMMC capacity being filled and affecting the system operation.

[0027] The storage period is used to determine how long ECU data can be stored in the total storage space. For example, if the storage period is ten days, the data storage device can store ECU data generated within the most recent ten days, including today, and delete data generated before ten days ago. The storage period can be the initial setting of the data storage device or can be set by the user or relevant personnel.

[0028] Please see also Figure 1 This embodiment of the present application provides an example of data storage according to a storage period. If the storage period is five days, that is, the data storage device can save the data generated in the last five days in the total storage space, then on the fifth day, the data storage device can save the data corresponding to the first day, the second day, the third day, the fourth day and the fifth day in the total storage space of the ECU EMMC. When the next day, that is, the sixth day, since the storage period is five days, the data storage device will delete the data of the first day, and the total storage space can save the data corresponding to the second day, the third day, the fourth day, the fifth day and the sixth day.

[0029] The data storage method provided in this application will be described in detail below with reference to specific embodiments.

[0030] Please see Figure 2 This is a flowchart illustrating a data storage method provided in an embodiment of this application. Figure 2 As shown, the method described in this application embodiment may include the following steps S101-S103.

[0031] S101, based on the preset ratio and the number of historical days corresponding to the data stored in the total storage space, calculate the maximum storage space corresponding to the target date.

[0032] Specifically, the data storage device can plan the maximum storage space for the target date in the total storage space based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space. The target date is the current date. For example, if the data storage device updates the data at 0:00 every day, that is, at 0:00 the data storage device will confirm that a new day has arrived, then after 0:00 on September 25, the data storage device can update the target date to September 25 and calculate the maximum storage space corresponding to the target date.

[0033] The preset ratio is used to determine the maximum storage space corresponding to each historical date within the historical days, as well as the maximum storage space corresponding to the target date. Since the sum of the maximum storage space corresponding to each historical date and the maximum storage space corresponding to the target date equals the total storage space, and the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date is the preset ratio, the data storage device can calculate the maximum storage space corresponding to each historical date and the maximum storage space corresponding to the target date based on the historical days and the preset ratio. Here, the first date is any historical date within the historical days, and the second date is the day after the first date. The second date can be either a historical date or the target date. The preset ratio can be an initial setting for the data storage device or can be set by the user or relevant personnel. For example, it can be set to 1.2, meaning the maximum storage space corresponding to the second date can be 1.2 times the maximum storage space corresponding to the first date. If the historical days are 2 days and the total storage space is 10G, then the maximum storage space corresponding to the two days before the target date is 2.7G, the maximum storage space corresponding to the day before the target date is 3.3G, and the maximum storage space corresponding to the target date is 4G.

[0034] S102, delete the stored data in the total storage space to obtain the target storage space that meets the maximum storage space corresponding to the target date.

[0035] Specifically, the data storage device can delete stored data in the total storage space to obtain a target storage space that meets the maximum storage space corresponding to the target date. This ensures that data generated within the target date is stored in the total storage space if the data size does not exceed the target storage space, preventing data loss. The data storage device can also obtain the maximum storage space corresponding to a third date and then delete historical data corresponding to that third date from the total storage space. This ensures that the deleted historical data meets the maximum storage space for the third date, where the third date can be any historical date within the historical days. The data storage device can also perform deduplication on the historical data corresponding to the third date to reduce the storage space occupied by that historical data. In essence, deduplication removes duplicate data from the total storage space.

[0036] S103, store the target data generated within the target date in the target storage space.

[0037] Specifically, the data storage device can acquire the target data generated within the target date and store it in the target storage space of the total storage space. Since the size of the target storage space is limited, the target data can be compressed before being stored in the target storage space. It is understandable that when the target storage space is full, even if there is still free storage space in the total storage space or the ECU EMMC, the data storage device will not save the data generated after the target date until the target date changes, at which point the data storage device will update the data in the total storage space.

[0038] In this embodiment, based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space, the maximum storage space corresponding to the target date is calculated. The stored data in the total storage space is then deleted to obtain a target storage space that meets the maximum storage space requirement for the target date. The target data generated within the target date is then stored in this target storage space. By using a preset ratio and the number of days corresponding to the stored data in the storage space, the planned maximum storage space for each day is designed. This saves storage space while preserving data from multiple days, preventing data loss, and thus achieving a balance between the time and space considerations for data storage.

[0039] Please see Figure 3 This is a flowchart illustrating a data storage method provided in an embodiment of this application. Figure 3 As shown, the method described in this application embodiment may include the following steps S201-S207.

[0040] S201, obtain the historical number of days corresponding to the stored data in the total storage space.

[0041] Specifically, the data storage device can first obtain all historical dates corresponding to the stored data already saved in the total storage space, and then obtain the total number of all historical dates, which is the number of historical days corresponding to the stored data in the total storage space. For example, if the total storage space contains data generated between September 23 and September 25, then the historical dates include September 23, September 24, and September 25, and the number of historical days is 3 days.

[0042] S202, determine whether the number of historical days is less than the total number of days in the storage period.

[0043] Specifically, the data storage device can obtain the total number of days in the storage period. For example, if the storage period is 7 days, meaning the total storage space can store a maximum of 7 days of data, then the total number of days is 7. The data storage device can determine whether the historical number of days is less than the total number of days. If the historical number of days is greater than or equal to the total number of days, meaning the total storage space has already stored data for one storage period, then step S203 is executed; if the historical number of days is less than the total number of days, meaning the total storage space has not yet stored data for a full storage period, then step S204 is executed.

[0044] S203, delete the stored data before the total number of days in the total storage space.

[0045] Specifically, if the number of historical days is greater than or equal to the total number of days in the storage period, it means that the total storage space has already stored data for one storage period. The total storage space can store a maximum of the total number of days in the storage period. Therefore, the data storage device can delete the stored data in the total storage space before the total number of days. After deleting the stored data before the total number of days, the number of historical days corresponding to the stored data still existing in the total storage space will be less than the total number of days in the storage period. Then, step S204 is executed.

[0046] Please see also Figure 4 The following is an example diagram illustrating a deletion process in an embodiment of this application. If the target date is September 21, and the total number of days in the storage period is 6 days, and the total number of historical days in the total storage space is also 6 days, which is equal to the total number of days in the storage period, then the data storage device can delete the stored data in the total storage space that is 6 days before the target date of September 21, that is, delete the data on September 15. After the deletion process, only the data from September 16 to September 20 remains in the total storage space. At this time, the number of historical days becomes 5 days, which is less than the total number of days in the storage period.

[0047] S204, calculate the maximum storage space corresponding to each historical date in the historical days based on the preset ratio, and the maximum storage space corresponding to the target date.

[0048] Specifically, the data storage device can plan the maximum storage space for the target date within the total storage space based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space. The target date is the current date. The preset ratio is used to determine the maximum storage space corresponding to each historical date within the historical days, and the maximum storage space corresponding to the target date. The sum of the maximum storage spaces corresponding to each historical date and the maximum storage space corresponding to the target date is the total storage space. Furthermore, the preset ratio is the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date.

[0049] Optionally, the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date is a preset ratio, where the first date is any historical date in the historical days, and the second date is the day after the first date. That is, the ratio of the maximum storage space of the following day to the maximum storage space of the previous day is always the preset ratio. Please refer to [further details omitted]. Figure 5 This example illustrates the maximum storage space in this application. If the target date is September 20th, and the total storage space contains 3 historical days (September 17th, 18th, and 19th), with a preset ratio of 1.2, the data storage device can calculate the maximum storage space for each historical date and the maximum storage space for the target date. The sum of the maximum storage spaces for September 17th, 18th, 19th, and 20th is the total storage space. The maximum storage space for September 17th is X, the maximum storage space for September 18th is 1.2X, the maximum storage space for September 19th is 1.44X, and the maximum storage space for September 20th (the target date) is 1.728X.

[0050] S205, delete the stored data in the total storage space to obtain the target storage space that meets the maximum storage space corresponding to the target date.

[0051] Specifically, the data storage device can delete stored data in the total storage space to obtain a target storage space that meets the maximum storage space corresponding to the target date. This ensures that data generated within the target date does not exceed the target storage space and can be saved to the total storage space, thus avoiding data loss.

[0052] Optionally, the data storage device can delete the historical data corresponding to the third date in the total storage space, thereby reducing the storage space occupied by the historical data corresponding to the third date, so that the deleted historical data meets the maximum storage space corresponding to the third date, where the third date is any historical date in the historical days.

[0053] Optionally, the data storage device can also perform deduplication on the historical data corresponding to the third date to reduce the storage space occupied by the historical data corresponding to the third date. If the historical data after deduplication still cannot meet the maximum storage space corresponding to the third date, the historical data after deduplication can be deleted in chronological order until the historical data after deletion meets the maximum storage space corresponding to the third date.

[0054] S206, Obtain the target data generated within the target date and compress the target data.

[0055] Specifically, the data storage device can acquire the target data generated within the target date and store the target data generated within the target date in the target storage space of the total storage space. Since the size of the target storage space is limited, the data storage device can compress the target data and then store the compressed target data in the target storage space.

[0056] Optionally, the data storage device can acquire first data from the target data, where the first data is any data in the target data that is different from the previous data. Then, it can acquire second data that is identical to and consecutive to the first data from the target data, and count the number of entries for the second data. All second data identical to the first data are deleted, and the count is recorded after the first data. This reduces damage and loss of target data during compression, improving the accuracy and security of the compression process. Please refer to [further details omitted]. Figure 6 This document provides an example of compression processing in an embodiment of this application. For instance, the target data can be “AAAABBBBBCCC”, where the first A, B, and C that are different from the previous data can be the first data, and the data that are continuous and repeated with the first data are the second data. By deleting all the second data and recording the number of the second data entries, the compressed target data “A3B4C3” can be obtained.

[0057] S207 stores the compressed target data in the target storage space.

[0058] Specifically, the data storage device stores the compressed target data in the target storage space. It can be understood that when the target storage space is full, even if there is still free storage space in the total storage space or ECU EMMC, the data storage device will not save data generated after the target date until the target date changes, at which point the data storage device will update the data in the total storage space.

[0059] In this embodiment, the historical number of days is compared with the total number of days in the storage period. If the historical number of days is greater than or equal to the total number of days, the stored data before the total number of days is deleted. If the historical number of days is less than the total number of days, the maximum storage space corresponding to each historical date in the historical number of days and the maximum storage space corresponding to the target date are calculated based on a preset ratio and the historical number of days corresponding to the stored data in the total storage space. The stored data in the total storage space is deleted to obtain the target storage space that satisfies the maximum storage space corresponding to the target date. The target data generated within the target date is compressed to obtain the first data in the target data. The first data is any data in the target data that is different from the previous data. Then, the second data that is the same as the first data and is continuous is obtained in the target data, and the number of the second data is obtained. All second data that is the same as the first data is deleted, and the number of the second data is recorded after the first data. This reduces the damage and loss of the target data in the compression process, improves the accuracy and security of the compression process, and stores the compressed target data in the target storage space. By pre-setting the ratio and the number of days corresponding to the data stored in the storage space, the maximum planned storage space for each day can be planned. This saves storage space while preserving data from multiple days, avoiding data loss, and thus achieving the goal of balancing the time and space of data storage.

[0060] The following will be combined with the appendix Figure 7 This application provides a detailed description of the data storage device provided in the embodiments. It should be noted that the appendix... Figure 7 The data storage device in the present application is used to execute the data storage device in the present application. Figure 2 and Figure 3 The methods shown in the embodiments are for illustrative purposes only, illustrating the parts relevant to the embodiments of this application. For specific technical details not disclosed, please refer to this application. Figure 2 and Figure 3 The example shown.

[0061] Please see Figure 7 This illustration shows a schematic diagram of a data storage device provided in an exemplary embodiment of this application. The data storage device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a storage space calculation module 11, a data deletion module 12, and a data storage module 13.

[0062] Storage space calculation module 11 is used to calculate the maximum storage space corresponding to the target date based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space;

[0063] Optionally, the storage space calculation module 11 is specifically used to obtain the historical number of days corresponding to the stored data in the total storage space;

[0064] If the number of historical days is less than the total number of days in the storage period, then the maximum storage space corresponding to each historical date in the number of historical days and the maximum storage space corresponding to the target date are calculated based on a preset ratio.

[0065] Optionally, the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date is the preset ratio, wherein the first date is any historical date in the historical days, and the second date is the day after the first date.

[0066] Optionally, the storage space calculation module 11 is further configured to delete the stored data in the total storage space before the total number of days if the historical number of days is greater than or equal to the total number of days in the storage period.

[0067] Data deletion module 12 is used to delete stored data in the total storage space to obtain target storage space that meets the maximum storage space corresponding to the target date;

[0068] Optionally, the data deletion module 12 is specifically used to delete the historical data corresponding to the third date in the total storage space, so that the deleted historical data meets the maximum storage space corresponding to the third date, where the third date is any historical date in the historical days.

[0069] The data storage module 13 is used to store the target data generated within the target date in the target storage space.

[0070] Optionally, the data storage module 13 is specifically used to acquire target data generated within the target date and to compress the target data;

[0071] The compressed target data is stored in the target storage space.

[0072] Optionally, the data storage module 13 is specifically used to obtain the first data in the target data, wherein the first data is any data in the target data that is different from the previous data;

[0073] Obtain second data that is identical and continuous with the first data from the target data, and obtain the number of entries of the second data;

[0074] Delete the second data and record the number of entries after the first data.

[0075] In this embodiment, the number of historical days is compared with the total number of days in the storage period. If the number of historical days is greater than or equal to the total number of days, the stored data before the total number of days is deleted. If the number of historical days is less than the total number of days, the maximum storage space corresponding to each historical date in the historical days and the maximum storage space corresponding to the target date are calculated based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space. The stored data in the total storage space is deleted to obtain the target storage space that meets the maximum storage space corresponding to the target date. The target data generated within the target date is compressed to obtain the first data in the target data. The first data is any data in the target data that is different from the previous data. Then, the second data that is the same as the first data and is continuous is obtained in the target data, and the number of the second data is obtained. All second data that is the same as the first data is deleted, and the number of the second data is recorded after the first data. This reduces the damage and loss of the target data in the compression process, improves the accuracy and security of the compression process, and stores the compressed target data in the target storage space. By pre-setting the ratio and the number of days corresponding to the data stored in the storage space, the maximum planned storage space for each day can be planned. This saves storage space while preserving data from multiple days, avoiding data loss, and thus achieving the goal of balancing the time and space of data storage.

[0076] It should be noted that the data storage device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the data storage method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data storage device and the data storage method embodiments provided in the above embodiments belong to the same concept, and the implementation process can be found in the method embodiments, which will not be repeated here.

[0077] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0078] This application also provides a computer storage medium that can store multiple instructions, which are adapted to be loaded and executed by a processor as described above. Figures 1-6 The data storage method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-6 The specific details of the illustrated embodiments will not be elaborated here.

[0079] This application also provides a computer program product storing at least one instruction, which is loaded and executed by the processor as described above. Figures 1-6 The data storage method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-6The specific details of the illustrated embodiments will not be elaborated here.

[0080] Please refer to Figure 8 This diagram illustrates a structural block diagram of an electronic device provided in an exemplary embodiment of this application. The electronic device in this application may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected via the bus 150.

[0081] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the electronic device using various interfaces and lines, and executes various functions of terminal 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user page, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.

[0082] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the various method embodiments described above, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems.

[0083] The memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly.

[0084] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.

[0085] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 can be a touch display screen.

[0086] The touch display screen can be designed as a full-screen, curved screen, or irregularly shaped screen. It can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; however, this application does not limit the specific design in this regard.

[0087] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the electronic device may also include radio frequency circuits, input units, sensors, audio circuits, Wireless Fidelity (WiFi) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.

[0088] exist Figure 8 In the illustrated electronic device, the processor 110 can be used to call the data storage application stored in the memory 120 and specifically perform the following operations:

[0089] Based on the preset ratio and the number of historical days corresponding to the data stored in the total storage space, calculate the maximum storage space corresponding to the target date;

[0090] The stored data in the total storage space is deleted to obtain a target storage space that meets the maximum storage space corresponding to the target date;

[0091] The target data generated within the target date is stored in the target storage space.

[0092] In one embodiment, when the processor 110 calculates the maximum storage space corresponding to a target date based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space, it specifically performs the following operations:

[0093] Get the historical number of days corresponding to the stored data in the total storage space;

[0094] If the number of historical days is less than the total number of days in the storage period, then the maximum storage space corresponding to each historical date in the number of historical days and the maximum storage space corresponding to the target date are calculated based on a preset ratio.

[0095] In one embodiment, the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date is the preset ratio, wherein the first date is any historical date in the historical days, and the second date is the day after the first date.

[0096] In one embodiment, before the processor 110 performs the operation of calculating the maximum storage space corresponding to each historical date in the historical days and the maximum storage space corresponding to the target date based on a preset ratio if the number of historical days is less than the total number of days in the storage cycle, the processor 110 also performs the following operations:

[0097] If the number of historical days is greater than or equal to the total number of days in the storage period, then the stored data before the total number of days in the total storage space will be deleted.

[0098] In one embodiment, when the processor 110 performs the deletion process on the stored data in the total storage space to obtain the target storage space that satisfies the maximum storage space corresponding to the target date, it specifically performs the following operations:

[0099] The historical data corresponding to the third date in the total storage space is deleted, so that the deleted historical data meets the maximum storage space corresponding to the third date, where the third date is any historical date in the historical days.

[0100] In one embodiment, when the processor 110 executes the operation of storing target data generated within the target date in the target storage space, it specifically performs the following operations:

[0101] Obtain the target data generated within the target date, and compress the target data;

[0102] The compressed target data is stored in the target storage space.

[0103] In one embodiment, when the processor 110 performs compression processing on the target data, it specifically performs the following operations:

[0104] Obtain the first data from the target data, wherein the first data is any data in the target data that is different from the previous data;

[0105] Obtain second data that is identical and continuous with the first data from the target data, and obtain the number of entries of the second data;

[0106] Delete the second data and record the number of entries after the first data.

[0107] In this embodiment, the number of historical days is compared with the total number of days in the storage period. If the number of historical days is greater than or equal to the total number of days, the stored data before the total number of days is deleted. If the number of historical days is less than the total number of days, the maximum storage space corresponding to each historical date in the historical days and the maximum storage space corresponding to the target date are calculated based on a preset ratio and the number of historical days corresponding to the stored data in the total storage space. The stored data in the total storage space is deleted to obtain the target storage space that meets the maximum storage space corresponding to the target date. The target data generated within the target date is compressed to obtain the first data in the target data. The first data is any data in the target data that is different from the previous data. Then, the second data that is the same as the first data and is continuous is obtained in the target data, and the number of the second data is obtained. All second data that is the same as the first data is deleted, and the number of the second data is recorded after the first data. This reduces the damage and loss of the target data in the compression process, improves the accuracy and security of the compression process, and stores the compressed target data in the target storage space. By pre-setting the ratio and the number of days corresponding to the data stored in the storage space, the maximum planned storage space for each day can be planned. This saves storage space while preserving data from multiple days, avoiding data loss, and thus achieving the goal of balancing the time and space of data storage.

[0108] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0109] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A data storage method, characterized in that, The method includes: Based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space, the maximum storage space corresponding to the target date is calculated. The preset ratio is the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date. The first date is any historical date in the number of historical days, and the second date is the day after the first date. The stored data in the total storage space is deleted to obtain a target storage space that meets the maximum storage space corresponding to the target date; The target data generated within the target date is stored in the target storage space.

2. The method according to claim 1, characterized in that, The calculation of the maximum storage space corresponding to the target date based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space includes: Get the historical number of days corresponding to the stored data in the total storage space; If the number of historical days is less than the total number of days in the storage period, then the maximum storage space corresponding to each historical date in the number of historical days and the maximum storage space corresponding to the target date are calculated based on a preset ratio.

3. The method according to claim 2, characterized in that, The ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date is the preset ratio, wherein the first date is any historical date in the historical days, and the second date is the day after the first date.

4. The method according to claim 2, characterized in that, Before calculating the maximum storage space corresponding to each historical date in the historical days and the maximum storage space corresponding to the target date based on a preset ratio if the historical days are less than the total number of days in the storage period, the method further includes: If the number of historical days is greater than or equal to the total number of days in the storage period, then the stored data before the total number of days in the total storage space will be deleted.

5. The method according to claim 2, characterized in that, The process of deleting stored data in the total storage space to obtain a target storage space that meets the maximum storage space requirement corresponding to the target date includes: The historical data corresponding to the third date in the total storage space is deleted, so that the deleted historical data meets the maximum storage space corresponding to the third date, where the third date is any historical date in the historical days.

6. The method according to claim 1, characterized in that, The step of storing the target data generated within the target date in the target storage space includes: Obtain the target data generated within the target date, and compress the target data; The compressed target data is stored in the target storage space.

7. The method according to claim 6, characterized in that, The compression process for the target data includes: Obtain the first data from the target data, wherein the first data is any data in the target data that is different from the previous data; Obtain second data that is identical and continuous with the first data from the target data, and obtain the number of entries of the second data; Delete the second data and record the number of entries after the first data.

8. A data storage device, characterized in that, The device includes: The storage space calculation module is used to calculate the maximum storage space corresponding to a target date based on a preset ratio and the number of historical days corresponding to the data stored in the total storage space. The preset ratio is the ratio between the maximum storage space corresponding to the second date and the maximum storage space corresponding to the first date. The first date is any historical date in the number of historical days, and the second date is the day after the first date. The data deletion module is used to delete stored data in the total storage space to obtain the target storage space that meets the maximum storage space corresponding to the target date; The data storage module is used to store the target data generated within the target date in the target storage space.

9. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions, which are adapted to be loaded by a processor and executed as method steps as claimed in any one of claims 1 to 7.

10. A car, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed the method steps as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Storage optimization method and system of memory

    CN106155595A

  • Storage space prompting method and device

    CN112214376A