Data storage method, device and equipment

By dividing data into independent blocks according to types and dividing corresponding areas in the storage medium, the problem of low data modification efficiency in the existing technology is solved, and higher data security and management efficiency are achieved.

CN113672162BActive Publication Date: 2024-09-27HANGZHOU EZVIZ SOFTWARE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202010408595.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-14
Publication Date
2024-09-27
Estimated Expiration
2040-05-14

AI Technical Summary

Technical Problem

Existing data storage methods are inefficient when modifying user data, and because the erase operation unit of Flash storage media is a sector, entire sectors need to be erased when some data is modified, which wastes resources and reduces data management efficiency.

Method used

By dividing the target data into independent data blocks according to their types, and dividing corresponding independent storage areas in the storage medium, these data blocks are stored and managed separately to facilitate separate operations and avoid impact on other data.

Benefits of technology

It reduces the cost of data modification, improves data security and management efficiency, increases storage space utilization, and simplifies data management and operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113672162B
    Figure CN113672162B
Patent Text Reader

Abstract

One or more embodiments of this specification disclose a data storage method, device and apparatus. The method includes: in response to a data storage request for target data issued by a first user, obtaining the target data; dividing the target data into multiple data blocks according to the first data type of the target data; the first data types corresponding to the data blocks are different; determining the first storage area corresponding to each data block in the storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; the first storage areas are independent of each other; and storing each data block in the corresponding first storage area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data storage technology, and in particular to a data storage method, device and equipment. Background Art

[0002] Embedded products are generally provided with a storage medium for storing information such as system data and user data. For example, a flash memory (Flash for short) is selected as the storage medium.

[0003] Taking the storage of user data as an example, the storage method is centralized, that is, all data information of the same user is stored together. Modifying part of the data will cause changes in all the data, resulting in inconvenience in data modification and management. Taking Flash as an example, since Flash needs to perform an erase operation before writing data, and the minimum unit of the erase operation is a sector, the data of at least one sector is erased. If only a few bytes of data in the user data need to be modified, the data of the entire sector must be erased and then rewritten, which is inconvenient to modify the data. Therefore, the existing data storage method has low efficiency in data modification and management. Summary of the invention

[0004] The purpose of one or more embodiments of the present specification is to provide a data storage method, apparatus and device to solve the problem of low efficiency of data modification and management in existing data storage methods.

[0005] To solve the above technical problems, one or more embodiments of this specification are implemented as follows:

[0006] On the one hand, one or more embodiments of the present specification provide a data storage method, comprising: in response to a data storage request for target data issued by a first user, obtaining the target data; dividing the target data into multiple data blocks according to a first data type of the target data; each of the data blocks corresponds to a different first data type; determining a first storage area corresponding to each of the data blocks in a storage medium; dividing the first storage area based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other; and storing each of the data blocks in the corresponding first storage area.

[0007] On the other hand, one or more embodiments of the present specification provide a data storage device, comprising: a data acquisition module, used to acquire the target data in response to a data storage request for the target data issued by a first user; a data block division module, used to divide the target data into multiple data blocks according to a first data type of the target data; the first data types corresponding to each of the data blocks are different; a storage area determination module, used to determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; the first storage areas are independent of each other; a data storage module, used to store each of the data blocks in the corresponding first storage area.

[0008] On another aspect, one or more embodiments of the present specification provide a data storage device, comprising: a processor; and a memory arranged to store computer-executable instructions, wherein the executable instructions, when executed, cause the processor to: obtain the target data in response to a data storage request for the target data issued by a first user; divide the target data into multiple data blocks according to a first data type of the target data; each of the data blocks corresponds to a different first data type; determine a first storage area corresponding to each of the data blocks in a storage medium; divide the first storage area based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other; and store each of the data blocks in the corresponding first storage area.

[0009] On another aspect, one or more embodiments of the present specification provide a storage medium for storing computer-executable instructions, which implement the following process when executed: in response to a data storage request for target data issued by a first user, obtain the target data; divide the target data into multiple data blocks according to a first data type of the target data; each data block corresponds to a different first data type; determine a first storage area corresponding to each data block in a storage medium; divide the first storage area based on the first data type and / or data amount corresponding to the data block; each first storage area is independent of each other; and store each data block in the corresponding first storage area.

[0010] By adopting the technical solution of one or more embodiments of the present specification, the target data can be divided into multiple data blocks according to the first data type of the target data, each data block corresponds to a different first data type, and then the independent storage area corresponding to each data block in the storage medium is determined, and each data block is stored in the corresponding first storage area. Therefore, by dividing the data and storing them in independent storage areas, when operating any data block, it will not cause changes and influences on other data, reducing the cost of data modification and improving the security and stability of data; after dividing the data into data blocks and storing them, the same size of storage space can store more data, and it is convenient to manage them in units of data blocks, which improves the management efficiency of data. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0012] Figure 1 is a schematic flow chart of a data storage method according to an embodiment of this specification;

[0013] Figure 2 is a schematic flow chart of another data storage method according to an embodiment of this specification;

[0014] Figure 3 is a schematic diagram of the logical structure of a storage area according to an embodiment of this specification;

[0015] Figure 4 is a structural schematic diagram of a data storage device according to an embodiment of this specification;

[0016] Figure 5 It is a structural schematic diagram of a data storage device according to an embodiment of the present specification. DETAILED DESCRIPTION

[0017] One or more embodiments of the present specification provide a data storage method, apparatus, and device, which reduce the cost of data modification and improve the security, stability, and management efficiency of data.

[0018] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of one or more embodiments of this specification.

[0019] Figure 1 is a schematic flow chart of a data storage method according to an embodiment of this specification, such as Figure 1 As shown, the method includes:

[0020] S102: In response to a data storage request for target data issued by a first user, acquire target data.

[0021] The first user can send the target data to be stored to the storage medium or directly input the target data into the storage medium through an input device.

[0022] S104: Divide the target data into a plurality of data blocks according to the first data type of the target data.

[0023] In this embodiment, the complex, large and changeable target data can be divided into multiple small data blocks according to certain rules, and then stored separately. Specifically, the target data can be divided according to the first data type of the target data, and the first data type includes fixed class data and variable class data. Fixed class data may include fixed information that cannot be modified and will not be modified after being stored in the storage medium. Variable class data may include information that can be modified, such as data association information, data permission information, data attribute information, etc.

[0024] Taking the target data as user information data as an example, fixed data can be the user's identity information, and variable data can be other information except identity information. Specifically, data association information can be card information, password information, fingerprint information, etc., data permission information can be resident permission information, administrator permission information, visitor permission information, etc., and data attribute information can be sequence attribute information, numerical attribute information, etc.

[0025] It can be understood that, among the multiple data blocks obtained by dividing the target data, each data block corresponds to a different first data type.

[0026] S106: Determine a first storage area corresponding to each data block in the storage medium.

[0027] Different first storage areas are correspondingly provided in the storage medium for the multiple data blocks obtained by dividing the target data, and each first storage area is independent of each other and occupies an independent storage space. Optionally, the first storage area is divided based on the first data type and / or data amount corresponding to the data block. For example, if the number of the first data type corresponding to the data block is N, the number of the first storage areas divided in the storage medium is greater than or equal to N; if the data amount corresponding to the data block is M, the storage capacity of the first storage area divided in the storage medium is greater than or equal to M. Taking the storage medium as a flash memory as an example, the first storage area includes at least one sector.

[0028] S108, storing each data block in a corresponding first storage area.

[0029] By dividing the target data into multiple data blocks and storing each data block in a corresponding independent storage area, modifying any data block will not cause changes to data blocks of other data types.

[0030] The data storage method provided in the embodiment of this specification can divide the target data into multiple data blocks according to the first data type of the target data, each data block corresponds to a different first data type, and then determine the independent storage area corresponding to each data block in the storage medium, and store each data block in the corresponding first storage area. Therefore, by dividing the data and storing them in independent storage areas, when operating any data block, it will not cause changes and influences on other data, reducing the cost of data modification and improving the security and stability of data; after dividing the data into data blocks and storing them, the same size of storage space can store more data, and it is convenient to manage them in units of data blocks, which improves the management efficiency of data.

[0031] In one embodiment, the first storage area corresponding to each data block in the storage medium may be determined by the following steps:

[0032] (1) According to the first data type corresponding to the data block, searching whether there is a target storage area corresponding to the first data type in the storage medium.

[0033] In the storage medium, multiple first storage areas may be pre-divided, which correspond to different first data types respectively; or it may not be pre-divided, and after receiving the target data to be stored, the first storage area is flexibly divided according to the target data. Therefore, if the target storage area corresponding to the first data type exists in the storage medium, the target storage area is determined as the first storage area corresponding to the data block; if the target storage area corresponding to the first data type does not exist in the storage medium, the first storage area is divided.

[0034] (2) If a target storage area corresponding to the first data type exists in the storage medium, the target storage area is determined as a first storage area corresponding to the data block; if a target storage area corresponding to the first data type does not exist in the storage medium, the storage capacity of the first storage area is determined based on the amount of data in the data block and the first data type; and, based on the storage capacity of the first storage area, the first storage area corresponding to the data block is divided in the storage medium.

[0035] It can be understood that the first storage area is used to store at least one data block, and the storage capacity of the first storage area needs to be greater than or equal to the amount of data in the data block; while the total storage capacity of the storage medium is limited, the number of first storage areas needs to be greater than or equal to the number of first data types; the storage capacity of the first storage area can be determined by combining the amount of data in the data block and the number of first data types, and then the first storage area corresponding to the data block is divided in the storage medium according to the storage capacity of the first storage area. Optionally, the need to store target data of multiple users can also be considered, and when determining the storage capacity of the first storage area, the storage capacity is determined to be greater than or equal to the product of the amount of data in the data block and the number of users.

[0036] In one embodiment, if the user needs to expand the target data, for example, to add data of a new data type to the target data, an independent storage area can be added to the storage medium accordingly. After storing each data block in the corresponding first storage area, the method can also include the following steps:

[0037] When a data storage request for a data block of a second data type is received from a first user, a second storage area corresponding to the second data type is divided in the storage medium, and the data block of the second data type is stored in the second storage area. The second data type is different from the first data type of the target data. It is understandable that the second storage area can be divided in the same way as the first storage area. Optionally, the storage location of the second storage area is arranged after each first storage area.

[0038] In one embodiment, the user can also trim the first storage area, thereby deleting all data stored in the first storage area to trim the target data. After storing each data block in the corresponding first storage area, the method can also include the following steps:

[0039] When a deletion instruction for a target storage area corresponding to a first data type is received from a first user, the target storage area is deleted, wherein deleting the target storage area corresponding to the first data type does not affect data in other storage areas, thereby saving storage space.

[0040] Optionally, in S106, each data block may be stored in the corresponding first storage area in the following manner:

[0041] (1) determining the starting physical address information of the first storage area corresponding to the data block according to the data type corresponding to the data block; and determining the free position index information corresponding to the first storage area according to the amount of data stored in the first storage area.

[0042] Among them, the data type corresponding to the data block can be used to determine which first storage area it specifically corresponds to, and then the starting physical address information of the first storage area can be obtained. The idle position index information corresponding to the first storage area will be initialized once each time the storage medium is powered on, and then each time data is written to the first storage area, the initialized idle position index information is updated, and the value corresponding to the idle position index information is increased by one. For example, the amount of stored data can be obtained based on the multiplication of the amount of data of each data block and the number of data blocks in the first storage area. Taking the example of writing a data block corresponding to a user in the first storage area each time, the number of data blocks in the first storage area is the number of users stored in the first storage area. Therefore, the value corresponding to the idle position index information can be the number of data blocks stored in the first storage area, or the number of users stored in the first storage area.

[0043] (2) Determine the target address information corresponding to the data block according to the starting physical address information, the free position index information and the data amount of the data block.

[0044] Specifically, the target address information corresponding to the data block may be calculated based on the formula: target address information=starting physical address information+data volume of the data block*value corresponding to the free position index information.

[0045] (3) According to the above target address information, the data block and / or the user identification information is stored in the corresponding first storage area.

[0046] Taking the first data type of the target data as variable data as an example, only the data block of the target data can be stored in the corresponding first storage area, or the data block and the user identification information of the target data can be stored together in the corresponding first storage area; taking the first data type of the target data as fixed data as an example, the user identification information of the target data can be stored in the corresponding first storage area. The user identification information of the above target data may include: the user's ID card identification number or unique code, the user's name, the user's gender, etc. Since the target data is divided into multiple data blocks and stored in different first storage areas respectively, all databases of the target data can be associated through the user identification information, which is convenient for management operations such as data storage, search or deletion.

[0047] Considering that the first storage area stores multiple data blocks with different target data, when deleting one of the data blocks, if the entire first storage area is completely erased, the life of the storage medium and the data management efficiency are affected. Therefore, in this embodiment, the data block deletion process is implemented using the validity identifier. The validity identifier is set in the data block, and the validity identifier includes a valid identifier or an invalid identifier. The above method may also include:

[0048] When a deletion instruction for a data block is received, the validity flag corresponding to the data block is updated to an invalid flag; when the first storage area is full of data, the data block with the validity flag as the invalid flag is deleted. It can be understood that when deleting the data block with the validity flag as the invalid flag, the data block with the validity flag as the valid flag can be retained.

[0049] Figure 2 is a schematic flow chart of a data storage method according to a specific embodiment of this specification. Figure 2 In the example, the target data is user information. Figure 2 As shown, the data storage method includes:

[0050] S201, in response to a data storage request for user information issued by a first user, obtaining user information that the first user wants to store.

[0051] Specifically, a complete user information may include: name information, code information, fingerprint information, password information, card information, face information, validity period information, authority information, etc. Taking the storage medium as a flash memory, if the above types of user information are stored in the same location in the flash memory, the entire sector where it is located must be erased and then written each time it is modified, which is time-consuming. At the same time, the data to be retained needs to be moved to the backup sector, and the amount of data moved each time is large.

[0052] S202: Divide the user information into a plurality of data blocks according to a first data type of the user information.

[0053] In one embodiment, the user information can be divided into two categories: fixed data and variable data, depending on whether it changes frequently. The fixed data includes basic user information, and the variable data includes card information, fingerprint information, password information, authority information, valid information, etc. Each data type is not repeated, and each data block is independent of each other. Each data block stores the user's coding information, which is unique, so each data block can be associated through the coding information.

[0054] Specifically, user basic information may include the user's name, gender and user attributes; fingerprint information may include: user's coding information, fingerprint coding information, data attribute information, etc.; password information may include: user's coding information, password coding information, data attribute information, etc.; card information may include: user coding information, card number information, data attribute information, etc.; authority information may include: user's coding information, door opening auxiliary function information, data attribute information, etc.; valid information may include validity period information, etc.

[0055] S203: Divide the storage medium into a plurality of first storage areas according to the first data type and data amount corresponding to the data block.

[0056] See also Figure 3 The logical structure diagram of the storage area shown in the figure can be planned based on the number of first data types and the data volume of data blocks. The number of first storage areas is greater than or equal to the number of first data types, and the storage space of the first storage area is greater than or equal to the product of the data volume of data blocks and the amount of user information that can be stored. Figure 3 As shown, the first storage area divided in the storage medium includes: a user information area, a password information area, a card information area, a fingerprint information area, and a valid information area. Each area includes a data storage area and a data backup area. For example, the user information area includes a user information storage area of ​​4 sectors and a user information backup storage area of ​​4 sectors. Each storage area corresponds to the data type of the above user information one by one, each storage area does not overlap with each other, and the data of each data type is independent of each other, thereby ensuring the independence of the data of each data type during actual use.

[0057] S204, determining the starting physical address information of the first storage area corresponding to the data block according to the data type corresponding to the data block; and determining the free position index information corresponding to the first storage area according to the amount of data stored in the first storage area.

[0058] like Figure 3 As shown, each first storage area corresponds to a fixed starting physical address, for example, the starting physical address of the user information area is 0x6000, and the starting physical address of the password information area is 0x6800. The amount of stored data in the first storage area can be determined by the product of the number of users and the amount of data blocks, or by the product of the number of data blocks and the amount of data blocks. The value corresponding to the free position index information can be the number of stored users or the number of stored data blocks.

[0059] S205, determining target address information corresponding to the data block according to the starting physical address information, the free position index information and the data volume of the data block.

[0060] For fixed data, there are only two possible changes: adding and deleting. Every time a new user is added, the data block corresponding to the user information of the new user is written after the original data. For example, writing a data block corresponding to a user in the first storage area each time, the value corresponding to the free position index information can be the number of users stored in the first storage area. The target address information of the data block is calculated as follows:

[0061] Target address information = starting physical address information + data volume of a single data block * number of stored users.

[0062] If the user's coding information is sorted from 0, the number of stored users is equal to the value corresponding to the user's coding information. Therefore, the address of each target data block in the first storage area is calculated according to the user's coding information, so that the target address can be directly located and data can be written.

[0063] For variable data, each data block is independent and data can be written directly to the idle position address. Since the idle position index information corresponding to the first storage area is initialized once each time the storage medium is powered on, each time data is written to the first storage area, the value corresponding to the initialized idle position index information is increased by one. The value corresponding to the idle position index information can be the number of data blocks in the first storage area. The target address information of the data block is calculated as follows:

[0064] Target address information = starting physical address information + data volume of a single data block * number of data blocks.

[0065] The above storage strategy reduces the number of erasures of the storage medium to the maximum. When reading a data block, the target address to be read can be determined according to the target address information calculation formula that is the same as the above storage process, so that the storage location can be quickly located and the data can be read.

[0066] S206: Store the data block and / or the user identification information into the corresponding first storage area according to the target address information. For details, please refer to the relevant contents of the above embodiments.

[0067] S207: When a data query instruction sent by the first user is received, query data according to the user's coding information included in the data query instruction.

[0068] For fixed-type data, the target address information can be calculated based on the same formula as the above storage process to determine what to read, and then the target address can be directly accessed to obtain the data.

[0069] For variable data, the search condition fields can be determined according to the query instructions for cheap retrieval. For example, to query the user's card information, the user's card number can be determined first, and then the search can be performed based on the card number. Specifically, the search strategy can be a traversal or a binary search. Among them, the binary search depends on the order of the data. Therefore, after the target data is written, if the amount of information in the target data is less than the threshold, the data will not be sorted. If the amount of information in the target data is greater than the threshold, the data will be sorted once in idle time. The above search strategy can quickly locate the storage location of the data.

[0070] S208, when receiving a data storage request for a data block of the second data type from the first user, divide a second storage area corresponding to the second data type in the storage medium, and store the data block of the second data type in the second storage area.

[0071] The data storage method of this embodiment supports the expansion of user information, and one or more data blocks of the second data type can be added to the user information. It is understandable that the second data type is different from the first data type. For example, when adding face information to the user information, when dividing the data blocks according to the user's data type, the face information can be divided into independent face information data blocks. Accordingly, when receiving a data storage request for a face information data block, a second storage area is divided in the storage medium, and the second storage area is independent of the existing first storage area, and its storage position can be arranged after the existing first storage area, and will not affect the data already stored in the first storage area. For embedded products that apply the above data storage method, when the product is updated, a certain function may be added, and the data corresponding to the function can be stored in the newly divided second storage area of ​​the storage medium, and the addition of the function to the product will not affect other functional modules of the product. Among them, the embedded product can be a smart lock or a related access control device.

[0072] S209: When receiving a deletion instruction for the target storage area corresponding to the first data type issued by the first user, delete the target storage area.

[0073] The data storage method of this embodiment also supports reducing user information, and one or more data blocks of the first data type can be deleted from the user information. For embedded products that apply the above data storage method, if a simple version of the product needs to be launched, for example, the card information and fingerprint information in the user information can be deleted, and the first storage area corresponding to the card information and fingerprint information, that is, the target storage area, is deleted accordingly. The above deletion operation on the target storage area does not affect data of other data types, and is conducive to saving storage space.

[0074] The data storage method provided in the embodiments of this specification can divide user information into multiple data blocks according to data types, and then store them in independent storage areas in the storage medium. By dividing user information, the management of each data block is more convenient, and the space utilization rate is high; when operating a certain data block, it will not cause changes and influences on other data, ensuring the security and stability of other data; by adding or deleting data types, the data types included in the user information can be flexibly expanded or cut, which is conducive to the flexible combination of data types in the user information.

[0075] In summary, specific embodiments of the present subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recorded in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing can be advantageous.

[0076] The above is a data storage method provided by one or more embodiments of this specification. Based on the same idea, one or more embodiments of this specification also provide a data storage device.

[0077] Figure 4 is a schematic diagram of the structure of a data storage device according to an embodiment of the present specification. Figure 4 In a software implementation, the data storage device 400 may include: a data acquisition module 41, a data block division module 42, a storage area determination module 43 and a data storage module 44, wherein:

[0078] A data acquisition module 41 is used to acquire the target data in response to a data storage request for the target data issued by the first user;

[0079] A data block division module 42 is used to divide the target data into a plurality of data blocks according to a first data type of the target data; each of the data blocks corresponds to a different first data type;

[0080] A storage area determination module 43 is used to determine a first storage area corresponding to each of the data blocks in the storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; and each of the first storage areas is independent of each other;

[0081] The data storage module 44 is used to store each of the data blocks in the corresponding first storage area.

[0082] The data storage device provided in the embodiment of this specification can divide the target data into multiple data blocks according to the first data type of the target data, each data block corresponds to a different first data type, and then determine the independent storage area corresponding to each data block in the storage medium, and store each data block in the corresponding first storage area. Therefore, by dividing the data and storing them in independent storage areas, when operating any data block, it will not cause changes and influences on other data, reducing the cost of data modification and improving the security and stability of data; after dividing the data into data blocks and storing them, the same size of storage space can store more data, and it is convenient to manage them in units of data blocks, which improves the management efficiency of data.

[0083] In one embodiment, the first data type includes fixed type data and variable type data; the variable type data includes at least one of data association information, data permission information, and data attribute information.

[0084] In one embodiment, the storage area determination module 43 is specifically configured to:

[0085] searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium;

[0086] If yes, determining the target storage area as the first storage area corresponding to the data block;

[0087] If not, determining the storage capacity of the first storage area according to the data volume of the data block and the first data type; and dividing the first storage area corresponding to the data block in the storage medium according to the storage capacity of the first storage area.

[0088] In one embodiment, the device further includes a storage area adding module, which is used to:

[0089] When receiving a data storage request for a data block of a second data type from the first user, dividing a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type;

[0090] The data block of the second data type is stored in the second storage area.

[0091] In one embodiment, the device further includes a storage area deletion module, configured to:

[0092] When a deletion instruction for the target storage area corresponding to the first data type is received from the first user, the target storage area is deleted.

[0093] In one embodiment, the data storage module 44 is specifically used for:

[0094] Determine, according to the data type corresponding to the data block, the starting physical address information of the first storage area corresponding to the data block; and, according to the amount of data stored in the first storage area, determine the free position index information corresponding to the first storage area;

[0095] Determine the target address information corresponding to the data block according to the starting physical address information, the free position index information and the data amount of the data block;

[0096] According to the target address information, the data block and / or the user identification information of the target data is stored in the corresponding first storage area.

[0097] In one embodiment, the data block includes a validity flag, and the validity flag includes a valid flag or an invalid flag; the device also includes a data deletion module, which is used to:

[0098] When a deletion instruction for the data block is received, updating the validity flag corresponding to the data block to the invalid flag;

[0099] When the first storage area is full of data, the data block whose validity mark is the invalid mark is deleted.

[0100] In one embodiment, the storage medium is a flash memory, and the area includes at least one sector in the flash memory.

[0101] Those skilled in the art should understand that the above-mentioned data storage device can be used to implement the data storage method described above, and the detailed description thereof should be similar to the description of the method part above, and will not be further described here to avoid tediousness.

[0102] Based on the same idea, one or more embodiments of this specification also provide a data storage device, such as Figure 5As shown. The data storage device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 can be short-term storage or persistent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the data storage device. Furthermore, the processor 501 can be configured to communicate with the memory 502 and execute a series of computer executable instructions in the memory 502 on the data storage device. The data storage device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input and output interfaces 505, and one or more keyboards 506.

[0103] Specifically in this embodiment, the data storage device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the data storage device, and the one or more programs are configured to be executed by one or more processors, including the following computer executable instructions:

[0104] In response to a data storage request for target data issued by a first user, acquiring the target data;

[0105] According to the first data type of the target data, the target data is divided into a plurality of data blocks; the first data types corresponding to the data blocks are different;

[0106] Determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other;

[0107] Each of the data blocks is stored in the corresponding first storage area.

[0108] Optionally, the first data type includes fixed type data and variable type data; the variable type data includes at least one of data association information, data permission information, and data attribute information.

[0109] Optionally, when the computer executable instructions are executed, the processor may also:

[0110] searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium;

[0111] If yes, determining the target storage area as the first storage area corresponding to the data block;

[0112] If not, determining the storage capacity of the first storage area according to the data volume of the data block and the first data type; and dividing the first storage area corresponding to the data block in the storage medium according to the storage capacity of the first storage area.

[0113] Optionally, when the computer executable instructions are executed, the processor may also:

[0114] When receiving a data storage request for a data block of a second data type from the first user, dividing a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type;

[0115] The data block of the second data type is stored in the second storage area.

[0116] Optionally, when the computer executable instructions are executed, the processor may also:

[0117] When a deletion instruction for the target storage area corresponding to the first data type is received from the first user, the target storage area is deleted.

[0118] Optionally, when the computer executable instructions are executed, the processor may also:

[0119] Determine, according to the data type corresponding to the data block, the starting physical address information of the first storage area corresponding to the data block; and, according to the amount of data stored in the first storage area, determine the free position index information corresponding to the first storage area;

[0120] Determine the target address information corresponding to the data block according to the starting physical address information, the free position index information and the data amount of the data block;

[0121] According to the target address information, the data block and / or the user identification information of the target data is stored in the corresponding first storage area.

[0122] Optionally, the data block includes a validity flag, and the validity flag includes a valid flag or an invalid flag; when the computer executable instruction is executed, the processor may further:

[0123] When a deletion instruction for the data block is received, updating the validity flag corresponding to the data block to the invalid flag;

[0124] When the first storage area is full of data, the data block whose validity mark is the invalid mark is deleted.

[0125] Optionally, the storage medium is a flash memory, and the area includes at least one sector in the flash memory.

[0126] One or more embodiments of the present specification further provide a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by an electronic device including multiple application programs, the electronic device can execute the above data storage method, and is specifically used to execute:

[0127] In response to a data storage request for target data issued by a first user, acquiring the target data;

[0128] According to the first data type of the target data, the target data is divided into a plurality of data blocks; the first data types corresponding to the data blocks are different;

[0129] Determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other;

[0130] Each of the data blocks is stored in the corresponding first storage area.

[0131] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0132] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0133] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0134] One or more embodiments of this specification are described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0137] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0138] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0139] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0140] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0141] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0142] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0143] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of one or more embodiments of this specification.

Claims

1. A data storage method, characterized in that: include: In response to a data storage request for target data issued by a first user, acquiring the target data; According to the first data type of the target data, the target data is divided into a plurality of data blocks; the first data types corresponding to the data blocks are different; Determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other; storing each of the data blocks in the corresponding first storage area; The determining of the first storage area corresponding to each of the data blocks in the storage medium comprises: searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium; if there is no target storage area corresponding to the first data type in the storage medium, determining the storage capacity of the first storage area according to the amount of data in the data block and the amount of the first data type; and, according to the storage capacity of the first storage area, dividing the first storage area corresponding to the data block in the storage medium; After storing each of the data blocks in the corresponding first storage area, the method further includes: when receiving a data storage request for a data block of a second data type from the first user, allocating a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type; and storing the data block of the second data type in the second storage area.

2. The method according to claim 1, characterized in that The first data type includes fixed type data and variable type data; the variable type data includes at least one of data association information, data authority information, and data attribute information.

3. The method according to claim 1, characterized in that If a target storage area corresponding to the first data type exists in the storage medium, the target storage area is determined to be the first storage area corresponding to the data block.

4. The method according to claim 3, characterized in that After storing each of the data blocks in the corresponding first storage area, the method further includes: When a deletion instruction for the target storage area corresponding to the first data type is received from the first user, the target storage area is deleted.

5. The method according to claim 1, characterized in that The storing each of the data blocks into the corresponding first storage area includes: Determine, according to the data type corresponding to the data block, the starting physical address information of the first storage area corresponding to the data block; and, according to the amount of data stored in the first storage area, determine the free position index information corresponding to the first storage area; Determine the target address information corresponding to the data block according to the starting physical address information, the free position index information and the data amount of the data block; According to the target address information, the data block and / or the user identification information of the target data is stored in the corresponding first storage area.

6. The method according to claim 5, characterized in that The data block includes a validity mark, and the validity mark includes a valid mark or an invalid mark; the method further includes: When a deletion instruction for the data block is received, updating the validity flag corresponding to the data block to the invalid flag; When the first storage area is full of data, the data block whose validity mark is the invalid mark is deleted.

7. The method according to claim 1, characterized in that The storage medium is a flash memory, and the area includes at least one sector in the flash memory.

8. A data storage device, characterized in that: include: A data acquisition module, configured to acquire the target data in response to a data storage request for the target data issued by the first user; A data block division module, used for dividing the target data into a plurality of data blocks according to a first data type of the target data; the first data types corresponding to the data blocks are different; A storage area determination module, used to determine a first storage area corresponding to each of the data blocks in a storage medium; The first storage areas are divided based on the first data type and / or data amount corresponding to the data blocks; each of the first storage areas is independent of each other; A data storage module, used for storing each of the data blocks in the corresponding first storage area; The determining of the first storage area corresponding to each of the data blocks in the storage medium comprises: searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium; if there is no target storage area corresponding to the first data type in the storage medium, determining the storage capacity of the first storage area according to the amount of data in the data block and the amount of the first data type; and, according to the storage capacity of the first storage area, dividing the first storage area corresponding to the data block in the storage medium; After storing each of the data blocks in the corresponding first storage area, the method further includes: when receiving a data storage request for a data block of a second data type from the first user, allocating a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type; and storing the data block of the second data type in the second storage area.

9. A data storage device, characterized in that: include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: In response to a data storage request for target data issued by a first user, acquiring the target data; According to the first data type of the target data, the target data is divided into a plurality of data blocks; the first data types corresponding to the data blocks are different; Determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other; storing each of the data blocks in the corresponding first storage area; The determining of the first storage area corresponding to each of the data blocks in the storage medium comprises: searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium; if there is no target storage area corresponding to the first data type in the storage medium, determining the storage capacity of the first storage area according to the amount of data in the data block and the amount of the first data type; and, according to the storage capacity of the first storage area, dividing the first storage area corresponding to the data block in the storage medium; After storing each of the data blocks in the corresponding first storage area, the method further includes: when receiving a data storage request for a data block of a second data type from the first user, allocating a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type; and storing the data block of the second data type in the second storage area.

10. A storage medium, characterized in that: Used to store computer executable instructions, which implement the following process when executed: In response to a data storage request for target data issued by a first user, acquiring the target data; According to the first data type of the target data, the target data is divided into a plurality of data blocks; the first data types corresponding to the data blocks are different; Determine a first storage area corresponding to each of the data blocks in a storage medium; the first storage area is divided based on the first data type and / or data amount corresponding to the data block; each of the first storage areas is independent of each other; storing each of the data blocks in the corresponding first storage area; The determining of the first storage area corresponding to each of the data blocks in the storage medium comprises: searching, according to the first data type corresponding to the data block, whether there is a target storage area corresponding to the first data type in the storage medium; if there is no target storage area corresponding to the first data type in the storage medium, determining the storage capacity of the first storage area according to the amount of data in the data block and the amount of the first data type; and, according to the storage capacity of the first storage area, dividing the first storage area corresponding to the data block in the storage medium; After storing each of the data blocks in the corresponding first storage area, the method further includes: when receiving a data storage request for a data block of a second data type from the first user, allocating a second storage area corresponding to the second data type in the storage medium; the second data type is different from the first data type; and storing the data block of the second data type in the second storage area.

Citation Information

Patent Citations

  • Data storage method and storage equipment

    CN107092439A

  • Method and system used for managing storage system

    CN107526535A

  • System upgrading method, data processing method, device and equipment

    CN110750465A

  • Data management method and device, equipment and storage medium

    CN110955704A

  • Multimedia data storage method and device, storage medium and electronic equipment

    CN111143580A