Data storage method, apparatus, device, and medium
By performing file open and write operations independently within the autonomous driving controller, the problem of interface call timeouts was resolved, improving the reliability and efficiency of data storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UISEE TECH BEIJING LTD
- Filing Date
- 2022-09-26
- Publication Date
- 2026-06-16
AI Technical Summary
During data storage, the autonomous driving controller may experience timeouts when the process calls the synchronization interface, affecting the reliability of data storage.
The file open command is sent to the first thread by calling the file open interface, carrying the target file name to obtain the descriptor, and the file write command is sent to the second thread by calling the file write interface, so that the file write operation is executed independently and the synchronous interface is blocked.
This improves the reliability of data storage, avoids interface call timeouts, and ensures the stability and efficiency of data storage.
Smart Images

Figure CN115563064B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of document management technology, and in particular to a data storage method, apparatus, device and medium. Background Technology
[0002] During operation, the autonomous driving controller needs to record data to the file system to record the operating status and data, supporting the development of autonomous driving functions and data backtracking.
[0003] In related technologies, autonomous driving controllers typically store data through multiple internal processes using a synchronous interface. However, when a process calls the synchronous interface to open a file, timeouts may occur, affecting the reliability of data storage. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a data storage method, apparatus, device, and medium.
[0005] Firstly, this disclosure provides a data storage method, including:
[0006] The file open interface is called to send the file open command corresponding to the file open interface to the first thread. The file open command carries the target file name corresponding to the target file. The file open command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the list of opened files.
[0007] The file write interface is invoked to send the corresponding file write command to the second thread. The file write command carries the target file descriptor and the file data to be stored. The file write command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name.
[0008] Secondly, this disclosure provides another data storage method, including:
[0009] Receive the file open command sent by the target process. The file open command carries the name of the target file.
[0010] Based on the list of already opened files, determine the target file descriptor corresponding to the target file name;
[0011] The target process is fed back the target file descriptor so that the target process can write the file data to be stored to the target file based on the target file descriptor.
[0012] Thirdly, this disclosure provides a data storage device, including:
[0013] The first calling module is used to call the file open interface to send the file open command corresponding to the file open interface to the first thread. The file open command carries the target file name corresponding to the target file. The file open command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the list of opened files.
[0014] The second calling module is used to call the file writing interface to send the file writing command corresponding to the file writing interface to the second thread. The file writing command carries the target file descriptor and the file data to be stored. The file writing command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name.
[0015] Fourthly, this disclosure provides another data storage device, including:
[0016] The command receiving module is used to receive file open commands sent by the target process. The file open command carries the target file name corresponding to the target file.
[0017] The first determination module is used to determine the target file descriptor corresponding to the target file name based on the list of opened files;
[0018] The first feedback module is used to feed back the target file descriptor to the target process, so that the target process can write the file data to be stored to the target file based on the target file descriptor.
[0019] Fifthly, this disclosure provides a data storage device, comprising:
[0020] processor;
[0021] Memory, used to store executable instructions;
[0022] The processor is used to read executable instructions from memory and execute the executable instructions to implement the data storage method of the first aspect or the second aspect.
[0023] In a sixth aspect, this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the data storage method of the first or second aspect.
[0024] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0025] The data storage method, apparatus, device, and medium of this disclosure can call a file open interface to send a file open command corresponding to the file open interface to a first thread. This file open command carries the target file name corresponding to the target file. Furthermore, this file open command can be used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of already opened files. Then, it can continue to call a file write interface to send a file write command corresponding to the file write interface to a second thread. This file write command carries the target file descriptor and the file data to be stored. This file write command enables the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name. Therefore, when calling the file open interface to open a file, the first thread, which maintains the file list of already opened files, can independently respond to and execute the file write command and directly return the target file descriptor corresponding to the target file name. This avoids the blocking problem of synchronous interfaces, thereby preventing interface call timeouts and improving the reliability of data storage. Attached Figure Description
[0026] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0027] Figure 1 A schematic flowchart illustrating a data storage method provided in an embodiment of this disclosure;
[0028] Figure 2 A flowchart illustrating another data storage method provided in this embodiment of the disclosure;
[0029] Figure 3 This is a schematic diagram of the structure of a data storage device provided in an embodiment of the present disclosure;
[0030] Figure 4 A schematic diagram of another data storage device provided in an embodiment of this disclosure;
[0031] Figure 5 This is a schematic diagram of the structure of a data storage device provided in an embodiment of the present disclosure. Detailed Implementation
[0032] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0033] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0034] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0035] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0036] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0037] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0038] To address the aforementioned problems, this disclosure provides a data storage method, apparatus, device, and medium. The following embodiments, in conjunction with… Figure 1 The data storage method provided in the embodiments of this disclosure will be described in detail.
[0039] Figure 1 A schematic flowchart of a data storage method provided in an embodiment of this disclosure is shown.
[0040] In this embodiment of the disclosure, the data storage method can be executed by a target process of an electronic device. The electronic device may include, but is not limited to, mobile terminals such as laptops, PDAs (personal digital assistants), and PADs (tablet computers), as well as fixed terminals such as digital TVs and desktop computers.
[0041] like Figure 1 As shown, the data storage method may include the following steps.
[0042] S110. Call the file open interface to send the file open command corresponding to the file open interface to the first thread. The file open command carries the target file name corresponding to the target file. The file open command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of opened files.
[0043] In this embodiment of the disclosure, when a user wants to open a target file, the user can perform a file opening operation through an electronic device. In response to the file opening operation, the electronic device can call the file opening interface through the target process to send the file opening command corresponding to the file opening interface to the first thread.
[0044] Optionally, the file open operation can be an operation used to open a target file. For example, the file open operation can be an operation performed by a user on an electronic device, such as clicking an open control or entering an open command.
[0045] Optionally, the file opening interface can be an interface used to open the target file.
[0046] Optionally, the first thread can be a thread used to process various interface commands.
[0047] Optionally, the interface command can be a command generated by calling the interface.
[0048] Optionally, the file open command can be a command used to open the target file. The file open command may include the target file name.
[0049] Optionally, the target file can be the file that the user wants to manipulate.
[0050] Optionally, the target file name can be the name of the target file. For example, the target file can be file A, and the corresponding target file name can be "A"; the target file can be file B, and the corresponding target file name can be "B". There is no limitation here.
[0051] Optionally, the file list can store a list of files that the user has opened.
[0052] Optionally, the target file descriptor can be an index corresponding to the target file. The target file descriptor can have a mapping relationship with the target file. For example, an electronic device can query the corresponding target file using the target file descriptor.
[0053] Specifically, when a user wants to open a target file, they can perform a file opening operation through an electronic device. In response to the file opening operation, the electronic device can call the file opening interface through the target process and send the file opening command corresponding to the file opening interface to the first thread. The first thread can receive the file opening command carrying the target file name corresponding to the target file, search for the target file name in the file list storing opened files, and return the target file descriptor corresponding to the target file name to the electronic device.
[0054] S120. Call the file write interface to send the file write command corresponding to the file write interface to the second thread. The file write command carries the target file descriptor and the file data to be stored. The file write command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name.
[0055] In this embodiment of the disclosure, after receiving the target file descriptor fed back by the first thread, when the user wants to write data to the target file, a file writing operation can be performed through the electronic device. In response to the file writing operation, the electronic device can call the file writing interface through the target process to send the file writing command corresponding to the file writing interface to the second thread.
[0056] Optionally, a file write operation can be an operation used to write data to a target file. For example, a file write operation can be an operation performed by a user on an electronic device, such as clicking a write control or entering a write command.
[0057] Optionally, the file writing interface can be an interface used to write data to the target file.
[0058] Optionally, the second thread can be a thread used to process individual queue commands.
[0059] Optionally, the file write command can be a command used to write data to the target file. The file write command can carry the target file descriptor and the file data to be stored.
[0060] Optionally, the file data to be stored can be the file data to be written to the target file.
[0061] Specifically, after receiving the target file descriptor from the first thread, when the user wants to write data to the target file, they can perform a file write operation through the electronic device. In response to the file write operation, the electronic device can call the file write interface through the target process and send the file write command corresponding to the file write interface to the second thread. In response to the file write command carrying the target file descriptor and the file data to be stored, the second thread can search for the target file name corresponding to the target file descriptor in the file list, determine the corresponding target file based on the found target file name, and write the file data to be stored into the target file.
[0062] Therefore, in this embodiment of the disclosure, a file open interface can be invoked to send a file open command corresponding to the file open interface to a first thread. This file open command carries the target file name corresponding to the target file. This file open command can also be used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of already opened files. The file write interface can then be invoked to send a file write command corresponding to the file write interface to a second thread. This file write command carries the target file descriptor and the file data to be stored. This file write command enables the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name. Thus, when the file open interface is invoked to open a file, the first thread, which maintains the file list of already opened files, can independently respond to and execute the file write command and directly return the target file descriptor corresponding to the target file name. This avoids the blocking problem of synchronous interfaces, thereby preventing interface call timeouts and improving the reliability of data storage.
[0063] Optionally, when the first thread searches for the target file corresponding to the target file name in the list of open files, if the target file is an open file, the target file descriptor is the file descriptor already stored in the file list.
[0064] Specifically, when the first thread searches for the target file corresponding to the target file name in the list of opened files, if the target file is already opened, the first thread can directly obtain the file descriptor of the target file stored in the file list, i.e., the target file descriptor, and send the target file descriptor back to the electronic device.
[0065] Optionally, when the first thread searches for the target file corresponding to the target file name in the list of opened files, if the target file is not opened or has not been created, the target file descriptor is the file descriptor added to the file list for the target file.
[0066] Specifically, when the first thread searches for the target file corresponding to the target file name in the list of opened files, if the target file is not opened or has not been created, the first thread cannot directly obtain the file descriptor of the target file. Instead, the first thread can add a corresponding file descriptor, i.e., the target file descriptor, to the file list and send the target file descriptor back to the electronic device.
[0067] Therefore, in this embodiment of the disclosure, regardless of whether the target file exists in the file list, the first thread can return the target file descriptor, thereby realizing a non-blocking file opening operation, thus avoiding the situation of interface call timeout and improving the reliability of data storage.
[0068] Optionally, the file open command can also be used to enable the first thread to open the target file corresponding to the target file name through the second thread when the target file is not an open file, or to create and open the target file corresponding to the target file name through the second thread when the target file is not a created file.
[0069] In some embodiments of this disclosure, when the first thread receives a file open command and searches for the target file corresponding to the target file name in the list of opened files, if the target file is not opened, the first thread can send a file open command to the second thread, and the second thread can open the target file corresponding to the target file name through the received file open command.
[0070] In some embodiments of this disclosure, when the first thread receives a file open command and searches for the target file corresponding to the target file name in the list of opened files, if the target file is not created, the first thread can send a file create command to the second thread. The second thread can then create and open the target file corresponding to the target file name using the received file create command.
[0071] Therefore, in this embodiment of the disclosure, the first thread can open or create the corresponding target file through the second thread, thereby achieving non-blocking file opening or creation operations, thus avoiding interface call timeouts and improving the reliability of data storage.
[0072] Optionally, S120 may specifically include: calling a file write interface to send a file write command to a first queue, the first queue being used to enable a second thread to obtain the file write command.
[0073] In this embodiment of the disclosure, the electronic device can send a file write command to the first queue by calling the file write interface through the target process.
[0074] Optionally, the first queue can be a queue used for sequentially storing commands.
[0075] Specifically, the electronic device can send a file write command to the first queue by calling the file write interface through the target process. The first queue can store the received file write commands, and the second thread can sequentially retrieve the commands stored in the first queue, that is, retrieve the file write commands.
[0076] Therefore, in this embodiment of the disclosure, commands can be stored in a first queue and retrieved sequentially by a second thread, thereby achieving non-blocking command execution operations, avoiding interface call timeouts, and improving the reliability of data storage.
[0077] Optionally, after S120, the data storage method may further include: calling a file closing interface to send a file closing command corresponding to the file closing interface to a second thread. The file closing command carries a target file descriptor and is used to enable the second thread to query the target file name in the file list based on the target file descriptor and close the target file corresponding to the target file name.
[0078] In this embodiment of the disclosure, when a user wants to close a target file, the electronic device can perform a file closing operation. In response to the file closing operation, the electronic device can call the file closing interface through the target process, thereby sending the file closing command corresponding to the file closing interface to the second thread.
[0079] Optionally, the file closing operation can be an operation used to close the target file. For example, the file closing operation can be an operation performed by a user clicking a close control on an electronic device, or an operation performed by entering a close command.
[0080] Optionally, the file closing interface can be an interface used to close the target file.
[0081] Optionally, the file close command can be a command used to close a target file. The file close command may carry a target file descriptor. Specifically, after receiving the file close command, the second thread can determine the target file to be closed based on the target file descriptor carried in the file close command, and thus close the corresponding target file.
[0082] Specifically, when a user wants to close a target file, they can perform a file closing operation through an electronic device. In response to this operation, the electronic device can call the file closing interface through the target process, thereby sending a file closing command corresponding to the file closing interface to the second thread. The second thread can receive the file closing command and obtain the target file descriptor carried by the command. Then, based on the target file descriptor, it searches the file list to find the target file name corresponding to the file descriptor and closes the target file corresponding to that file name.
[0083] Therefore, in this embodiment of the disclosure, the target file can be closed by calling the file closing interface, thereby achieving non-blocking command execution operations, avoiding interface call timeouts, and improving the reliability of data storage.
[0084] Optionally, calling the file closing interface to send the file closing command corresponding to the file closing interface to the second thread may specifically include: calling the file closing interface to send the file closing command to the first queue, the first queue being used to enable the second thread to obtain the file closing command.
[0085] In this embodiment of the disclosure, the electronic device can send a file closing command to the first queue by calling the file closing interface through the target process.
[0086] Specifically, the electronic device can send a file closing command to the first queue by calling the file closing interface through the target process. The first queue can receive the file closing command and store it sequentially. The second thread can sequentially retrieve the file closing commands stored in the first queue and execute the file closing command.
[0087] Therefore, in this embodiment of the disclosure, commands can be stored in a first queue and retrieved sequentially by a second thread, thereby achieving non-blocking command execution operations, avoiding interface call timeouts, and improving the reliability of data storage.
[0088] Optionally, prior to S110, the data storage method may further include: determining the data size of the file data and the file size of the last updated file to which the file data belongs; if the sum of the data size and the file size is less than or equal to the target data segmentation threshold, using the file name of the last updated file as the target file name corresponding to the target file; if the sum of the data size and the file size is greater than the target data segmentation threshold, adjusting the file name of the last updated file according to a preset file name adjustment rule to obtain the target file name corresponding to the target file.
[0089] In this embodiment of the disclosure, before calling the file open interface, the electronic device also needs to determine the size of the file data and the size of the last updated file to which the file data belongs.
[0090] Optionally, the file size can be the amount of data that needs to be written to the target file.
[0091] Optionally, the last updated file can be the file with the most recent update time.
[0092] Optionally, the last updated file to which the file data belongs can be the last updated file corresponding to the target file descriptor.
[0093] Specifically, before calling the file open interface through the target process, the electronic device can also obtain the size of the file data to be written to the target file and the size of the last updated file to which the file data belongs.
[0094] In some embodiments, after determining the data size and file size, the electronic device uses the file name of the last updated file as the target file name if the sum of the data size and file size is less than or equal to the target data segmentation threshold.
[0095] Optionally, the target data segmentation threshold can be the threshold at which the file data needs to be segmented. For example, the target data segmentation threshold can be 100MB, 200MB, etc., and there is no limitation here.
[0096] Specifically, after determining the data size and file size, the electronic device compares the sum of the data size and file size with the target data segmentation threshold. If the sum of the data size and file size is less than or equal to the target data segmentation threshold, the electronic device can use the file name of the last updated file as the target file name corresponding to the target file through the target process.
[0097] For example, if the target data segmentation threshold is 100MB, the electronic device can determine that the file data size is 2MB and the last updated file size is 50MB. That is, the sum of the data size and the file size is 52MB, which is less than the target data segmentation threshold of 100MB. The electronic device can then use the file name of the last updated file as the target file name, that is, use the last updated file as the target file.
[0098] In other embodiments, after determining the data size and file size, if the sum of the data size and file size is greater than the target data segmentation threshold, the electronic device adjusts the file name of the last updated file according to a preset file name adjustment rule to obtain the target file name corresponding to the target file.
[0099] Optionally, the preset file name adjustment rules can be predefined rules for adjusting file names.
[0100] For example, when there is only one file (A), the file name of file (A) can be demo.log. When the file size of demo.log file (A) exceeds the target data segmentation threshold, the electronic device can close file (A), rename demo.log file (A) to demo.1.log, obtain demo.1.log file (A), and create a new file named demo.log (B). Here, demo.log file (B) is the last updated file. Further, when the file size of demo.log file (B) also exceeds the target data segmentation threshold, the electronic device can rename the file named demo.1.log (A) to demo.2.log, obtain demo.2.log file (A), rename the file named demo.log (B) to demo.1.log, obtain demo.1.log file (B), and continue to create a new demo.log file (C). At this time, demo.log file (C) is the last updated file. Among them, (A), (B), and (C) are used to distinguish the various files and have no practical significance.
[0101] Specifically, after determining the data size and file size, the electronic device compares the sum of the data size and file size with the target data segmentation threshold. If the sum of the data size and file size is greater than the target data segmentation threshold, the electronic device can adjust the file name of the last updated file according to the preset file name adjustment rules, thereby obtaining the adjusted file, which is the target file name corresponding to the target file.
[0102] For example, taking a target data segmentation threshold of 100MB as an example, the electronic device can determine that the file data size is 10MB and the last updated file size is 95MB. That is, the sum of the data size and the file size is 105MB, which is greater than the target data segmentation threshold of 100MB. At this time, if the last updated file is named demo.log, the electronic device can adjust the name of the demo.log file (A) according to the preset file name adjustment rules to obtain the demo.1.log file (A), and recreate a file named demo.log (B) to obtain the target file name demo.log corresponding to the target file. That is, the demo.log file (B) is used as the target file.
[0103] Therefore, in this embodiment of the disclosure, the electronic device can adjust the file accordingly based on the sum of the data size and the file size, thereby reducing disk load and improving the reliability of data storage.
[0104] Optionally, the data storage method may further include: determining the remaining capacity of the storage space; using the ratio of the remaining capacity to the theoretical capacity of the storage space as an adjustment coefficient; and using the product of the adjustment coefficient and a preset data segmentation threshold as a target data segmentation threshold.
[0105] In this embodiment of the disclosure, the electronic device can determine the remaining capacity of the storage space through the target process.
[0106] Optionally, the storage space can be the space for storing files. For example, the storage space can be disk space, hard disk space, etc., and there is no limitation here.
[0107] Specifically, the electronic device queries and obtains the remaining storage capacity of the storage space.
[0108] Furthermore, after obtaining the remaining capacity of the storage space, the electronic device can use the ratio of the remaining capacity to the theoretical capacity of the storage space as an adjustment factor.
[0109] Optionally, the theoretical capacity can be a pre-set storage capacity.
[0110] Optionally, the adjustment factor can be a factor used to adjust the target data segmentation threshold.
[0111] For example, an electronic device can determine that the remaining storage capacity is 5GB and the theoretical storage capacity is 10GB, and calculate that the ratio of the remaining capacity of 5GB to the theoretical capacity of 10GB is 0.5. The electronic device can use this 0.5 as an adjustment factor.
[0112] Furthermore, after obtaining the adjustment coefficient, the electronic device can use the product of the adjustment coefficient and the preset data segmentation threshold as the target data segmentation threshold through the target process.
[0113] Optionally, the preset data segmentation threshold can be a pre-set data segmentation threshold. For example, the preset data segmentation threshold can be 200MB, 400MB, etc., and there is no limitation here.
[0114] Specifically, the electronic device can use the product of an adjustment factor and a preset data segmentation threshold as the target data segmentation threshold. For example, if the adjustment factor is 0.5 and the preset data segmentation threshold is 200MB, then the product of the adjustment factor and the preset data segmentation threshold is 100MB, meaning the target data segmentation threshold is 100MB.
[0115] Therefore, in this embodiment of the disclosure, the electronic device can dynamically adjust the target data segmentation threshold, thereby making full use of disk space without filling up the disk space, thus improving the reliability of data storage.
[0116] Optionally, before adjusting the file name of the last updated file according to the preset file name adjustment rules to obtain the target file name corresponding to the target file, the data storage method may further include: calculating the total number of historical files to which the file data belongs and the target file.
[0117] In this embodiment of the disclosure, before renaming the file name of the last updated file, the electronic device can calculate the total number of historical files and the target file to which the file data belongs.
[0118] Optionally, the historical files can be files that were updated in the past. For example, if demo.log and demo.1.log exist, demo.log and demo.1.log can be historical files; if demo.log, demo.1.log and demo.2.log exist, demo.log, demo.1.log and demo.2.log can be historical files.
[0119] Specifically, the electronic device can determine historical files and target files based on the file names, and calculate the total number of corresponding files.
[0120] Furthermore, after calculating the total number of historical files and target files, the electronic device can adjust the file name of the last updated file according to the preset file name adjustment rules, provided that the total number of files is less than or equal to the preset upper limit, so as to obtain the target file name corresponding to the target file.
[0121] Optionally, the preset quantity limit can be a pre-set quantity limit. For example, the preset quantity limit can be 3, 4, etc., which will not be elaborated here.
[0122] Specifically, after obtaining the total number of files, the electronic device can compare the total number of files with the preset maximum number. If the total number of files is less than or equal to the preset maximum number, the electronic device can adjust the file name of the last updated file according to the preset file name adjustment rules to obtain the target file name corresponding to the target file.
[0123] For example, taking a preset maximum number of files of 3 as an example, if there are files demo.log and demo.1.log, the electronic device can obtain the number of historical files as 2, and calculate the total number of historical files and target files as 3, which is equal to the preset maximum number. Then, the electronic device can adjust the demo.log file to demo.1.log file according to the preset file name adjustment rules, adjust the demo.1.log file to demo.2.log file, and create the demo.log file.
[0124] Therefore, in this embodiment of the disclosure, when the total number of files is less than or equal to a preset upper limit, the names can be adjusted to ensure that the total number of files does not exceed the preset upper limit and reduce disk load.
[0125] Optionally, after calculating the total number of historical files and the target file to which the file data belongs, the data storage method may further include: if the total number of files exceeds a preset upper limit, deleting the target historical file with the longest storage time among the historical files; renaming the remaining historical files according to a preset renaming rule; and using the file name of the last updated file as the target file name corresponding to the target file.
[0126] Specifically, after obtaining the total number of files, the electronic device can compare the total number of files with a preset limit through the target process. If the total number of files is greater than the preset limit, the electronic device can delete the target historical file that has been stored for the longest time in the historical files.
[0127] Optionally, the target history file can be the history file with the longest storage time.
[0128] For example, if the preset maximum number is 3, and there are files demo.log, demo.1.log, and demo.2.log, the electronic device can determine that the number of historical files is 3, and calculate that the total number of historical files and target files is 4, which is greater than the preset maximum number. At this point, the electronic device can delete the target historical file that has been stored the longest, i.e., delete the demo.2.log file.
[0129] Furthermore, after deleting the target historical file that has been stored the longest in the historical files, the electronic device can rename the remaining historical files according to the preset renaming rules through the target process.
[0130] Optionally, the default renaming rule can be a pre-defined renaming rule.
[0131] For example, if there are files demo.log, demo.1.log, and demo.2.log, the electronic device can calculate that the total number of historical files and target files is 4. At this time, the target historical file with the longest storage time can be deleted, that is, the demo.2.log file can be deleted. According to the preset renaming rules, the file names of the remaining historical files are renamed, that is, demo.log is renamed to demo.1.log, demo.1.log is renamed to demo.2.log, and a new demo.log file is created.
[0132] Furthermore, after renaming the remaining historical files according to the preset renaming rules, the electronic device can use the file name of the last updated file as the target file name corresponding to the target file through the target process.
[0133] For example, an electronic device can use the created demo.log file as the target file, that is, use the file name demo.log as the target file name.
[0134] Therefore, in this embodiment of the disclosure, when the total number of files exceeds the preset limit, the target historical files are deleted to ensure that the total number of files does not exceed the preset limit and to reduce disk load.
[0135] In some embodiments of this disclosure, when an electronic device calls various interfaces, it needs to do so through the corresponding interface call command, which will be described in detail below.
[0136] In some embodiments, when the file open interface is invoked, the method includes: sending an open interface invocation command carrying the target file name to a second queue, the second queue being used to enable the asynchronous command management process to obtain the open interface invocation command and invoke the file open interface in response to the open interface invocation command.
[0137] In this embodiment of the disclosure, the electronic device can send an open interface call command carrying the target file name to the second queue through the target process.
[0138] Optionally, the second queue can be a queue used to store interface call commands.
[0139] Optionally, the open interface call command can be a command used to call the file open interface.
[0140] Optionally, the asynchronous command management process can be a process used to execute interface call commands.
[0141] Specifically, the electronic device can send an open interface call command carrying the target file name to the second queue. The second queue can receive and store the open interface call command. The asynchronous command management process can obtain the open interface call command stored in the second queue and call the corresponding file open interface in response to the open interface call command.
[0142] In other embodiments, when the file write interface is invoked, the method includes: sending a write interface invocation command carrying a target file descriptor to a second queue, the second queue being used to enable the asynchronous command management process to obtain the write interface invocation command and invoke the file write interface in response to the write interface invocation command.
[0143] In this embodiment of the disclosure, the electronic device can send a write interface call command carrying a target file descriptor to the second queue through the target process.
[0144] Optionally, the write interface call command can be a command used to invoke the file write interface.
[0145] Specifically, the electronic device can send a write interface call command carrying a target file descriptor to the second queue. The second queue can receive and store the write interface call command. The asynchronous command management process can obtain the write interface call command stored in the second queue and call the corresponding file write interface in response to the write interface call command.
[0146] In some other embodiments, when the file closing interface is invoked, the method includes: sending a closing interface invocation command carrying a target file descriptor to a second queue, the second queue being used to enable the asynchronous command management process to obtain the closing interface invocation command and invoke the file closing interface in response to the closing interface invocation command.
[0147] In this embodiment of the disclosure, the electronic device can send a close interface call command carrying a target file descriptor to the second queue through the target process.
[0148] Optionally, the command to close the interface can be a command used to close the interface for a file.
[0149] Specifically, the electronic device can send a close interface call command carrying a target file descriptor to the second queue. The second queue can receive and store the close interface call command. The asynchronous command management process can obtain the close interface call command stored in the second queue and call the corresponding file close interface in response to the close interface call command.
[0150] Therefore, in this embodiment of the disclosure, when calling an interface, the corresponding interface call command can be stored in a second queue. The asynchronous command management process asynchronously retrieves each interface call command stored in the second queue and calls the corresponding interface, thereby avoiding call conflicts between interface call commands and improving the calling efficiency of the interface.
[0151] Figure 2 A flowchart illustrating another data storage method provided in an embodiment of this disclosure is shown.
[0152] like Figure 2 As shown, this data storage method can be applied to the first thread and includes the following steps.
[0153] S210: Receive a file open command sent by the target process. The file open command carries the target file name corresponding to the target file.
[0154] In this embodiment of the disclosure, the first thread can receive a file open command sent by the target process.
[0155] Specifically, the electronic device can receive a file open command sent by the target process through the first thread, and obtain the target file name corresponding to the target file carried by the file open command.
[0156] S220. Based on the list of opened files, determine the target file descriptor corresponding to the target file name.
[0157] In this embodiment of the disclosure, after the electronic device receives the file open command sent by the target process through the first thread, the target file descriptor corresponding to the target file name can be determined based on the file list of already opened files.
[0158] Specifically, after the electronic device receives the file open command sent by the target process through the first thread, the first thread can search for the target file corresponding to the target file name in the list of opened files, and after finding the target file corresponding to the target file name, obtain the target file descriptor corresponding to the target file name.
[0159] S230. Feed back the target file descriptor to the target process so that the target process can write the file data to be stored to the target file based on the target file descriptor.
[0160] In this embodiment of the disclosure, after the electronic device obtains the target file descriptor through the first thread, it can send the target file descriptor back to the target process.
[0161] Specifically, after the electronic device obtains the target file descriptor through the first thread, it can send the target file descriptor back to the target process. The target process can then write the file data to be stored to the corresponding target file based on the target file descriptor.
[0162] Therefore, in this embodiment of the disclosure, the first thread can directly return the target file descriptor corresponding to the target file name, avoiding the blocking problem of the synchronous interface, thereby avoiding the situation of interface call timeout and improving the reliability of data storage.
[0163] Optionally, S220 may specifically include: querying the target file name in the file list; if the target file name is found, reading the target file descriptor corresponding to the target file name from the file list; if the target file name is not found, storing the target file name in the file list, and using the storage unit identifier corresponding to the target file name as the target file descriptor.
[0164] In some embodiments, after receiving a file open command, the first thread can query the target file name in the list of opened files. If the target file name is found, the target file descriptor corresponding to the target file name is read from the file list.
[0165] Specifically, after receiving the file open command, the first thread can search for the target file name in the list of opened files. If the first thread finds the target file name in the file list, it can directly read the target file descriptor corresponding to the target file name in the file list and send the target file descriptor back to the target process.
[0166] In other embodiments, after receiving the file open command, the first thread can query the target file name in the list of opened files. If the target file name is not found, the target file name is stored in the file list, and the storage unit identifier corresponding to the target file name is used as the target file descriptor.
[0167] Optionally, the storage unit identifier can be an identifier for a unit that stores the name of the target file. For example, the storage unit identifier can be a sequence number, label, etc., and there is no limitation here.
[0168] Specifically, after receiving the file open command, the first thread can search for the target file name in the list of opened files. If the first thread does not find the target file name in the file list, it can store the target file name in the file list and use the identifier of the unit in the file list that stores the target file name, i.e. the storage unit identifier, as the target file descriptor corresponding to the target file name, and feed back the target file descriptor to the target process.
[0169] Optionally, after using the storage unit identifier corresponding to the target file name as the target file descriptor, the data storage method may further include: sending a file open command to a second thread, the file open command including the target file name, the file open command being used to cause the second thread to open the target file corresponding to the target file name when the target file is not an open file, or to create and open the target file corresponding to the target file name when the target file is not a created file.
[0170] In some embodiments, after the first thread does not find the target file name in the file list and stores the target file name in the file list, it can send a file open command to the second thread. After receiving the file open command, the second thread can determine the status of the target file corresponding to the target file name in the file open command. If the target file is an unopened file, the second thread can respond to the file open command and open the target file corresponding to the target file name.
[0171] In other embodiments, after the first thread does not find the target file name in the file list and stores the target file name in the file list, it can send a file open command to the second thread. After receiving the file open command, the second thread can determine the status of the target file corresponding to the target file name in the file open command. If the target file is not created, the second thread can respond to the file open command, create and open the target file corresponding to the target file name.
[0172] Therefore, in this embodiment of the disclosure, the first thread can open or create the corresponding target file through the second thread, thereby achieving non-blocking file opening or creation operations, thus avoiding interface call timeouts and improving the reliability of data storage.
[0173] Figure 3 A schematic diagram of the structure of a data storage device provided in an embodiment of this disclosure is shown.
[0174] like Figure 3 As shown, the data storage device 300 may include a first calling module 310 and a second calling module 320.
[0175] The first calling module 310 can be used to call the file open interface to send the file open command corresponding to the file open interface to the first thread. The file open command carries the target file name corresponding to the target file. The file open command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of opened files.
[0176] The second calling module 320 can be used to call the file writing interface to send the file writing command corresponding to the file writing interface to the second thread. The file writing command carries the target file descriptor and the file data to be stored. The file writing command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name.
[0177] Therefore, in this embodiment of the disclosure, a file open interface can be invoked to send a file open command corresponding to the file open interface to a first thread. This file open command carries the target file name corresponding to the target file. This file open command can also be used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of already opened files. The file write interface can then be invoked to send a file write command corresponding to the file write interface to a second thread. This file write command carries the target file descriptor and the file data to be stored. This file write command enables the second thread to query the target file name in the file list based on the target file descriptor and write the file data to the target file corresponding to the target file name. Thus, when the file open interface is invoked to open a file, the first thread, which maintains the file list of already opened files, can independently respond to and execute the file write command and directly return the target file descriptor corresponding to the target file name. This avoids the blocking problem of synchronous interfaces, thereby preventing interface call timeouts and improving the reliability of data storage.
[0178] In some embodiments of this disclosure, when the target file is an opened file, the target file descriptor is a file descriptor already stored in the file list; when the target file is an unopened file or has not been created, the target file descriptor is a file descriptor added to the file list for the target file.
[0179] In some embodiments of this disclosure, the file open command is also used to enable the first thread to open the target file corresponding to the target file name through the second thread when the target file is not an open file, or to create and open the target file corresponding to the target file name through the second thread when the target file is not a created file.
[0180] In some embodiments of this disclosure, the second calling module 320 may include a first calling unit.
[0181] The first calling unit can be used to call the file writing interface to send a file writing command to the first queue, which is used to enable the second thread to obtain the file writing command.
[0182] In some embodiments of this disclosure, the data storage device 300 may further include a third calling module.
[0183] The third calling module can be used to call the file close interface after calling the file write interface to send the file write command corresponding to the file write interface to the second thread, in order to send the file close command corresponding to the file close interface to the second thread. The file close command carries the target file descriptor and is used to enable the second thread to query the target file name in the file list based on the target file descriptor and close the target file corresponding to the target file name.
[0184] In some embodiments of this disclosure, the third calling module may include a second calling unit.
[0185] The second calling unit can be used to call the file closing interface to send a file closing command to the first queue, which is used to enable the second thread to obtain the file closing command.
[0186] In some embodiments of this disclosure, the data storage device 300 may further include a second determining module, a first processing module, and a second processing module.
[0187] The second determining module can be used to determine the size of the file data and the size of the last updated file to which the file data belongs before calling the file open interface to send the file open command corresponding to the file open interface to the first thread.
[0188] The first processing module can be used to use the file name of the last updated file as the target file name when the sum of the data size and the file size is less than or equal to the target data segmentation threshold.
[0189] The second processing module can be used to adjust the name of the last updated file according to a preset file name adjustment rule when the sum of the data size and the file size is greater than the target data segmentation threshold, so as to obtain the target file name corresponding to the target file.
[0190] In some embodiments of this disclosure, the data storage device 300 may further include a third determining module, a third processing module, and a fourth processing module.
[0191] This third determining module can be used to determine the remaining capacity of the storage space.
[0192] This third processing module can be used as an adjustment factor to use the ratio of the remaining capacity to the theoretical capacity of the storage space.
[0193] The fourth processing module can be used to take the product of the adjustment coefficient and the preset data segmentation threshold as the target data segmentation threshold.
[0194] In some embodiments of this disclosure, the data storage device 300 may further include a total count module.
[0195] This total count module can be used to calculate the total number of historical files and the target file to which the file data belongs before adjusting the file name of the last updated file according to the preset file name adjustment rules to obtain the target file name corresponding to the target file.
[0196] In some embodiments of this disclosure, the second processing module can be specifically used to adjust the name of the last updated file according to a preset file name adjustment rule when the total number of files is less than or equal to a preset upper limit, so as to obtain the target file name corresponding to the target file.
[0197] In some embodiments of this disclosure, the data storage device 300 may further include a file deletion module, a fifth processing module, and a sixth processing module.
[0198] This file deletion module can be used to delete the target historical file with the longest storage time among the historical files if the total number of files exceeds a preset limit after calculating the total number of historical files and the target file to which the file data belongs.
[0199] This fifth processing module can be used to rename the remaining historical files according to preset renaming rules.
[0200] This sixth processing module can be used to use the filename of the last updated file as the target filename corresponding to the target file.
[0201] In some embodiments of this disclosure, the data storage device 300 may further include a first transmitting module, a second transmitting module, and a third transmitting module.
[0202] The first sending module can be used to send an open interface call command carrying the target file name to the second queue. The second queue is used to enable the asynchronous command management process to obtain the open interface call command and call the file open interface in response to the open interface call command.
[0203] The second sending module can be used to send a write interface call command carrying a target file descriptor to a second queue. The second queue is used to enable the asynchronous command management process to obtain the write interface call command and call the file write interface in response to the write interface call command.
[0204] The third sending module can be used to send a close interface call command carrying a target file descriptor to the second queue. The second queue is used to enable the asynchronous command management process to obtain the close interface call command and call the file close interface in response to the close interface call command.
[0205] It should be noted that, Figure 3 The data storage device 300 shown can perform Figure 1 The various steps in the method embodiment shown are implemented. Figure 1 The processes and effects in the method embodiments shown are not described in detail here.
[0206] Figure 4A schematic diagram of another data storage device provided in an embodiment of this disclosure is shown.
[0207] like Figure 4 As shown, the data storage device 400 may include a command receiving module 410, a first determining module 420, and a first feedback module 430.
[0208] The command receiving module 410 can be used to receive file open commands sent by the target process. The file open command carries the target file name corresponding to the target file.
[0209] The first determining module 420 can be used to determine the target file descriptor corresponding to the target file name based on the file list of opened files.
[0210] The first feedback module 430 can be used to feed back the target file descriptor to the target process, so that the target process can write the file data to be stored to the target file based on the target file descriptor.
[0211] In some embodiments of this disclosure, the first determining module 420 may include a name query unit, a first processing unit, and a second processing unit.
[0212] This name lookup unit can be used to search for the name of a target file in a file list.
[0213] The first processing unit can be used to read the target file descriptor corresponding to the target file name from the file list if the target file name is found.
[0214] The second processing unit can be used to store the target file name in the file list if the target file name is not found, and use the storage unit identifier corresponding to the target file name as the target file descriptor.
[0215] In some embodiments of this disclosure, the first determining module 420 may include a command sending unit.
[0216] The command sending unit can be used to send a file open command to the second thread after using the storage unit identifier corresponding to the target file name as the target file descriptor. The file open command includes the target file name. The file open command is used to enable the second thread to open the target file corresponding to the target file name when the target file is not an open file, or to create and open the target file corresponding to the target file name when the target file is not created.
[0217] It should be noted that, Figure 4 The data storage device 400 shown can perform... Figure 2 The various steps in the method embodiment shown are implemented. Figure 2The processes and effects in the method embodiments shown are not described in detail here.
[0218] Figure 5 A schematic diagram of the structure of a data storage device provided in an embodiment of this disclosure is shown.
[0219] In some embodiments of this disclosure, Figure 5 The data storage device shown can be any electronic device that a user wants to store data on. Specifically, the electronic device can include, but is not limited to, mobile terminals such as mobile phones, in-vehicle devices, vehicle controllers, tablets, wearable devices, and smart home devices.
[0220] like Figure 5 As shown, the data storage device may include a processor 501 and a memory 502 storing computer program instructions.
[0221] Specifically, the processor 501 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0222] Memory 502 may include a large-capacity storage for information or instructions. For example, and not limitingly, memory 502 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 502 may include removable or non-removable (or fixed) media. Where appropriate, memory 502 may be internal or external to the integrated gateway device. In a particular embodiment, memory 502 is a non-volatile solid-state memory. In a particular embodiment, memory 502 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0223] The processor 501 reads and executes computer program instructions stored in the memory 502 to perform the steps of the data storage method provided in the embodiments of this disclosure.
[0224] In one example, the data storage device may also include a transceiver 503 and a bus 504. Wherein, as... Figure 5 As shown, the processor 501, memory 502 and transceiver 503 are connected via bus 504 and communicate with each other.
[0225] Bus 504 may include hardware, software, or both. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 504 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0226] This disclosure also provides a computer-readable storage medium that can store a computer program, which, when executed by a processor, enables the processor to implement the data storage method provided in this disclosure.
[0227] The aforementioned storage medium may include, for example, a memory 502 containing computer program instructions, which can be executed by a processor 501 of the data storage device to complete the data storage method provided in this embodiment. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0228] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the term "comprising" is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0229] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data storage method, characterized in that, Applied to the target process, including: The file open interface is invoked to send the file open command corresponding to the file open interface to the first thread. The file open command carries the target file name corresponding to the target file. The file open command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of opened files. The file write interface is invoked to send a file write command corresponding to the file write interface to the second thread. The file write command carries the target file descriptor and the file data to be stored. The file write command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data into the target file corresponding to the target file name. Wherein, if the target file is an open file, the target file descriptor is a file descriptor already stored in the file list; if the target file is an unopened file or has not been created, the target file descriptor is a file descriptor added to the file list for the target file.
2. The method according to claim 1, characterized in that, The invocation of the file write interface to send the file write command corresponding to the file write interface to the second thread includes: The file write interface is invoked to send the file write command to the first queue, which is used to enable the second thread to obtain the file write command.
3. The method according to claim 1, characterized in that, After invoking the file write interface to send the file write command corresponding to the file write interface to the second thread, the method further includes: The file closing interface is invoked to send a file closing command corresponding to the file closing interface to the second thread. The file closing command carries the target file descriptor. The file closing command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and close the target file corresponding to the target file name.
4. The method according to claim 3, characterized in that, The file opening interface includes: Send an open interface call command carrying the target file name to the second queue, the second queue being used to enable the asynchronous command management process to obtain the open interface call command and call the file open interface in response to the open interface call command; The file writing interface call includes: Send a write interface call command carrying the target file descriptor to the second queue, the second queue being used to enable the asynchronous command management process to obtain the write interface call command and call the file write interface in response to the write interface call command; The invocation of the file closing interface includes: A close interface call command carrying the target file descriptor is sent to the second queue, which is used to enable the asynchronous command management process to obtain the close interface call command and call the file close interface in response to the close interface call command.
5. A data storage method, characterized in that, Applied to the first thread, including: Receive a file open command sent by the target process, wherein the file open command carries the target file name corresponding to the target file; Based on the list of already opened files, determine the target file descriptor corresponding to the target file name; The target process is fed back the target file descriptor so that the target process can write the file data to be stored into the target file based on the target file descriptor. Wherein, if the target file is an open file, the target file descriptor is a file descriptor already stored in the file list; if the target file is an closed file or has not been created, the target file descriptor is a file descriptor added to the file list for the target file. The method further includes: Send a file open command to the second thread. The file open command includes the target file name. The file open command is used to make the second thread open the target file corresponding to the target file name if the target file is not open, or to create and open the target file corresponding to the target file name if the target file has not been created.
6. A data storage device, characterized in that, Applied to the target process, including: The first calling module is used to call the file opening interface to send the file opening command corresponding to the file opening interface to the first thread. The file opening command carries the target file name corresponding to the target file. The file opening command is used to enable the first thread to return the target file descriptor corresponding to the target file name based on the file list of opened files. The second calling module is used to call the file writing interface to send the file writing command corresponding to the file writing interface to the second thread. The file writing command carries the target file descriptor and the file data to be stored. The file writing command is used to enable the second thread to query the target file name in the file list based on the target file descriptor and write the file data into the target file corresponding to the target file name. Wherein, if the target file is an open file, the target file descriptor is a file descriptor already stored in the file list; if the target file is an unopened file or has not been created, the target file descriptor is a file descriptor added to the file list for the target file.
7. A data storage device, characterized in that, Applied to the first thread, including: The command receiving module is used to receive file open commands sent by the target process, wherein the file open command carries the target file name corresponding to the target file; The first determining module is used to determine the target file descriptor corresponding to the target file name based on the file list of opened files; The first feedback module is used to feed back the target file descriptor to the target process, so that the target process writes the file data to be stored to the target file based on the target file descriptor; Wherein, if the target file is an open file, the target file descriptor is a file descriptor already stored in the file list; if the target file is an closed file or has not been created, the target file descriptor is a file descriptor added to the file list for the target file. The first determining module includes: The command sending unit is used to send a file open command to the second thread. The file open command includes the target file name. The file open command is used to enable the second thread to open the target file corresponding to the target file name when the target file is not an open file, or to create and open the target file corresponding to the target file name when the target file is not created.
8. A data storage device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the data storage method according to any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, causes the processor to implement the data storage method described in any one of claims 1-5.