Data storage method and related device

By moving the index number to be deleted to the end of the storage address index table in the Flash memory, the storage address index table structure is optimized, which solves the problem of low query efficiency in the existing technology, improves the efficiency of data storage and query, and enhances the user experience.

CN115268794BActive Publication Date: 2025-09-16SHENZHEN ELECTRICAL APPLIANCES CO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210938490.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-05
Publication Date
2025-09-16
Estimated Expiration
2042-08-05

AI Technical Summary

Technical Problem

In existing Flash memories, the data calibration method uses a one-to-one mapping method, which leads to low query efficiency, affects the efficiency of deletion and storage, and reduces the user experience.

Method used

By moving the index number of the storage data to be deleted to the last digit of the storage address index table, the corresponding partition is located at the end, thereby improving the query efficiency and optimizing the structure of the storage address index table.

Benefits of technology

It improves the efficiency of data query and storage, saves retrieval time, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115268794B_ABST
    Figure CN115268794B_ABST
Patent Text Reader

Abstract

The present application provides a data storage method and related device, including: obtaining a storage address index table containing the first address of a corresponding storage area based on the data type of the first data information obtained; if the storage address index table contains at least one first index number corresponding to the stored data, and there is stored data to be deleted, obtaining the second index number of the stored data to be deleted, moving the first index number arranged after the second index number to the front of the second index number, determining a second partition based on the second index number and the first address, deleting the stored data in the second partition, processing the first data information according to a preset processing method to obtain the first stored data, and storing the first stored data in the second partition. In the present application, by adjusting the order of the index numbers in the storage address index table, the index number corresponding to the deleted partition is placed at the last position, which facilitates quick search and improves the efficiency of writing new stored data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data storage technology, and specifically relates to a data storage method and related devices. Background Art

[0002] Flash memory is a type of memory device and a non-volatile memory. This type of memory has significant advantages such as high integration, fast reading speed, single power supply, and many reprogramming times. It can retain data for a long time even without current supply.

[0003] However, existing data calibration methods in Flash memory mostly use a one-to-one mapping method to calibrate data. Flash resources are relatively abundant, and this one-to-one mapping method leads to a large number of calibration results, resulting in low query efficiency, which in turn reduces the efficiency of deletion and storage, affecting the user experience. Summary of the Invention

[0004] The present application provides a data storage method and related devices, which move the index number of the storage data to be deleted in the storage address index table to the last bit of the storage address index table, so that the index number corresponding to the partition of the storage data to be deleted is located at the end of the storage address index table, which is convenient for query and improves the efficiency of writing new storage data.

[0005] In a first aspect, the present application provides a data storage method, comprising:

[0006] Acquire first data information and determine the data type of the first data information;

[0007] Obtaining a storage address index table according to the data type, wherein the storage address index table can accommodate N index numbers and includes the first address of the corresponding storage area;

[0008] determining whether the storage address index table contains at least one first index number corresponding to stored data, the stored data being data obtained by processing second data information according to a preset processing method, the stored data sequentially obtaining corresponding first index numbers according to an order in which the stored data enters the terminal device, the stored data being stored in a first partition determined according to the first index number and the first address, the first index numbers being arranged sequentially according to an order stored in the storage address index table, and the first partition being a storage area within the storage area;

[0009] If yes, determine whether there is any stored data to be deleted;

[0010] If so, obtaining the second index number of the stored data to be deleted;

[0011] Move the first index number arranged after the second index number to before the second index number to obtain an updated storage address index table;

[0012] determining the second partition according to the second index number and the first address, and deleting the stored data in the second partition;

[0013] Processing the first data information according to the preset processing method to obtain first stored data;

[0014] The first stored data is stored in the second partition corresponding to the second index number.

[0015] In a second aspect, the present application provides a data storage device, comprising:

[0016] a first acquiring unit, configured to acquire first data information and determine a data type of the first data information;

[0017] a second acquiring unit, configured to acquire a storage address index table according to the data type, wherein the storage address index table can accommodate N index numbers and includes a first address of a corresponding storage area;

[0018] a first determining unit, configured to determine whether the storage address index table contains at least one first index number corresponding to stored data, the stored data being data obtained by processing second data information according to a preset processing method, the stored data sequentially obtaining corresponding first index numbers according to an order in which the stored data enters the terminal device, the stored data being stored in a first partition determined according to the first index number and the first address, the first index numbers being arranged sequentially according to an order in which they are stored in the storage address index table, the first partition being a storage area within the storage area;

[0019] a second determining unit, configured to determine whether there is stored data to be deleted;

[0020] A third acquiring unit, configured to acquire a second index number of the stored data to be deleted;

[0021] a moving unit, configured to move the first index number arranged after the second index number to before the second index number, to obtain an updated storage address index table;

[0022] a determining unit, configured to determine the second partition according to the second index number and the first address, and delete the stored data in the second partition;

[0023] a processing unit, configured to process the first data information according to the preset processing method to obtain first stored data;

[0024] A storage unit is used to store the first stored data in the second partition corresponding to the second index number.

[0025] In a third aspect, the present application provides an electronic device, comprising:

[0026] one or more processors;

[0027] One or more memories for storing programs,

[0028] The one or more memories and the program are configured so that the one or more processors control the electronic device to execute instructions such as the steps in any method of the first aspect or the second aspect of the embodiments of the present application.

[0029] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in any method of the first aspect or the second aspect of the embodiment of the present application.

[0030] In a fifth aspect, the present application provides a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect or the second aspect of the embodiments of the present application. The computer program can be a software installation package.

[0031] It can be seen that in the embodiment of the present application, after obtaining the first data information, the data type of the first data information is determined to obtain the storage address index table corresponding to the data information of the data type, so as to facilitate the storage of index numbers of different types of data information in separate tables, thereby improving the efficiency of the query. The obtained storage address index table contains at least one first index number corresponding to the stored data, and there is stored data to be deleted, then the second index number of the stored data to be deleted is obtained. The first index number arranged after the second index number is moved to before the second index number, an updated storage address index table is obtained, the second partition is determined according to the second index number and the first address, and the stored data in the second partition is deleted, and the first data information is processed and stored in the second partition. By moving the index number corresponding to the stored data to be deleted in the storage address index table to the last digit of the storage address index table and deleting the stored data in the partition corresponding to the index number, the index number corresponding to the partition is located at the end of the index table. When new storage data is to be written, the blank partition can be quickly queried without traversing the storage address index table, thereby improving the query efficiency and thus improving the storage efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only 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.

[0033] Figure 1 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0034] Figure 2 This is a flow chart of a data storage method provided by an embodiment of the present application;

[0035] Figure 3 This is a schematic diagram of the structure of a missed call index table provided in an embodiment of the present application;

[0036] Figure 4 This is a schematic diagram of the sequential change of index numbers in the storage address index table provided by an embodiment of the present application;

[0037] Figure 5 is a schematic diagram of the structure of the first storage data provided in an embodiment of the present application;

[0038] Figure 6 This is a schematic diagram of connecting different index tables corresponding to different data types provided in an embodiment of the present application;

[0039] Figure 7 This is a block diagram of the functional units of a data storage device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0041] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0042] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0043] See also Figure 1 , Figure 1 The figure is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. As shown in the figure, the terminal device includes a single-chip microcomputer 10, which includes a processor 120 and a memory 130. The terminal device also includes a communication module 140 and one or more programs 131. The single-chip microcomputer 10 is connected to the communication module 140 via an internal communication bus.

[0044] The one or more programs 131 are stored in the memory 130 and configured to be executed by the processor 120 . The one or more programs 131 include instructions for executing any step in the following method embodiment.

[0045] The processor 120 may be, for example, a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, units, and circuits described in conjunction with the disclosure of this application. The processor 120 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication unit may be a communication module 140, a transceiver, a transceiver circuit, and the like.

[0046] The memory 130 is a non-volatile memory, which may be a Flash memory. By way of example but not limitation, the non-volatile memory may also be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. In this solution, the memory 130 is described as a Flash memory as an example. It is understandable that the terminal device in the embodiment of the present application may also include other types of memories for storing one or more programs 131, which are not specifically limited here.

[0047] The terminal device may be a mobile phone, a landline phone, a tablet computer, a laptop computer, a desktop computer, a wearable device, a head-mounted device, a vehicle-mounted terminal, or other intelligent terminal. The specific type of terminal device is not limited here. In the embodiment of the present application, the terminal device is an example of a landline phone.

[0048] See also Figure 2 , Figure 2 This is a flow chart of a data storage method provided by an embodiment of the present application. Figure 2 The data storage method used in the terminal device involved in the embodiment of the present application is described in detail. Figure 2 As shown, a data storage method includes:

[0049] Step 210: Acquire first data information and determine the data type of the first data information.

[0050] After receiving the first data information to be stored, the terminal device determines the data type of the first data information. For example, if the terminal device is a landline telephone, and the data information of the received communication records is pre-classified into three types, namely, received call data information, missed call data information, and dialed call data information. The data type of the data information is determined based on the operation of the landline user. For example: after the terminal device receives a communication request sent by another communication device, the user does not receive the communication request, so the data type of the acquired communication record data information is missed call data information. It is understandable that the data type setting can be set according to actual needs and is not limited here.

[0051] Step 220: Obtain a storage address index table according to the data type. The storage address index table can accommodate N index numbers, and the storage address index table includes the first address of the corresponding storage area.

[0052] Among them, the terminal device obtains the corresponding storage address index table according to the acquired data type, and the storage address index table can accommodate N index numbers. It is understandable that the number of index numbers that the storage address index table can accommodate can be set according to actual needs and is not limited here. For example, refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a missed call index table provided by an embodiment of the present application. If the terminal device is a fixed phone, and the data type of the first data information is determined to be missed call data information, then the following is obtained: Figure 3 The missed call index table shown includes a stored flag, a number N, an index number, and the first address of the storage area. The number N represents the number of index numbers that can be stored. The missed call index table is configured to accommodate 20 index numbers, or, depending on actual needs, 10 index numbers. The specific number of index numbers that can be accommodated is not limited here.

[0053] Step 230: Determine whether the storage address index table contains at least one first index number corresponding to stored data. The stored data is data obtained by processing the second data information according to a preset processing method. The stored data sequentially obtains corresponding first index numbers based on the order in which it enters the terminal device. The stored data is stored in a first partition determined by the first index number and the first address. The first index numbers are arranged sequentially based on the order in which they are stored in the storage address index table. The first partition is a storage area within the storage area.

[0054] Here, it is necessary to determine whether the storage address index table contains at least one first index number corresponding to the stored data. Specifically, the second data information is of the same data type as the first data information and is stored in the terminal device before the first data information. If the storage address index table does not contain the first index number, then the storage area corresponding to the storage address index table has no data information stored. The terminal device can directly obtain the index number of the first data information, store it in the storage address index table, and then process the first data information and store it in the partition of the storage area corresponding to the index number.

[0055] Step 240: Determine whether there is stored data to be deleted.

[0056] Among them, if the first index number exists in the storage address index table, it is necessary to determine whether there is storage data to be deleted. If there is no storage data to be deleted, and the index numbers in the storage address index table are not full, the index numbers can be obtained according to the order in which the first data information enters the terminal device, and the index numbers are stored in the storage address index table in sequence. After processing, the first data information is stored in the partition of the storage area determined according to the index number and the first address. Alternatively, if there is no storage data to be deleted and the index numbers in the storage address index table are full, the index number in the first position in the storage address index table is moved to the last position, and the storage data in the storage area corresponding to the index number is deleted, and the first data information is stored in the partition of the storage area according to the processing.

[0057] Step 250: Obtain the second index number of the stored data to be deleted.

[0058] If it is determined that the storage address index table contains storage data to be deleted, the second index number of the storage data to be deleted is obtained.

[0059] Step 260: Move the first index number arranged after the second index number to before the second index number to obtain an updated storage address index table.

[0060] The first index number that is arranged after the second index number in the storage address index table is moved to before the second index number to obtain an updated storage address index table.

[0061] Step 270: Determine the second partition according to the second index number and the first address, and delete the stored data in the second partition.

[0062] After obtaining the second index number of the stored data to be deleted, the second partition storing the stored data is determined based on the second index number and the first address. Specifically, the storage area is determined based on the first address, and the offset between the first address of the second partition and the first address of the storage area is determined based on the second index number, thereby determining the second partition corresponding to the second index number.

[0063] Step 280: Process the first data information according to the preset processing method to obtain first stored data.

[0064] Step 290: Store the first stored data into the second partition corresponding to the second index number.

[0065] Among them, the first data information is processed according to a preset processing method, and after obtaining the first storage data, the index number corresponding to the first storage data is obtained, which is the second index number, and the second partition is determined according to the second index number and the first address, and the first storage data is stored in the second partition.

[0066] As can be seen, in this example, before storing data information, the data type of the data information to be stored is determined, and the corresponding storage address index table is obtained. The index numbers of different types of data information are stored in separate tables to improve retrieval efficiency. Furthermore, if there is stored data to be deleted, the index number corresponding to the deleted data is moved to the end of the storage address index table. When new data to be stored is stored, the retrieval number corresponding to the storable partition can be directly obtained from the end of the storage address index table, saving retrieval time and improving storage efficiency.

[0067] In one possible example, determining whether there is stored data to be deleted includes: determining whether a user's deletion instruction is received, the deletion instruction includes the user's query operation, and the deletion instruction is used to instruct the deletion of the stored data corresponding to the user's query operation; if received, determining that there is stored data to be deleted; if not received, determining that there is no stored data to be deleted.

[0068] In a specific example, if the terminal device receives a deletion instruction from the user, it is determined that there is stored data to be deleted. If the terminal device does not receive the stored data, it is determined that there is no stored data to be deleted.

[0069] It can be seen that in this example, the deletion operation is performed according to the user's deletion instruction, which is more accurate and improves the user experience.

[0070] In a possible example, obtaining the second index number of the stored data to be deleted includes: counting the first quantity value of the first index number in the storage address index table; obtaining the value of the query sequence number of the stored data that the user is currently viewing based on the user's query operation, and the query sequence number is used to represent the display order of the stored data; calculating the difference between the first value and the value of the query sequence number; obtaining the index number at the position in the storage address index table whose arrangement order is the difference, and obtaining the second index number of the stored data to be deleted.

[0071] In an embodiment of the present application, the index numbers in the storage address index table are arranged according to the order in which they are stored in the storage address index table. When a user queries, the terminal device presents the storage data in the partition corresponding to the index number to the user in sequence from the index number at the end of the storage address index table to the index number at the beginning of the storage address index table, thereby quickly providing the user with the latest storage data. If the terminal device receives a delete instruction from the user, the delete instruction includes the user's query operation. After obtaining the user's query operation, since the index numbers in the storage address index table are arranged in the order in which they are stored, the query sequence number of the storage data that the user is currently viewing can be determined based on the query operation. The query sequence number is a sequence number that increases in sequence from the index number at the end of the storage address index table to the index number at the beginning of the storage address index table. Based on this value and the first value of the first index number already stored in the storage address index table, the index number corresponding to the storage data that the user is currently viewing can be determined. Although the storage data obtains index numbers in sequence according to the order in which they are stored, the storage data corresponding to the index number may be deleted by the user during use, so the order of the index numbers in the storage address index table will be disrupted. For example: the storage address index table stores a total of 4 first index numbers, namely index number a, index number c, index number d and index number f, and they are stored in the storage address index table in sequence. The terminal device obtains that the user clicks the button to view the next item three times in total, and determines that the query sequence number of the storage data that the user is viewing is 3, so the second value is 4-3+1=2, and the index number at position 2 in the storage address index table is index number c.

[0072] For details, please refer to Figure 4 , Figure 4 This is a schematic diagram of the sequential change of index numbers in the storage address index table provided by an embodiment of the present application. After determining that the second index number of the storage data to be deleted is index number c, index number c is moved to after index number f. It is understood that the display method of the terminal device can be set according to actual needs, for example, the index number at the beginning and end of the storage address index table can be displayed, and the specific details are not limited here.

[0073] It can be seen that in this example, the index number of the stored data to be deleted can be determined based on the user's query operation, thereby improving the accuracy of the determined index number of the stored data to be deleted and avoiding the inability to find the index number of the stored data to be deleted due to the disordered order of the index numbers.

[0074] In one possible example, determining whether there is storage data to be deleted includes: determining whether the value of the number of index numbers in the storage address index table is N; if so, determining that there is storage data to be deleted; if not, determining that there is no storage data to be deleted.

[0075] In a specific example, if the storage address index table is full, it is determined that there is storage data to be deleted. For example, the storage address index table can accommodate 20 index numbers. After obtaining the first data information, it is detected that the storage address index table is full of 20 index numbers, and the storage data to be deleted is determined.

[0076] It can be seen that in this example, by detecting whether the storage address index table is full, it is determined whether to delete the stored data to make storage space for storing new data, automatically and reasonably plan the deletion and storage of data, and improve the user experience.

[0077] In a possible example, obtaining the second index number of the storage data to be deleted includes: determining a third index number ranked first in the storage address index table, the third index number being the second index number of the storage data to be deleted.

[0078] In a specific example, after determining that the storage space is full, the index number ranked first in the storage address index table is determined to be the third index number, which is the second index number of the stored data to be deleted. After determining the second index number, the determined second index number is moved to the last position in the storage address index table, and the stored data in the partition of the storage area corresponding to the second index number is deleted to facilitate the writing of new stored data.

[0079] It can be seen that in this example, the index number ranked first in the storage address index table is deleted first, and while the redundant information is cleared in time, space is made for the storage of new storage data, and storage resources are used rationally. The index number corresponding to the storage data to be deleted is moved to the end of the storage address index table, which facilitates the storage of new storage data, saves retrieval time, and improves storage efficiency.

[0080] In a possible example, the first data information is processed according to the preset processing method to obtain the first stored data, including: obtaining time information and at least one key data in the first data information; obtaining the number of bytes in the at least one key data; and creating the first stored data based on the time information, the at least one key data information and the number of bytes.

[0081] In a specific example, after obtaining the first data information, the time information, at least one key data information and the number of bytes of the key information are extracted from the first data information, and a check value is set according to the number of bytes. The first storage data is created based on the time information, at least one key data information and the check value. For example, if the terminal device is a fixed device and the first data information is a missed call data information, please refer to Figure 5 , Figure 5This is a structural diagram of the first storage data provided by the embodiment of the present application. Extract the missed call data information of the fixed device, extract the time information and key information in the missed call data information, the key information includes number 1, number 2...number n, extract the total number of bytes of the number in the key information, count the number of odd-numbered bytes in the total number of bytes, and the number of odd-numbered bytes is the check value. Figure 5 As shown, the first stored data includes the year, month, day, hour, minute, number 1, number 2, ... number n, and a check value, wherein the first stored data also includes a read flag and a number T, the number T being used to count the total number of bytes of the first stored data to prevent the stored data from exceeding the partition capacity. For example, a Flash block is evenly divided into multiple partitions, each with the same capacity, to facilitate positioning and improve positioning accuracy. For example, each 512-byte Flash block is evenly divided into 8 partitions, which can store 8 pieces of stored data. If a ninth piece of stored data appears, it is stored in the partition of the next Flash block. Each partition information occupies 64 bytes, so the size of each stored data cannot exceed 64 bytes. It is understandable that the specific content of the first stored data can be increased or decreased according to actual needs. For example, if the first data information is received call data information, the read flag can be omitted. The specific content of the first stored data is not limited here.

[0082] It can be seen that in this example, by extracting time information and key information from the data information, storage data is created, so that the format of the data stored in the storage area is consistent, which is convenient for searching, improves the efficiency of retrieval, and facilitates reading the stored data content.

[0083] In a possible example, after storing the first storage data in the second partition corresponding to the second index number, the method also includes: obtaining a backup index table; copying the first information in the updated storage address index table; obtaining the second storage data in the storage area corresponding to the updated storage address index table; obtaining the checksum and key data in the check byte in the second storage data; calculating the checksum of the key data; comparing whether the checksum of the key data is the same as the checksum in the check byte; if they are the same, erasing the data in the backup index table and writing the first information into the backup index table.

[0084] In a specific example, after the acquired first storage data is stored in the second partition, the first information in the updated storage address index table is acquired, and the first information includes but is not limited to the index number and the order of the index numbers, the partition in the storage area corresponding to each index number, the first address of the storage area, and other information. In addition, the second storage data in the storage area corresponding to the updated storage address index table is acquired, the key data in the second storage data and the checksum in the check byte are extracted, the checksum in the key data is calculated, and the checksum in the key data is compared with the checksum in the check byte to determine whether they are the same, thereby determining whether the storage data is correct. If they are the same, the first information is written into the backup index table, so that if the storage address index table is lost or deleted by mistake, it can be restored through the backup index table, or the backup index table can be directly used for indexing.

[0085] It can be seen that in this example, the backup index table is updated in a timely manner, and the index number is prevented from being lost through backup, thereby improving the security of storage.

[0086] In a possible example, if it is retrieved that the index number stored in the storage address index table has reached the maximum capacity and a deletion instruction from the user is received at the same time, the deletion instruction from the user is executed first to improve the user experience.

[0087] In one possible example, when a terminal device determines the stored data to be displayed using the index number and the first address and displays it, the terminal device reads a first check value and key information in the stored data, calculates a second check value in the key information, and compares the first check value and the second check value to determine whether the stored data is correct. If they are not identical, the steps of obtaining the check value and comparing are repeated. If they are still different after a preset number of repetitions, the data is not displayed. This eliminates erroneous stored data and saves user time.

[0088] In a possible example, the addresses of the storage areas corresponding to the storage address index tables corresponding to different data types can be connected to reasonably utilize storage resources and facilitate search. For example, if the terminal device is a fixed phone, please refer to Figure 6 , Figure 6 This is a schematic diagram of the connection of different index tables corresponding to different data types provided in an embodiment of the present application. If the terminal device includes a missed call index table, a received call index table, and a dialed call index table, if the terminal device includes a missed call index table, the addresses between the received call index table and the dialed call index table are continuous, and each index table contains the first address of the corresponding storage area, it is convenient to quickly search for stored data and improve search efficiency.

[0089] In the embodiment of the present application, the data storage device can be divided into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. The division of units in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0090] In the case of dividing each functional unit into corresponding functional units, Figure 7 This is a block diagram of the functional units of a data storage device provided in an embodiment of the present application, including:

[0091] A first acquiring unit 710 is configured to acquire first data information and determine a data type of the first data information;

[0092] A second acquiring unit 720 is configured to acquire a storage address index table according to the data type, wherein the storage address index table can accommodate N index numbers and includes a first address of a corresponding storage area;

[0093] a first determining unit 730 configured to determine whether the storage address index table contains at least one first index number corresponding to stored data, the stored data being data obtained by processing second data information according to a preset processing method, the stored data sequentially obtaining corresponding first index numbers according to the order in which the stored data enters the terminal device, the stored data being stored in a first partition determined according to the first index number and the first address, the first index numbers being arranged sequentially according to the order in which they are stored in the storage address index table, and the first partition being a storage area within the storage area;

[0094] The second determining unit 740 is used to determine whether there is stored data to be deleted;

[0095] A third obtaining unit 750 is configured to obtain a second index number of the stored data to be deleted;

[0096] A moving unit 760 is configured to move the first index number arranged after the second index number to before the second index number to obtain an updated storage address index table;

[0097] a determining unit 770, configured to determine the second partition according to the second index number and the first address, and delete the stored data in the second partition;

[0098] The processing unit 780 is configured to process the first data information according to the preset processing method to obtain first stored data;

[0099] The storage unit 790 is configured to store the first stored data into the second partition corresponding to the second index number.

[0100] In a possible example, the second judgment unit 740 is further used to determine whether a deletion instruction from the user is received, the deletion instruction includes the user's query operation, and the deletion instruction is used to instruct the deletion of the stored data corresponding to the user's query operation; if received, it is determined that the stored data to be deleted exists; if not received, it is determined that the stored data to be deleted does not exist.

[0101] In a possible example, the third acquisition unit 750 is also used to count the first quantity value of the first index number in the storage address index table; and obtain the value of the query sequence number of the storage data that the user is currently looking up based on the user's query operation, and the query sequence number is used to represent the display order of the storage data; and calculate the difference between the first value and the value of the query sequence number; and add one to the difference to obtain a second value; and obtain the index number at the position in the storage address index table that is arranged in the order of the second value to obtain the second index number.

[0102] In a possible example, the second judgment unit 740 is further used to determine whether the value of the number of index numbers in the storage address index table is N; if so, it is determined that the storage data to be deleted exists; if not, it is determined that the storage data to be deleted does not exist.

[0103] In a possible example, the third obtaining unit 750 is further configured to determine a third index number that is ranked first in the storage address index table, where the third index number is the second index number of the storage data to be deleted.

[0104] In one possible example, the processing unit 780 is also used to obtain time information and at least one key data in the first data information; and obtain the number of bytes in the at least one key data; and create the first stored data based on the time information, the at least one key data information and the number of bytes.

[0105] In a possible example, the device also includes a fourth acquisition unit for acquiring a backup index table; and copying the first information in the updated storage address index table; and acquiring the second storage data in the storage area corresponding to the updated storage address index table; and acquiring the checksum and key data in the check byte in the second storage data; and calculating the checksum of the key data; and comparing whether the checksum of the key data is the same as the checksum in the check byte; and erasing the data in the backup index table and writing the first information into the backup index table.

[0106] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.

[0107] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.

[0108] An embodiment of the present application further provides a computer program product, which includes a computer program. The computer program is operable to enable a computer to execute part or all of the steps of any method described in the above method embodiments.

[0109] The computer program product may be a software installation package, and the computer includes an electronic device.

[0110] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0111] In the several embodiments provided in this application, it should be understood that the disclosed methods, devices, and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is merely a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical, or other forms.

[0112] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0113] 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.

[0114] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0115] In addition, the functional units in various embodiments of the present invention may be integrated into a single processing unit, each unit may be physically included separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or hardware plus software functional units.

[0116] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk, and other media that can store program code.

[0117] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application, and these improvements and modifications are also considered to be within the scope of protection of the present application.

Claims

1. A data storage method, applied to a terminal device, characterized in that: include: Acquire first data information and determine a data type of the first data information, where the data type of the first data information is one of received call data information, missed call data information, and dialed call data information; Obtaining a storage address index table according to the data type, wherein the storage address index table can accommodate N index numbers and includes the first address of the corresponding storage area; determining whether the storage address index table contains at least one first index number corresponding to stored data, the stored data being data obtained by processing second data information according to a preset processing method, the stored data sequentially obtaining corresponding first index numbers according to an order in which the stored data enters the terminal device, the stored data being stored in a first partition determined according to the first index number and the first address, the first index numbers being arranged sequentially according to an order in which they are stored in the storage address index table, the first partition being a storage area within the storage area, and the second data information being information of the same data type as the first data information and being stored in the terminal device before the first data information; If yes, determine whether there is any stored data to be deleted; If so, obtaining the second index number of the stored data to be deleted; Move the first index number arranged after the second index number to before the second index number to obtain an updated storage address index table; determining a second partition according to the second index number and the first address, and deleting the stored data in the second partition; Processing the first data information according to the preset processing method to obtain first stored data; The first stored data is stored in the second partition corresponding to the second index number.

2. The data storage method according to claim 1, wherein: The determining whether there is stored data to be deleted includes: Determining whether a deletion instruction from a user is received, the deletion instruction including the query operation of the user, the deletion instruction being used to instruct deletion of stored data corresponding to the query operation of the user; If received, determining that the stored data to be deleted exists; If not received, it is determined that the stored data to be deleted does not exist.

3. The data storage method according to claim 2, wherein: The obtaining the second index number of the stored data to be deleted includes: Counting a first quantity value of the first index number in the storage address index table; Acquiring, according to the query operation of the user, a value of a query sequence number of the stored data currently being viewed by the user, wherein the query sequence number is used to represent a display order of the stored data; Calculating a difference between the first quantity value and the query sequence number; Add one to the difference to obtain a second value; Obtain the index number of the position of the second value in the storage address index table to obtain the second index number.

4. The data storage method according to claim 1, wherein: The determining whether there is stored data to be deleted includes: Determine whether the value of the number of index numbers in the storage address index table is N; If so, determining that the stored data to be deleted exists; If not, it is determined that the stored data to be deleted does not exist.

5. The data storage method according to claim 4, characterized in that: The obtaining the second index number of the stored data to be deleted includes: Determine the third index number that is ranked first in the storage address index table, where the third index number is the second index number of the storage data to be deleted.

6. The data storage method according to claim 1, wherein: The processing of the first data information according to the preset processing method to obtain first stored data includes: Obtaining time information and at least one key data in the first data information; Obtaining the number of bytes in the at least one key data; The first storage data is created according to the time information, the at least one key data information and the byte quantity.

7. The data storage method according to claim 1, wherein: After storing the first stored data in the second partition corresponding to the second index number, the method further includes: Get the backup index table; copying the first information in the updated storage address index table; Acquire second storage data in the storage area corresponding to the updated storage address index table; Obtaining a checksum and key data in a check byte in the second stored data; Calculating a checksum of the key data; Comparing the checksum of the key data with the checksum in the check byte to see if they are the same; If they are the same, the data in the standby index table is erased, and the first information is written into the standby index table.

8. A data storage device, characterized in that include: a first acquiring unit, configured to acquire first data information and determine a data type of the first data information, where the data type of the first data information is one of received call data information, missed call data information, and dialed call data information; a second acquiring unit, configured to acquire a storage address index table according to the data type, wherein the storage address index table can accommodate N index numbers and includes a first address of a corresponding storage area; a first determining unit, configured to determine whether the storage address index table contains at least one first index number corresponding to stored data, the stored data being data obtained by processing second data information according to a preset processing method, the stored data sequentially obtaining corresponding first index numbers according to the order in which the stored data enter the terminal device, the stored data being stored in a first partition determined according to the first index number and the first address, the first index numbers being arranged sequentially according to the order in which they are stored in the storage address index table, the first partition being a storage area within the storage area, and the second data information being information of the same data type as the first data information and being stored in the terminal device before the first data information; a second determining unit, configured to determine whether there is stored data to be deleted; A third acquiring unit, configured to acquire a second index number of the stored data to be deleted; a moving unit, configured to move the first index number arranged after the second index number to before the second index number, to obtain an updated storage address index table; a determining unit, configured to determine a second partition according to the second index number and the first address, and delete the stored data in the second partition; a processing unit, configured to process the first data information according to the preset processing method to obtain first stored data; A storage unit is used to store the first stored data in the second partition corresponding to the second index number.

9. An electronic device, characterized in that: include: A processor and a memory, the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor executes the computer instructions, the electronic device executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Hierarchical management method and system for solid-state storage based on failure probability

    CN107102954A

  • Object storage life cycle management method, management device, equipment and medium

    CN114489511A