A file processing method, device, equipment, storage medium, system and vehicle

By providing a unified file processing method in the persistent storage management module of the adaptive automotive open system architecture, the problem of redundancy in file read and write functions between each module is solved, and simplified file management and efficient resource utilization are achieved.

CN114153606BActive Publication Date: 2025-03-14CHINA AUTOMOTIVE INNOVATION CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111436733.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2025-03-14
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

In the adaptive automotive open system architecture, each module implements file read and write functions, resulting in redundant functions, and file format conversion and memory management are complex, increasing development workload and resource consumption.

Method used

By providing a unified file processing method in the persistent storage management module, receiving file opening requests from the file processing module, opening the target file in memory, and sending an operation handle to the file processing module, realizing file reading and writing operations.

Benefits of technology

It avoids redundancy in file read and write functions between various modules, simplifies file format conversion and memory management, reduces development workload, and improves resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153606B_ABST
    Figure CN114153606B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing technology, and in particular to a file processing method, device, equipment, storage medium, system and vehicle. The method comprises: receiving a file opening request for a target file sent by a file processing module; opening the target file in memory according to the file opening request, and sending an operation handle of the target file to the file processing module; receiving a processing object corresponding to the read-write type sent by the file processing module according to the operation handle; processing the target file according to the processing object, and sending the processing result to the file processing module. The file processing method performs functional encapsulation in a persistent storage management module, and a unified calling function is provided by the persistent storage management module to realize the file processing function, thereby avoiding the redundancy of the file reading and writing function. In addition, when the file reading and writing function is modified, only the persistent storage management module needs to be modified, which greatly reduces the development workload and saves resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file processing method, device, equipment, storage medium, system and vehicle. Background Art

[0002] The addition of autonomous driving applications makes the vehicle functions more complex. Different applications may be provided by many suppliers. Secondly, applications are becoming more and more complex, with higher and higher requirements for computing resources and performance, and require higher performance hardware to support them. Adaptive Autosar (AP) is a new software architecture platform that is highly flexible, high-performance, and supports dynamic communication. The AP architecture can not only meet the application's demand for high-performance computing but also has a certain level of functional safety. AP mainly provides high-performance computing and communication mechanisms, and provides flexible software configuration, which is mainly divided into 12 functional modules and 3 service modules.

[0003] The persistent storage management module is a functional module that provides key-value storage and file storage. Among them, file storage only provides the function of accessing file content, and the file content and format are determined by the application. This has the following problems.

[0004] First, if each module uses files of the same format, each module needs to implement the function of parsing such files. For example, each module needs to parse its own configuration file. The format of such configuration files is basically similar. If each module implements the parsing function, it will cause functional redundancy. In addition, many modules also have corresponding format requirements for writing files, which will also cause functional redundancy in format conversion.

[0005] Second, for some read-only files, such as configuration files, you may need to read them multiple times, while some may only need to be read once. If you read them once and store them in memory, and then read them directly from memory, it may cause a waste of memory for the modules that are only read once. If you read them from the file every time, there may be efficiency issues. If they are mixed, it will increase the difficulty of coding and the complexity of logic.

[0006] Third, because the same function is implemented in different modules, if this function changes, all modules need to be developed synchronously, which results in a huge development workload. Summary of the invention

[0007] The present invention provides a file processing method, device, equipment, storage medium, system and vehicle, so as to at least solve the problem of functional redundancy caused by each module in an adaptive automobile open system architecture realizing file reading and writing functions separately.

[0008] In order to solve the above technical problems, in a first aspect, an embodiment of the present application discloses a file processing method, the method comprising:

[0009] Receiving a file opening request for a target file sent by a file processing module;

[0010] Open the target file in the memory according to the file opening request, and send the operation handle of the target file to the file processing module;

[0011] The receiving file processing module sends a processing object corresponding to the read / write type according to the operation handle;

[0012] The target file is processed according to the processing object and the processing result is sent to the file processing module.

[0013] Further, when the read-write type is a read type, the target file is processed according to the processing object, including:

[0014] Perform read operation on target file according to the processing object.

[0015] Further, the processing object is the primary key; and the processing of the file read operation on the target file according to the processing object includes:

[0016] Parse the contents of the target file according to the primary key;

[0017] Get the parameters corresponding to the primary key according to the content of the target file.

[0018] Further, when the read-write type is a write type, the target file is processed according to the processing object, including:

[0019] Write the target file to the target file according to the processing object.

[0020] Furthermore, the processing object is structured data; and the processing of writing a file to a target file according to the processing object includes:

[0021] Determine a format template corresponding to the structured data according to the structured data; the format template is pre-configured in the persistent storage management module according to the storage format of the target file;

[0022] Writes structured data to a target file according to a format template.

[0023] Furthermore, before writing the structured data into the target file according to the format template, the method further includes:

[0024] If the format template corresponding to the structured data is not found, an error prompt message is sent to the file processing module.

[0025] Further, opening the target file in the memory according to the file opening request includes:

[0026] Determine a target file in a storage disk according to a file open request;

[0027] Open the target file in memory.

[0028] Furthermore, before opening the target file in memory, it also includes:

[0029] When the target file is determined in the storage disk, the size of the memory required to open the target file and the size of the remaining storage space in the memory are determined;

[0030] If the remaining storage space is less than the open memory, the occupied memory is released so that the target file can be opened in the memory.

[0031] Furthermore, the occupied memory is released, including:

[0032] Determine the files to be released in the memory based on the elimination algorithm;

[0033] Close the file to be released to release the occupied memory.

[0034] In a second aspect, an embodiment of the present application discloses a file processing device, the device comprising:

[0035] A file opening request receiving unit, used for receiving a file opening request for a target file sent by a file processing module;

[0036] A target file determination unit, used to open the target file in the memory according to the file opening request, and send an operation handle of the target file to the file processing module;

[0037] A processing object receiving unit, used for receiving a processing object corresponding to a read-write type sent by a file processing module according to an operation handle;

[0038] The target file processing unit is used to process the target file according to the processing object and send the processing result to the file processing module.

[0039] In some optional implementations, when the read-write type is a read type, the target file processing unit includes:

[0040] The file reading processing subunit is used to process the file reading operation on the target file according to the processing object.

[0041] In some optional implementations, the processing object is a primary key; and the file reading processing subunit includes:

[0042] The target file parsing subunit is used to parse the content of the target file according to the primary key;

[0043] The parameter acquisition subunit is used to obtain the parameter corresponding to the primary key according to the content of the target file.

[0044] In some optional implementations, when the read-write type is a write type, the target file processing unit includes:

[0045] The file writing processing subunit is used to process the file writing operation on the target file according to the processing object.

[0046] In some optional implementations, the processing object is structured data; the file writing processing subunit includes:

[0047] The format template determination subunit is used to determine the format template corresponding to the structured data according to the structured data; the format template is pre-configured in the persistent storage management module according to the storage format of the target file;

[0048] The target file writing subunit is used to write structured data into the target file according to the format template.

[0049] In some optional implementations, the file writing processing subunit further includes:

[0050] The error prompt information sending subunit is used to send an error prompt information to the file processing module if the format template corresponding to the structured data is not found.

[0051] In some optional implementations, the target file determination unit includes:

[0052] A target file disk determination subunit is used to determine a target file in a storage disk according to a file opening request;

[0053] The target file opening subunit is used to open the target file in the memory.

[0054] In some optional implementations, the target file determination unit further includes:

[0055] The storage space determination subunit is used to determine the size of the open memory required to open the target file and the size of the remaining storage space in the memory when the target file is determined in the storage disk;

[0056] The memory release subunit is used to release the occupied memory if the remaining storage space is less than the open memory, so that the target file can be opened in the memory.

[0057] In some optional implementations, the memory release subunit includes:

[0058] An occupied file determination subunit, used to determine the files to be released in the memory based on an elimination algorithm;

[0059] The occupied memory release subunit is used to close the file to be released to release the occupied memory.

[0060] In a third aspect, an embodiment of the present application discloses an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded by the processor and executes the file processing method as described above.

[0061] In a fourth aspect, an embodiment of the present application discloses a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the file processing method as described above.

[0062] In a fifth aspect, an embodiment of the present application discloses a file processing system, the system comprising a persistent storage management module and at least one file processing module;

[0063] The persistent storage management module is used to receive a file opening request for a target file sent by the file processing module;

[0064] The persistent storage management module is also used to open the target file in the memory according to the file opening request, and send the operation handle of the target file to the file processing module;

[0065] The persistent storage management module is also used to receive the processing object corresponding to the read-write type sent by the file processing module according to the operation handle;

[0066] The persistent storage management module is also used to process the target file according to the processing object and send the processing result to the file processing module.

[0067] In a sixth aspect, an embodiment of the present application discloses a vehicle, the vehicle comprising the file processing system as described above.

[0068] The file processing method, device, equipment, storage medium, system and vehicle provided in the embodiments of the present application have the following technical effects:

[0069] The file processing method performs functional encapsulation in the persistent storage management module, and the persistent storage management module provides a unified calling function to realize the file processing function. When other modules in the adaptive automotive open system architecture need to read and write files, the persistent storage management module performs file parsing or writes files by sending a request, so there is no need to implement the file reading and writing function in each module, avoiding the redundancy of the file reading and writing function. In addition, when the file reading and writing function is modified, only the calling function in the persistent storage management module needs to be modified, which greatly reduces the development workload and saves resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0071] Figure 1 is a schematic diagram of an application environment provided by an embodiment of the present application;

[0072] Figure 2 It is a flowchart of a file processing method provided by an embodiment of the present application;

[0073] Figure 3 It is a flowchart of a file reading method provided in an embodiment of the present application;

[0074] Figure 4 This is a flowchart of a method for writing a file provided in an embodiment of the present application;

[0075] Figure 5 is a structural schematic diagram of a file processing device provided in an embodiment of the present application;

[0076] Figure 6 It is a structural schematic diagram of a file processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0077] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0078] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0079] At present, the persistent storage management module in the adaptive automotive open system architecture only provides the function of accessing file content, but does not have the function of reading and writing files. The functions of reading and writing files are implemented by other functional modules in their respective modules. This leads to functional redundancy of reading and writing files. In addition, based on the configuration file reading function implemented by the current automotive open system architecture, since some configuration files are read less frequently and some configuration files are read more frequently, if all configuration files are stored in the memory, for the configuration files that are read less frequently, it will cause a waste of memory. However, if the configuration files are not stored in the memory, for the configuration files that are read more frequently, the configuration files must be parsed every time, resulting in low efficiency.

[0080] In view of this, an embodiment of the present application provides a file processing method to optimize redundant functions such as file parsing and format conversion in each module of the adaptive automotive open system architecture, while making a balanced optimization between the efficiency of reading configuration files and memory usage restrictions.

[0081] See also Figure 1 , Figure 1 : is a schematic diagram of an application environment provided by an embodiment of the present application. The adaptive automotive open system architecture includes one or more file processing modules and a persistent storage management module. The file processing module is a module for file processing, and the persistent storage management module is a module for file storage. The persistent storage management module also provides file storage, file reading, file writing and other functions for the file processing module. The persistent storage management module encapsulates a unified call function, and the file processing module obtains parameters in the file or writes fixed-format file content into the file through the unified call function.

[0082] The following describes a specific embodiment of a file processing method of the present application. Figure 2 It is a flowchart of a file processing method provided by an embodiment of the present application. This specification provides method operation steps such as the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or server product is executed, it can be executed in the order of the method shown in the embodiment or the accompanying drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Specifically, Figure 2 As shown, the file processing method is applied to the persistent storage management module, and the method may include:

[0083] S201: Receive a file opening request for a target file sent by a file processing module.

[0084] In the embodiment of the present application, when the file processing module needs to read or write a file, the file processing module first sends a request to open the file to the persistent storage management module, so that the persistent storage management module opens the file to be read or the file to be written in the memory. Specifically, the file opening request sent by the file processing module carries a function input parameter, and the file processing module calls the unified call function in the persistent storage management module through the application programming interface (API) of the persistent storage management module to open the file storage. Optionally, the function input parameter includes the file name and the file type.

[0085] S203: Open the target file in the memory according to the file opening request, and send the operation handle of the target file to the file processing module.

[0086] In the embodiment of the present application, after receiving the file opening request, the persistent storage management module searches for the target file in the memory by uniformly calling a function according to the file name and file type carried in the file request. If the target file has been opened in the memory, the persistent storage management module directly sends the manipulation handle of the target file to the file processing module. If it has not been opened in the memory, the persistent storage management module determines the target file in the storage disk according to the file opening request, that is, according to the file name and file type, and then opens the target file in the memory.

[0087] In an optional implementation, the persistent storage management module also includes a process of optimizing the memory before opening the target file in the memory. When the persistent storage management module determines the target file in the storage disk, it determines the size of the open memory required to open the target file and the size of the remaining storage space in the memory. And judge whether the remaining storage space is sufficient for the target file to be opened in the memory according to the size of the open memory and the remaining storage space. If the remaining storage space is less than the open memory, the occupied memory is released so that the target file can be opened in the memory. Specifically, releasing the occupied memory may include: the persistent storage management module determines the file to be released in the memory based on the elimination algorithm, and then closes the file to be released to release the occupied memory. Optionally, the elimination algorithm may be an LRU (Least recently used) algorithm, that is, a least recently used algorithm. That is, the file to be released is determined based on the historical access record of the data. Optionally, the elimination algorithm may also be a FIFO (First Input First Output) algorithm, that is, a first-in first-out algorithm. Optionally, the elimination algorithm may also be an LFU (Least Frequently Used) algorithm, that is, a least frequently used algorithm. It is understandable that, under the premise of sufficient memory, all files can be stored in the memory. In this implementation, by optimizing the memory, the configuration files that are read more frequently are always stored in the memory, which avoids the waste of memory resources on the one hand and improves the file reading efficiency on the other hand.

[0088] S205: Receive a processing object corresponding to the read / write type sent by the file processing module according to the operation handle.

[0089] In an embodiment of the present application, after the file processing module receives the operation handle of the target file sent by the persistent storage management module, the file processing module uses the operation handle to send a processing object to the persistent storage management module so that the persistent storage management module processes the target file. The processing object is related to the processing process to be performed by the file processing module, that is, it is related to the read-write type. For example, if the read-write type is a read type, it indicates that the file processing module needs to read the target file, and the processing object sent to the persistent storage management module is a primary key or key-value pair request. If the read-write type is a write type, it indicates that the file processing module needs to write to the target file, and the processing object sent to the persistent storage management module is structured data.

[0090] S207: Process the target file according to the processing object, and send the processing result to the file processing module.

[0091] In an embodiment of the present application, after the persistent storage management module receives the processing object, it performs a read file operation or a write file operation on the target file according to the processing object, specifically a file parsing or a file writing operation, and sends the processing result to the file processing module after executing the file parsing or the file writing operation.

[0092] In the embodiment of the present application, if the file processing module needs to read the target file, the persistent storage management module processes the file read operation on the target file according to the processing object. That is, the processing object sent by the file processing module to the persistent storage management module is a primary key or a key-value pair request, and the process of the persistent storage management module processing the target file according to the processing object can be: the persistent storage management module parses the content of the target file according to the primary key, and the persistent storage management module sends the parameters corresponding to the primary key to the file processing module according to the content of the target file.

[0093] In an embodiment of the present application, if the file processing module needs to write to the target file, that is, the processing object sent by the file processing module to the persistent storage management module is structured data. The process of the persistent storage management module processing the target file according to the processing object can be: the persistent storage management module determines the format template corresponding to the structured data according to the structured data, and the format template is pre-configured in the persistent storage management module according to the storage format of the target file. Then the persistent storage management module writes the structured data to the target file according to the format template. When the persistent storage management module determines the format template corresponding to the structured data according to the structured data, if the format template corresponding to the structured data is not found, an error prompt message is sent to the file processing module.

[0094] As an optional implementation, Figure 3 is a flowchart of a file reading method provided by an embodiment of the present application, such as Figure 3 As shown, the process of reading a file may include:

[0095] S301: The file processing module sends a file opening request, which carries function input parameters including the file name and file type.

[0096] In an embodiment of the present application, when the file processing module needs to read a file, the file processing module first sends a request to open the file to the persistent storage management module, so that the persistent storage management module opens the file to be read or written in the memory.

[0097] S303: The persistent storage management module searches for the target file in the memory by uniformly calling the function according to the function input parameters.

[0098] In the embodiment of the present application, the unified call function is a function set, which includes multiple functions for implementing different functions. After receiving the function input parameter, the persistent storage management module searches for the target file in the memory through the search function in the unified call function.

[0099] S305: The persistent storage management module determines whether the target file has been opened in the memory.

[0100] In the embodiment of the present application, the persistent storage management module determines whether the target file has been opened in the memory by searching. If the target file has been opened in the memory, the process goes to step S307; if the target file has not been opened in the memory, the process goes to step S309.

[0101] S307: The persistent storage management module sends the operation handle of the target file to the file processing module.

[0102] In the embodiment of the present application, if the target file has been opened in the memory, the persistent storage management module directly sends the operation handle of the target file to the file processing module. The file processing module can process the target file by using the operation handle sent by the persistent storage operation module.

[0103] S309: The persistent storage management module searches whether the target file exists.

[0104] In the embodiment of the present application, if the target file is not opened in the memory, the persistent storage management module needs to determine whether the target file exists. Specifically, the persistent storage management module determines whether the target file exists in the storage disk through a search function, and if so, goes to step S313, and if not, goes to step S311.

[0105] S311: The persistent storage management module sends an error code to the file processing module.

[0106] In the embodiment of the present application, if the persistent storage management module does not find the target file in the storage disk through the search function, it sends an error code to the file processing module. After receiving the error code, the file processing module can confirm whether the input function parameters are incorrect.

[0107] S313: The persistent storage management module determines whether the remaining storage space is sufficient to open the target file.

[0108] In the embodiment of the present application, after the persistent storage management module finds the target file in the storage disk through the search function, it first needs to determine whether the remaining storage space is sufficient to open the target file. Specifically, the persistent storage management module determines the target file's open memory size and the remaining storage space size in the memory, and determines whether the remaining storage space is sufficient to open the target file by comparison. If the remaining storage space is sufficient to open the target file, go to step S317. If the remaining storage space is not enough to open the target file, go to step S315.

[0109] S315: The persistent storage management module uses the LRU algorithm to release the earliest and least used file memory so that the remaining storage space is sufficient to open the target file.

[0110] In the embodiment of the present application, if the remaining storage space is not enough to open the target file, the persistent storage management module uses the LRU algorithm to release the earliest and least used file memory so that the remaining storage space is sufficient to open the target file. In this step, the algorithm used can also be an elimination algorithm such as a FIFO algorithm and an LFU algorithm.

[0111] S317: The persistent storage management module parses the target file content and loads it into the memory.

[0112] In an embodiment of the present application, when the remaining storage space is sufficient to open the target file, the target file is parsed and the content of the target file is loaded into the memory so that the subsequent file processing module can obtain the key value or key-value pair in the file content.

[0113] S319: The persistent storage management module sends the operation handle of the target file to the file processing module.

[0114] In an embodiment of the present application, after the target file is opened in the memory, the persistent storage management module sends the operation handle of the target file to the file processing module so that the file processing module uses the operation handle to obtain the corresponding value.

[0115] S321: The file processing module sends a primary key or key-value pair request to the persistent storage management module.

[0116] In an embodiment of the present application, after the file processing module obtains the operation handle of the target file, it uses the operation handle to send a primary key or key-value pair request to the persistent storage management module, wherein the primary key is used to obtain the value corresponding to the primary key in the target file, and the key-value pair request is used to obtain all key-value pairs in the target file.

[0117] S323: The persistent storage management module sends a value or a key-value pair to the file processing module.

[0118] In the embodiment of the present application, after receiving the primary key or key-value pair request sent by the file processing module, the persistent storage management module obtains the value corresponding to the primary key or all key-value pairs in the target file by uniformly calling the acquisition function in the function. As an example, the content in the target file is as follows:

[0119] {

[0120] "id":1,

[0121] "message":"hello"

[0122] }

[0123] A general function (get) is implemented in the persistent storage management module. You can use get("id") to get the value 1 in the configuration file, and use get("message") to get the value hello in the configuration file. Then the persistent storage management module sends the value "1" or the value "hello" to the file processing module.

[0124] The file reading method described in the embodiment of the present application implements file reading and parsing by the persistent storage management module, and the file processing module can obtain the corresponding parameters through the primary key or key-value pair request, without having to implement the file parsing function in each file processing module, thereby avoiding the redundancy of the file parsing function. In addition, the persistent storage management module places the files with high frequency of use in the memory, which is convenient for the use of the file processing module and improves efficiency on the one hand, and avoids the files with low frequency of use occupying the memory and causing memory waste on the other hand.

[0125] As another optional implementation, Figure 4 is a flowchart of a method for writing a file provided in an embodiment of the present application, such as Figure 4 As shown, the process of writing a file may include:

[0126] S401: The file processing module sends a file opening request, which carries function input parameters including the file name and file type.

[0127] In an embodiment of the present application, when the file processing module needs to write a file, the file processing module first sends a request to open the file to the persistent storage management module, so that the persistent storage management module opens the file to be read or written in the memory.

[0128] S403: The persistent storage management module opens the target file in the memory according to the function input parameters and the unified calling function.

[0129] In an embodiment of the present application, when writing a file, the persistent storage management module needs to open the target file in memory first. Similar to the file reading process, the persistent storage management module first determines whether the target file has been opened in the memory. When the target file has been opened in the memory, the persistent storage management module can directly send the operation handle of the target file to the file. When the target file is not opened in the memory, the persistent storage management module searches for the target file in the storage disk according to the received function input parameters by uniformly calling the search function in the function, and then opens the target file in the memory. If the persistent storage management module does not find the target file in the storage disk, an error code is sent to the file processing module. The file processing module can confirm whether the input function input parameters are incorrect after receiving the error code.

[0130] In the embodiment of the present application, unlike the file reading process, when writing a file, the persistent storage management module does not need to parse the target file, but only needs to open the target file in the memory.

[0131] S405: The persistent storage management module sends the operation handle of the target file to the file processing module.

[0132] In the embodiment of the present application, after the persistent storage management module opens the target file in the memory, the persistent storage management module sends the operation handle of the target file to the file processing module that needs to write the file.

[0133] S407: The file processing module sends the structured data for writing the file and the stored file format to the persistent storage management module.

[0134] In an embodiment of the present application, after the file processing module obtains the operation handle of the target file, it uses the operation handle to send structured data to the persistent storage management module, and at the same time sends the file format to be written to the persistent storage management module.

[0135] S409: The persistent storage management module searches for a configured template according to the file format.

[0136] In the embodiment of the present application, the persistent storage management module is pre-configured with file writing templates in different formats, for example, templates in json, xml, etc. The persistent storage management module uses a unified calling function to search for the pre-configured template according to the file format.

[0137] S411: The persistent storage management module determines whether the template exists.

[0138] In the embodiment of the present application, the persistent storage management module determines whether a template of this format exists by searching for a pre-configured template. If so, the process proceeds to step S415; if not, the process proceeds to step S413.

[0139] S413: The persistent storage management module sends an error code to the file processing module.

[0140] In an embodiment of the present application, if the file format that the structured data needs to be saved in does not have a corresponding template pre-configured in the persistent storage management module, that is, the persistent storage management module does not find a template of the corresponding file format, an error prompt message is sent to the file processing module.

[0141] S415: The persistent storage management module combines the structured data and the configured template into a file in a fixed format.

[0142] In an embodiment of the present application, if the persistent storage management module determines a template corresponding to a file format in which the structured data needs to be saved, the persistent storage management module combines the structured data and the configured template into a file of a fixed format for storage.

[0143] As an example, the structured data sent by the file processing module to the persistent storage management module is as follows:

[0144]

[0145] This example is a memory pointer of a structure definition variable. In this example, the structured data is &book. The file processing module needs to write the structured data into the target file in the json file format. The persistent storage management module first determines the pre-configured template. The persistent storage management module determines the pre-configured template as follows:

[0146] title:Book_Title:char

[0147] author:Book_Author:char

[0148] subject:Book_Subject:char

[0149] book_id:Book_ID:int

[0150] Among them, the column separator is;, the first column is the field name in the structure, the second column is the name to be output in the file, and the third column is the type of the field.

[0151] In this example, the structured data &book sent by the file processing module to the persistent storage management module includes the following content:

[0152] strcpy(book.title,"C language")

[0153] strcpy(book.author,"zhangsan"

[0154] strcpy(book.subject,"Programming Language")

[0155] book.book_id=12234

[0156] In this example, the file content generated by the persistent storage management module through the configured template is as follows:

[0157] {

[0158] "Book_Title":"C Language",

[0159] "Book_Author":"zhangsan",

[0160] "Book_Subject":"Programming Language",

[0161] "Book_ID":12234

[0162] }

[0163] Thus, the persistent storage management module completes the writing of the file.

[0164] S417: The persistent storage management module sends a prompt message indicating successful storage to the file processing module.

[0165] In the embodiment of the present application, when the file is stored successfully, that is, when the persistent storage management module writes the file successfully, a prompt message of successful storage is sent to the file processing module.

[0166] The file writing method described in the embodiment of the present application pre-configures a plurality of templates of fixed formats in the persistent storage management module, and the persistent storage management module implements the file writing function, without the need to implement the file writing function in each file processing module, thereby avoiding redundancy of the file writing function.

[0167] An embodiment of the present application also provides a file processing device, which is applied to a persistent storage management module, and the persistent storage management module is a module for file storage in an adaptive automotive open system architecture. Figure 5 is a structural diagram of a file processing device provided in an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0168] The file opening request receiving unit 501 is used to receive a file opening request sent by a file processing module. The file processing module is a module used for file processing in the adaptive automobile open system architecture, and the adaptive automobile open system architecture includes at least one file processing module.

[0169] The target file determination unit 503 is used to determine the target file in the memory according to the file opening request, and send the operation handle of the target file to the file processing module.

[0170] The processing object receiving unit 505 is used to receive the processing object sent by the file processing module according to the operation handle.

[0171] The target file processing unit 507 is used to process the target file according to the processing object.

[0172] In some optional implementations, when the read-write type is a read type, the target file processing unit includes:

[0173] The file reading processing subunit is used to process the file reading operation on the target file according to the processing object.

[0174] In some optional implementations, the processing object is a primary key; and the file reading processing subunit includes:

[0175] The target file parsing subunit is used to parse the content of the target file according to the primary key;

[0176] The parameter acquisition subunit is used to obtain the parameter corresponding to the primary key according to the content of the target file.

[0177] In some optional implementations, when the read-write type is a write type, the target file processing unit includes:

[0178] The file writing processing subunit is used to process the file writing operation on the target file according to the processing object.

[0179] In some optional implementations, the processing object is structured data; the file writing processing subunit includes:

[0180] The format template determination subunit is used to determine the format template corresponding to the structured data according to the structured data; the format template is pre-configured in the persistent storage management module according to the storage format of the target file;

[0181] The target file writing subunit is used to write structured data into the target file according to the format template.

[0182] In some optional implementations, the file writing processing subunit further includes:

[0183] The error prompt information sending subunit is used to send an error prompt information to the file processing module if the format template corresponding to the structured data is not found.

[0184] In some optional implementations, the target file determination unit includes:

[0185] A target file disk determination subunit is used to determine a target file in a storage disk according to a file opening request;

[0186] The target file opening subunit is used to open the target file in the memory.

[0187] In some optional implementations, the target file determination unit further includes:

[0188] The storage space determination subunit is used to determine the size of the open memory required to open the target file and the size of the remaining storage space in the memory when the target file is determined in the storage disk;

[0189] The memory release subunit is used to release the occupied memory if the remaining storage space is less than the open memory, so that the target file can be opened in the memory.

[0190] In some optional implementations, the memory release subunit includes:

[0191] An occupied file determination subunit, used to determine the files to be released in the memory based on an elimination algorithm;

[0192] The occupied memory release subunit is used to close the file to be released to release the occupied memory.

[0193] The device and method embodiments in the embodiments of this application are based on the same application concept.

[0194] An embodiment of the present application also provides an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded by the processor and executes the file processing method as described above.

[0195] In an embodiment of the present application, the memory can be used to store software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory. As an example, the device is an on-board computer, such as an electronic control unit (ECU, Electronic Control Unit).

[0196] An embodiment of the present application provides a computer-readable storage medium, in which at least one instruction or at least one program is stored. The at least one instruction or at least one program is loaded and executed by a processor to implement the file processing method as described above.

[0197] In the embodiment of the present application, the above-mentioned storage medium may be located in at least one of the multiple network clients of the computer network. Optionally, in the present embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0198] The present application embodiment provides a file processing system, Figure 6 is a structural diagram of a file processing device provided in an embodiment of the present application, such as Figure 6 As shown, the system includes a persistent storage management module and at least one file processing module.

[0199] The persistent storage management module is used to receive a file opening request for a target file sent by the file processing module;

[0200] The persistent storage management module is also used to open the target file in the memory according to the file opening request, and send the operation handle of the target file to the file processing module;

[0201] The persistent storage management module is also used to receive the processing object corresponding to the read-write type sent by the file processing module according to the operation handle;

[0202] The persistent storage management module is also used to process the target file according to the processing object and send the processing result to the file processing module.

[0203] In the embodiment of the present application, the file processing system is set based on the adaptive automobile open system architecture. The persistent storage management module is a module for file storage in the adaptive automobile open system architecture. The file processing module is a module for file processing in the adaptive automobile open system architecture.

[0204] An embodiment of the present application provides a vehicle, which includes the file processing system as described above.

[0205] The file processing method, device, equipment, storage medium, system and vehicle provided in the embodiments of the present application perform functional encapsulation in the persistent storage management module, and the persistent storage management module provides a unified call function to implement file parsing and file writing functions. When other modules in the adaptive automotive open system architecture need to read and write files, the persistent storage management module performs file parsing or writes files by sending a request, so there is no need to implement the file reading and writing functions in each module, avoiding the redundancy of file reading and writing functions. When the file reading and writing functions need to be modified, only the persistent storage management module needs to be modified, which greatly reduces the development workload and saves resources. In addition, the persistent storage management module places frequently used files in the memory, which, on the one hand, facilitates the use of the file processing module and improves efficiency, and on the other hand, avoids files that are not frequently used from occupying memory and causing memory waste.

[0206] It should be noted that the above-mentioned sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above-mentioned specific embodiments of this specification are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

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

[0208] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0209] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A file processing method, characterized in that: The method is applied to a persistent storage management module, the persistent storage management module encapsulates a unified calling function, and the method includes: Receive a file opening request for a target file sent by a file processing module; the file opening request carries the file name and file type of the target file; According to the file name and file type of the target file, searching the target file in the memory through the unified calling function, opening the target file in the memory, and sending the operation handle of the target file to the file processing module; Receiving a processing object corresponding to a read / write type sent by the file processing module according to the operation handle; The target file is processed according to the processing object, and the processing result is sent to the file processing module.

2. The file processing method according to claim 1, characterized in that: When the read-write type is a read type, processing the target file according to the processing object includes: The target file is processed by a file read operation according to the processing object.

3. The file processing method according to claim 2, characterized in that: The processing object is a primary key; and the processing of performing a file reading operation on the target file according to the processing object includes: Parsing the content of the target file according to the primary key; The parameters corresponding to the primary key are obtained according to the content of the target file.

4. The file processing method according to claim 1, characterized in that: When the read-write type is a write type, processing the target file according to the processing object includes: A write file operation is performed on the target file according to the processing object.

5. The file processing method according to claim 4, characterized in that: The processing object is structured data; and the processing of performing a file write operation on the target file according to the processing object includes: Determining a format template corresponding to the structured data according to the structured data; the format template is pre-configured in the persistent storage management module according to the storage format of the target file; The structured data is written into the target file according to the format template.

6. The file processing method according to claim 5, characterized in that: Before writing the structured data into the target file according to the format template, the method further includes: If the format template corresponding to the structured data is not found, an error prompt message is sent to the file processing module.

7. The file processing method according to claim 1, characterized in that: The method of searching the target file in the memory according to the file name and file type of the target file by the unified calling function, opening the target file in the memory, and sending the operation handle of the target file to the file processing module includes: According to the file name and file type of the target file, searching the target file in the memory through the unified calling function; The target file is determined in the storage disk, the target file is opened in the memory, and an operation handle of the target file is sent to the file processing module.

8. The file processing method according to claim 7, characterized in that: Before the step of determining the target file in the storage disk, opening the target file in the memory, and sending the operation handle of the target file to the file processing module, the method further includes: When the target file is determined in the storage disk, determining the size of the memory required to open the target file and the size of the remaining storage space in the memory; If the remaining storage space is smaller than the open memory, the occupied memory is released so that the target file can be opened in the memory.

9. The file processing method according to claim 8, characterized in that: The released occupied memory includes: Determine the files to be released in the memory based on the elimination algorithm; The file to be released is closed to release the occupied memory.

10. A file processing device, characterized in that: The device is applied to a persistent storage management module, the persistent storage management module encapsulates a unified calling function, and the device includes: A file opening request receiving unit, configured to receive a file opening request for a target file sent by a file processing module; the file opening request carries the file name and file type of the target file; a target file determining unit, configured to search for the target file in the memory through the unified calling function according to the file name and file type of the target file, open the target file in the memory, and send an operation handle of the target file to the file processing module; A processing object receiving unit, used for receiving a processing object corresponding to a read-write type sent by the file processing module according to the operation handle; The target file processing unit is used to process the target file according to the processing object and send the processing result to the file processing module.

11. An electronic device, characterized in that: The device includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by the processor and executes the file processing method as described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction or at least one program, and the at least one instruction or at least one program is loaded and executed by the processor to implement the file processing method according to any one of claims 1 to 9.

13. A file processing system, characterized in that: The system includes a persistent storage management module and at least one file processing module, wherein the persistent storage management module encapsulates a unified calling function; The persistent storage management module is used to receive a file opening request for a target file sent by the file processing module; the file opening request carries the file name and file type of the target file; The persistent storage management module is also used to search the target file in the memory through the unified calling function according to the file name and file type of the target file, open the target file in the memory, and send the operation handle of the target file to the file processing module; The persistent storage management module is also used to receive a processing object corresponding to a read-write type sent by the file processing module according to the operation handle; The persistent storage management module is also used to process the target file according to the processing object and send the processing result to the file processing module.

14. A vehicle, characterized in that: The vehicle includes the document processing system of claim 13.

Citation Information

Patent Citations

  • Operating system application programming interfaces and methods of using operating systems

    US20030177285A1

  • Method and apparatus for transparent distributed network-attached storage with web cache communication protocol / anycast and file handle redundancy

    US7254636B1