Data storage method and device, computer equipment and storage medium
By adopting dual-channel serial port parallel reception and FIFO cache methods in the data storage system, combined with specific data processing algorithms and storage management of the FAT32 protocol, the limitations of traditional single-channel serial port reception systems in terms of data throughput and efficiency are solved, and the data throughput and efficiency of the traditional single-channel serial port reception system is realized. Efficient data reception and storage.
Patent Information
- Application Number
- CN202411569175.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-18
AI Technical Summary
Traditional single-channel serial port receiving systems have limitations in data throughput and efficiency, especially when directory item search efficiency is inefficient and the number of files is high, resulting in a long time to find specific files, affecting the speed of read and write operations.
Provide a data storage method to ensure parallel data reception and processing by adopting two independent serial port channels in the serial port receiving unit and using first-in-first-out (FIFO) method in the data cache unit. The data processing unit uses a specific algorithm to check and organize the data, and the storage control unit manages the storage medium according to the FAT32 protocol to improve the efficiency of data reception and storage.
Parallel reception through dual serial ports significantly increases data throughput, improves data reception and storage efficiency, reduces the time to find specific files, and improves the speed of read and write operations.
Smart Images

Figure CN119473148A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a data storage method, apparatus, computer equipment, and storage medium. Background Art
[0002] In modern data acquisition and storage systems, serial communication is still a widely used method. However, the traditional single-channel serial port receiving system has certain limitations in data throughput and efficiency. The general FAT32 file system has low efficiency in directory entry search. When there are a large number of files in the directory, finding the directory entry of a specific file requires traversing the entire directory, which may result in a long search time, thus affecting the speed of read and write operations. Summary of the invention
[0003] Based on this, it is necessary to provide a data storage method, device, computer equipment, and storage medium to address the above technical problems.
[0004] In a first aspect, the present application provides a data storage method. Applied to a data storage system, the data storage system includes a serial port receiving unit, a data cache unit, a data processing unit, and a storage control unit, and the method includes:
[0005] After the serial port receiving unit receives the data, the serial port receiving unit transmits the data to a corresponding buffer area in the data buffer unit, wherein the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit;
[0006] Sending the data to be processed in the data cache unit to the data processing unit to obtain processed data to be stored, wherein the data to be processed includes data in any cache area that reaches a data cache threshold or times out and is not processed;
[0007] The data to be stored is sent to a storage control unit, so that the storage control unit writes the data to be stored into a storage medium and records a log.
[0008] In one embodiment, the storage medium includes a directory entry area, a data area and a cluster chain area. The storage location of the directory entry area is fixed at the front end of the storage medium, and the data area is set at the back end of the directory entry area to form a continuous block storage structure.
[0009] In one embodiment, before the storage control unit writes the data to be stored into a storage medium, the method includes:
[0010] Create a file, generate directory entry information based on the file name of the file, and store it in the directory entry area;
[0011] New file identifiers are generated in sequence based on identifiers of existing files in the storage medium, and the file identifiers are used to calculate the storage position of the file in the directory entry area.
[0012] In one embodiment, the method further comprises:
[0013] When the directory entry area is full, the file with the first file identification ranking is deleted based on the identification order of the existing files.
[0014] In one embodiment, the method further comprises:
[0015] Based on the file identifier, the storage location of the file in the directory entry and the size of the space occupied by the directory entry are obtained;
[0016] Parse the directory entry to obtain cluster chain information, and delete the cluster chain information of the file;
[0017] The directory entry is deleted based on the storage location of the file in the directory entry and the size of the space occupied by the directory entry.
[0018] In one embodiment, the method further comprises:
[0019] Get the cluster chain of the data to be updated;
[0020] When the cluster chain of the data to be updated is full, a new idle cluster is selected, the data to be updated is added to the new idle cluster, and the directory entry information is updated.
[0021] In a second aspect, the present application further provides a data storage device, which is applied to a data storage system, wherein the data storage system includes a serial port receiving unit, a data cache unit, a data processing unit, and a storage control unit, and the device includes:
[0022] A storage module, configured to transfer the data to a corresponding buffer area in a data buffer unit after the serial port receiving unit receives the data, wherein the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit;
[0023] A sending module, used to send the data to be processed in the data cache unit to the data processing unit to obtain processed data to be stored, wherein the data to be processed includes data that reaches a data cache threshold or is not processed due to timeout in any cache area;
[0024] A writing module is used to send the data to be stored to the storage control unit, so that the storage control unit writes the data to be stored into a storage medium and records a log.
[0025] In one of the embodiments, the storage medium includes a directory entry area and a data area. The storage position of the directory entry area is fixed at the front end of the storage medium, and the data area is set at the back end of the directory entry area to form a continuous block storage structure.
[0026] In one of the embodiments, before the storage control unit writes the data to be stored into a storage medium, the device includes:
[0027] Create a file, generate directory entry information based on the file name of the file, and store it in the directory entry area;
[0028] New file identifiers are generated in sequence based on identifiers of existing files in the storage medium, and the file identifiers are used to calculate the storage position of the file in the directory entry area.
[0029] In one embodiment, the device further comprises:
[0030] When the directory entry area is full, the file with the first file identification ranking is deleted based on the identification order of the existing files.
[0031] In one embodiment, the device further comprises:
[0032] Based on the file identifier, the storage location of the file in the directory entry and the size of the space occupied by the directory entry are obtained;
[0033] Parse the directory entry to obtain cluster chain information, and delete the cluster chain information of the file;
[0034] The directory entry is deleted based on the storage location of the file in the directory entry and the size of the space occupied by the directory entry.
[0035] In one embodiment, the device further comprises:
[0036] Get the cluster chain of the data to be updated;
[0037] When the cluster chain of the data to be updated is full, a new idle cluster is selected, the data to be updated is added to the new idle cluster, and the directory entry information is updated.
[0038] In a third aspect, the present disclosure further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the data storage method when executing the computer program.
[0039] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the data storage method are implemented.
[0040] In a fifth aspect, the present disclosure further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the data storage method are implemented.
[0041] The above data storage method has at least the following beneficial effects:
[0042] In the embodiment scheme provided by the present disclosure, the serial port receiving unit adopts an independent hardware interface and buffer to ensure the parallel reception of two-way data without interfering with each other. The data cache unit adopts a first-in-first-out (FIFO) method. When the cache reaches a certain threshold or times out without processing, it triggers the data processing unit to process. The data processing unit uses a specific algorithm to verify the data, eliminate erroneous data, and organize the valid data into a unified format. The storage control unit creates files and directories according to the specifications of the FAT32 protocol, and writes the processed data into the storage medium in the form of files, thereby improving the efficiency of data reception and storage, and greatly increasing the data throughput through parallel reception of dual serial ports.
[0043] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the conventional technology, the drawings required for use in the embodiments or the conventional technology descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 An application environment diagram of a data storage method in one embodiment;
[0046] Figure 2 A schematic diagram of a flow chart of a data storage method in one embodiment;
[0047] Figure 3 The architecture of a data storage system in one embodiment;
[0048] Figure 4 is a schematic diagram of a buffer area in one embodiment;
[0049] Figure 5 A schematic diagram of data storage in one embodiment;
[0050] Figure 6 is a schematic diagram of the structure of a storage medium in one embodiment;
[0051] Figure 7 A flowchart of creating a new file storage in one embodiment;
[0052] Figure 8 A schematic diagram of a process of deleting a file in one embodiment;
[0053] Fig. 9 A schematic diagram of a process of updating a file in one embodiment;
[0054] Fig.10 is a schematic diagram of a data storage device in one embodiment;
[0055] Fig.11 is an internal structure diagram of a computer device in one embodiment;
[0056] Fig.12 The figure is a diagram of the internal structure of a server in one embodiment. DETAILED DESCRIPTION
[0057] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0058] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described here can be implemented in an order other than those illustrated or described here. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are only examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
[0059] The present disclosure provides a data storage method which can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0060] In some embodiments of the present disclosure, Figure 2 As shown, a data storage method is provided. In a specific embodiment, it is applied to a data storage system, the data storage system includes a serial port receiving unit, a data cache unit, a data processing unit, and a storage control unit, and the method may include the following steps:
[0061] S202: After the serial port receiving unit receives the data, the serial port receiving unit transmits the data to a corresponding buffer area in the data buffer unit, wherein the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit.
[0062] Figure 3 The architecture of a data storage system in an embodiment includes the following parts: a serial port receiving unit, which is used to receive data from two independent serial port channels at the same time; a data cache unit, which is used to temporarily store the received data to relieve the pressure of data processing; a data processing unit, which is used to parse, verify and organize the received data; a storage control unit, which manages the storage medium and writes data based on the FAT32 protocol; and a storage medium, which is used to save the processed data. The serial port receiving unit adopts an independent hardware interface and buffer to ensure that the two channels of data are received in parallel without interfering with each other. The data cache unit adopts a first-in-first-out (FIFO) method. When the cache reaches a certain threshold or is not processed after a timeout, the data processing unit is triggered to process.
[0063] In one embodiment of the present disclosure, the serial port receiving unit receives data through serial port channel 1 and serial port channel 2 respectively, and stores the data into buffer 1 and buffer 2 of the data cache module.
[0064] S204: Send the data to be processed in the data cache unit to the data processing unit to obtain processed data to be stored, wherein the data to be processed includes data in any cache area that reaches a data cache threshold or times out and is not processed.
[0065] The buffer is divided into blocks, each block size is 2048 bytes. Figure 4 Schematic diagram of a buffer area in an embodiment. When the data in buffer 1 or buffer 2 reaches a set threshold or times out, the data processing unit is triggered to process. The data processing unit uses a specific algorithm to verify the data, remove erroneous data, and organize the valid data into a unified format to obtain processed data to be stored.
[0066] S206: Send the data to be stored to a storage control unit, so that the storage control unit writes the data to be stored into a storage medium and records a log.
[0067] The storage control module creates files and directories according to the specifications of the FAT32 protocol and writes the processed data in the form of files to the storage medium, which can be a flash memory, a hard disk, etc.
[0068] Figure 5 Schematic diagram of data storage in one embodiment. In one embodiment of the present disclosure, system initialization includes serial port parameter setting, storage medium initialization, file system initialization, log system initialization, etc.; the dual serial port starts to receive data and stores the data in the data cache unit; when the data cache unit reaches a threshold or times out, the data processing unit starts to work and performs data analysis, verification and sorting; the storage control unit writes the processed data into the storage medium according to the FAT32 protocol.
[0069] In the above data storage method, the serial port receiving unit adopts an independent hardware interface and buffer to ensure the parallel reception of two data without interfering with each other. The data cache unit adopts the first-in-first-out (FIFO) method. When the cache reaches a certain threshold or times out without processing, it triggers the data processing unit to process. The data processing unit uses a specific algorithm to verify the data, eliminate erroneous data, and organize the valid data into a unified format. The storage control unit creates files and directories according to the specifications of the FAT32 protocol, and writes the processed data into the storage medium in the form of files, which improves the efficiency of data reception and storage, and greatly increases the data throughput through parallel reception of dual serial ports.
[0070] In some embodiments of the present disclosure, the storage medium includes a directory entry area, a data area and a cluster chain area. The storage position of the directory entry area is fixed at the front end of the storage medium, and the data area is set at the back end of the directory entry area to form a continuous block storage structure.
[0071] Figure 6The structure diagram of the storage medium in one embodiment. The present invention redesigns the storage structure and operation method of FAT32 based on the FAT32 protocol. The directory entries of the general FAT32 are discretely allocated in different sectors and connected in series in the form of a linked list. The present invention fixes the allocation and storage location of the directory entry at the front end of the FAT table, abandons the FAT32 linked list storage structure, and adopts a continuous block storage structure, so that the storage structure is organized more clearly and the access efficiency is higher. When creating a new file, the present invention does not need to search the FAT table, but directly calculates the storage location of the directory entry according to the file number.
[0072] In some embodiments of the present disclosure, before the storage control unit writes the data to be stored into a storage medium, the method includes:
[0073] Create a file, generate directory entry information based on the file name of the file, and store it in the directory entry area;
[0074] New file identifiers are generated in sequence based on identifiers of existing files in the storage medium, and the file identifiers are used to calculate the storage position of the file in the directory entry area.
[0075] Figure 7 This is a flowchart of creating a new file storage in an embodiment. Before data is actually written to the storage medium, a file must first be created, and the basic attributes of the file, such as the file name, creation time, permissions, etc., need to be determined. After the file is created, a directory entry information needs to be generated for the file. The directory entry area is used to store directory entry information, which includes information such as the file name (standard FAT32 directory entry structure), and the data area is used to store the actual data of the file.
[0076] In order to uniquely identify each file, the system will generate a new file identifier in sequence based on the number of files already existing in the storage medium. The file identifier is used to calculate the storage location of the file in the directory entry area, which helps to quickly locate and access the file. After calculating the storage location, the directory entry information can be written to the specified location. The file identifier can be used to find the corresponding directory entry, and then find the actual data location of the file.
[0077] In some embodiments of the present disclosure, the method further includes:
[0078] When the directory entry area is full, the file with the first file identification ranking is deleted based on the identification order of the existing files.
[0079] The deleted files are the ones with the highest file numbers, and are deleted in the order of file numbers. After deleting a file, the deletion stops, and the deletion action will not be performed again until the directory entry is full again.
[0080] In some embodiments of the present disclosure, the method further includes:
[0081] Based on the file identifier, the storage location of the file in the directory entry and the size of the space occupied by the directory entry are obtained;
[0082] Parse the directory entry to obtain cluster chain information, and delete the cluster chain information of the file;
[0083] The directory entry is deleted based on the storage location of the file in the directory entry and the size of the space occupied by the directory entry.
[0084] Figure 8 The flowchart of deleting a file in an embodiment is shown in FIG. First, the file identifier is obtained, and the storage location of the file in the directory entry area is found according to the file identifier. In addition, the size of the space occupied by the directory entry needs to be known. The directory entry is parsed to obtain the cluster chain information of the file. The cluster chain information refers to the distribution of the file data on the storage medium, that is, the physical location of the file data block on the hard disk. Parsing the directory entry includes extracting the cluster chain information from the directory entry, which usually contains a pointer to the file data block, pointing to the storage location of the file data on the hard disk. Deleting the cluster chain information includes removing the cluster chain information from the FAT table and then deleting the directory entry, which means releasing the data blocks occupied by the file, which means that the file data is no longer associated with the directory entry, but the data blocks themselves may still exist on the storage medium until they are overwritten by new data or recycled by the cleanup mechanism of the file system.
[0085] In some embodiments of the present disclosure, the method further includes:
[0086] Get the cluster chain of the data to be updated;
[0087] When the cluster chain of the data to be updated is full, a new idle cluster is selected, the data to be updated is added to the new idle cluster, and the directory entry information is updated.
[0088] Fig. 9 The flowchart of updating a file in an embodiment is shown in FIG. The cluster chain information of the data to be updated is obtained, and the current cluster chain is checked to see if it is full. A full cluster chain means that the last cluster has been completely filled and no new data can be added. Whether it is full can be determined by checking the remaining space of the last cluster. If the cluster chain is not full, the remaining sectors of the current cluster number are written. If the cluster chain is full, it is necessary to consider deleting part of the data of the old file to make space, or to allocate a new cluster and update the directory entry information to reflect the new data status.
[0089] Get the cluster number information of the current file, write the data to be written to the remaining sectors of the current cluster number, and determine whether the current cluster is full. If it is full, delete the old file, update the directory entry information, and record the operation log.
[0090] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0091] Based on the same inventive concept, the embodiment of the present disclosure also provides a data storage device for implementing the data storage method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the data storage device embodiment provided below can refer to the limitations of the data storage method above, and will not be repeated here.
[0092] The device may include a system (including a distributed system), software (application), module, component, server, client, etc. that uses the method described in the embodiments of this specification and is combined with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiments of the present disclosure is as described in the following embodiments. Since the implementation scheme and method of the device to solve the problem are similar, the implementation of the specific device in the embodiments of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0093] In one embodiment, Fig.10 As shown, a data storage device 1000 is provided, and the device may be the aforementioned server, or a module, component, device, unit, etc. integrated in the server. The device 1000 may include:
[0094] The storage module 1002 is used to transfer the data to the corresponding buffer area in the data buffer unit after the serial port receiving unit receives the data, the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit;
[0095] The sending module 1004 is used to send the data to be processed in the data cache unit to the data processing unit to obtain the processed data to be stored, wherein the data to be processed includes data that has reached a data cache threshold or has timed out and has not been processed in any cache area;
[0096] The writing module 1006 is used to send the data to be stored to the storage control unit, so that the storage control unit writes the data to be stored into the storage medium and records a log.
[0097] In one of the embodiments, the storage medium includes a directory entry area and a data area. The storage position of the directory entry area is fixed at the front end of the storage medium, and the data area is set at the back end of the directory entry area to form a continuous block storage structure.
[0098] In one of the embodiments, before the storage control unit writes the data to be stored into a storage medium, the device includes:
[0099] Create a file, generate directory entry information based on the file name of the file, and store it in the directory entry area;
[0100] New file identifiers are generated in sequence based on identifiers of existing files in the storage medium, and the file identifiers are used to calculate the storage position of the file in the directory entry area.
[0101] In one embodiment, the device further comprises:
[0102] When the directory entry area is full, the file with the first file identification ranking is deleted based on the identification order of the existing files.
[0103] In one embodiment, the device further comprises:
[0104] Based on the file identifier, the storage location of the file in the directory entry and the size of the space occupied by the directory entry are obtained;
[0105] Parse the directory entry to obtain cluster chain information, and delete the cluster chain information of the file;
[0106] The directory entry is deleted based on the storage location of the file in the directory entry and the size of the space occupied by the directory entry.
[0107] In one embodiment, the device further comprises:
[0108] Get the cluster chain of the data to be updated;
[0109] When the cluster chain of the data to be updated is full, a new idle cluster is selected, the data to be updated is added to the new idle cluster, and the directory entry information is updated.
[0110] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0111] The above modules in the data storage device can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0112] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data storage method is implemented.
[0113] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data storage method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0114] Those skilled in the art will understand that Fig.11 , Fig.12The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0115] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any embodiment of the present disclosure is implemented.
[0116] In one embodiment, a computer program product is provided, including a computer program, which implements the method described in any embodiment of the present disclosure when executed by a processor.
[0117] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.
[0118] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0119] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.
Claims
1. A data storage method, characterized in that: Applied to a data storage system, the data storage system includes a serial port receiving unit, a data cache unit, a data processing unit, and a storage control unit, and the method includes: After the serial port receiving unit receives the data, the serial port receiving unit transmits the data to a corresponding buffer area in the data buffer unit, wherein the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit; Sending the data to be processed in the data cache unit to the data processing unit to obtain processed data to be stored, wherein the data to be processed includes data in any cache area that reaches a data cache threshold or times out and is not processed; The data to be stored is sent to a storage control unit, so that the storage control unit writes the data to be stored into a storage medium and records a log.
2. The method according to claim 1, characterized in that The storage medium includes a directory entry area, a data area and a cluster chain area. The storage position of the directory entry area is fixed at the front end of the storage medium, and the data area is arranged at the back end of the directory entry area to form a continuous block storage structure.
3. The method according to claim 1, characterized in that Before the storage control unit writes the data to be stored into a storage medium, the method includes: Create a file, generate directory entry information based on the file name of the file, and store it in the directory entry area; New file identifiers are generated in sequence based on identifiers of existing files in the storage medium, and the file identifiers are used to calculate the storage position of the file in the directory entry area.
4. The method according to claim 3, characterized in that The method further comprises: When the directory entry area is full, the file with the first file identification ranking is deleted based on the identification order of the existing files.
5. The method according to claim 3, characterized in that: The method further comprises: Based on the file identifier, the storage location of the file in the directory entry and the size of the space occupied by the directory entry are obtained; Parse the directory entry to obtain cluster chain information, and delete the cluster chain information of the file; The directory entry is deleted based on the storage location of the file in the directory entry and the size of the space occupied by the directory entry.
6. The method according to claim 3, characterized in that: The method further comprises: Get the cluster chain of the data to be updated; When the cluster chain of the data to be updated is full, a new idle cluster is selected, the data to be updated is added to the new idle cluster, and the directory entry information is updated.
7. A data storage device, characterized in that: Applied to a data storage system, the data storage system includes a serial port receiving unit, a data cache unit, a data processing unit, and a storage control unit, and the device includes: A storage module, configured to transfer the data to a corresponding buffer area in a data buffer unit after the serial port receiving unit receives the data, wherein the serial port receiving unit includes two independent serial port channels, and the serial port channels include corresponding buffer areas in the data buffer unit; A sending module, used to send the data to be processed in the data cache unit to the data processing unit to obtain processed data to be stored, wherein the data to be processed includes data that reaches a data cache threshold or is not processed due to timeout in any cache area; The writing module is used to send the data to be stored to the storage control unit, so that the storage control unit writes the data to be stored into the storage medium and records a log.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Electronic equipment, data transmission system and data transmission method
CN121210345A