Message storage method and device and electronic equipment

By uniformly compressing and storing multiple message data when the container reaches the write limit, the problem of system performance degradation caused by high-frequency message storage and compression is solved, and system performance is improved.

CN120835100APending Publication Date: 2025-10-24JINGWEI HIRAIN (TIANJIN) RES&DEV CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510908967.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

In the prior art, when a vehicle system performs high-frequency message storage and compression operations, system performance degrades and other functional performance of the system cannot be effectively improved.

Method used

By uniformly compressing multiple message data when the container reaches the write limit, storing the compressed data, reducing the storage frequency, and adopting format conversion and container management strategies, high-frequency one-by-one processing is avoided.

Benefits of technology

The frequency of message storage and compression is reduced, the impact on system performance is reduced, and the overall performance of the system is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120835100A_ABST
    Figure CN120835100A_ABST
Patent Text Reader

Abstract

The invention discloses a message storage method and device and electronic equipment. The method comprises the following steps: acquiring message data of vehicle operation; writing the message data into a container; when it is detected that the container reaches a write-in limit value, compressing the message data in the container to obtain compressed message data; and storing the compressed message data. According to the embodiment of the invention, the frequency of storing the message data can be reduced, and the system performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of data processing, and in particular relates to a message storage method, device and electronic device. Background Art

[0002] When a vehicle is running, its system needs to send and receive messages at a high frequency. In the current Controller Area Network (CAN) message storage technology, due to the high frequency of message transmission and reception, high-frequency message storage is often required. However, high-frequency message storage will reduce the performance of other functions of the system.

[0003] On the other hand, in some technologies, when storing messages, each message is compressed after being recorded, and then the compressed message is stored, i.e. written to disk. However, when recording each message, each message is often recorded in text form, which usually leads to a continuous and frequent system transmission and reception frequency, and therefore, a high-frequency message compression operation. Furthermore, when high-frequency message compression and high-frequency storage of compressed messages are performed simultaneously, the system performance will be further reduced. Summary of the Invention

[0004] The embodiments of the present application provide a message storage method, device, and electronic device, which can reduce the frequency of storing message data and improve system performance.

[0005] In a first aspect, an embodiment of the present application provides a message storage method, the method comprising:

[0006] Obtain vehicle operation message data;

[0007] Writing the message data into the container;

[0008] When it is detected that the container reaches the write limit, compressing the message data in the container to obtain compressed message data;

[0009] The compressed message data is stored.

[0010] Furthermore, writing the message data into the container includes:

[0011] The message data is formatted into a preset structure format and written into the container.

[0012] Furthermore, writing the message data into the container includes:

[0013] Detecting a target container whose storage space is not full among multiple containers in the cache area;

[0014] write the message data into the target container whose storage space is not full.

[0015] The target container includes a first container and a second container.

[0016] Further, the writing of the message data into the target container whose storage space is not full includes:

[0017] determining the occupied space of the message data and the remaining space of the storage space in the first container;

[0018] in a case where the remaining space is greater than or equal to the occupied space of the message data, writing the message data into the first container;

[0019] in a case where the remaining space is less than the occupied space of the message data, writing a first part of the message data into the first container and writing a second part of the message data into the second container, wherein the occupied space of the first part of the message data is equal to the remaining space, and the sum of the first part of the message data and the second part of the message data is the message data.

[0020] Further, after detecting the target container whose storage space is not full in the plurality of containers in the cache area, the method further includes:

[0021] in a case where the storage space of each container in the cache area is full, generating an alarm log.

[0022] Further, after detecting the target container whose storage space is not full in the plurality of containers in the cache area, the method further includes:

[0023] in a case where the storage space of each container in the cache area is full, deleting the message data with the earliest writing time from each container.

[0024] Further, the compression processing of the message data in the container to obtain the compressed message data includes:

[0025] compressing the message data in one or more containers according to a preset compression ratio to obtain the compressed message data.

[0026] Further, the storage of the compressed message data includes:

[0027] writing the compressed message data into a preset target file, and the storage structure format of the message data in the target file is a preset structure format.

[0028] write the next compressed message data to another target file with a write duration of the compressed message data less than the write duration threshold.

[0029] write the next compressed message data to another target file with a write duration of the compressed message data less than the write duration threshold.

[0030] In a second aspect, an embodiment of the present application provides a message storage device, which comprises:

[0031] a obtaining module, configured to obtain message data of vehicle operation

[0032] a writing module, configured to write the message data to a container;

[0033] a compressing module, configured to, when detecting that the container reaches a write limit value, compress the message data in the container to obtain compressed message data;

[0034] a storage module, configured to store the compressed message data.

[0035] In a third aspect, an embodiment of the present application provides an electronic device, which comprises:

[0036] a processor and a memory storing computer program instructions;

[0037] the processor executes the computer program instructions to implement the message storage method in any one of the preceding aspects.

[0038] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the message storage method in any one of the preceding aspects.

[0039] In a fifth aspect, an embodiment of the present application provides instructions in a computer program product, which are executed by a processor of an electronic device to enable the electronic device to perform the message storage method in any one of the preceding aspects.

[0040] In a sixth aspect, an embodiment of the present application further provides a vehicle, which comprises the message storage device or the electronic device, and the electronic device executes the message storage method in any one of the preceding aspects.

[0041] The packet storage method, device and electronic equipment provided by the embodiments of the present application can write the packet data into the container based on the obtained packet data and the preset container, and compress the plurality of packet data written in the container in the case that the container reaches the writing limit, so as to realize the mode of processing the plurality of packet data once instead of processing each packet data one by one, and avoid compressing each packet data one by one, thereby reducing the compression frequency of the packet data.

[0042] Further, the compressed packet data is written into the target file, so as to realize the mode of storing the plurality of packet data once instead of storing each packet data one by one, thereby reducing the storage frequency of the packet data and reducing the influence of processing the packet data on the system performance. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly introduced, and other drawings can be obtained by those of ordinary skill in the art without creative labor on the premise of not paying creative labor.

[0044] Figure 1 is a flow diagram of a packet storage method provided by the embodiments of the present application;

[0045] Figure 2 is a packet collection and storage diagram provided by the embodiments of the present application;

[0046] Figure 3 is a structural diagram of a packet storage device provided by the embodiments of the present application;

[0047] Figure 4 is a structural diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0048] The features and exemplary embodiments of various aspects of the present application will be described in detail below, in order to make the purposes, technical solutions and advantages of the present application more clear and apparent, the present application will be further described in detail below in combination with the drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, but not to limit the present application. The present application can be implemented without some of these specific details by those skilled in the art. The following description of the embodiments is only to provide a better understanding of the present application by showing examples of the present application.

[0049] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.

[0050] As described in the background technology section, related message storage technologies are still unable to meet the needs of actual work.

[0051] In actual work, when the vehicle is running, the vehicle system will generate message data due to data communication. The message data is effective immediately and will not be automatically backed up and stored. However, for the analysis of subsequent problems, it is usually chosen to collect and store the message data sent and received when the system is performing some tasks.

[0052] In current message data storage technology, messages recorded in text form are usually stored one by one. However, although the amount of data carried by the message is relatively low, the frequency of message transmission and reception is relatively high. Therefore, when storing message data one by one, high-frequency message storage is often required. The high-frequency message storage operation will bring a large load to the system and reduce the system performance. For example, the high-frequency message storage will reduce the performance of other functions of the system.

[0053] In the process of implementing this application, it was found that in the relevant message storage technology, although the amount of data carried by the message is relatively low, the total amount of messages recorded in text form will still occupy a large disk space. If each message is compressed before being stored, then due to the high frequency of message sending and receiving, it will lead to high-frequency message compression operations, and the CPU occupancy of the compression operation will also be relatively high. As a result, when high-frequency message compression and storage are performed simultaneously, the system performance will be lower.

[0054] In order to solve the problems of the prior art, the embodiments of the present application provide a message storage method, device and electronic device. The message storage method can be executed by a platform system that communicates with a vehicle.

[0055] The following is a detailed description of the message storage method provided in the embodiment of the present application with reference to the accompanying drawings.

[0056] Figure 1 A flowchart of a message storage method provided by an embodiment of the present application is shown.

[0057] Reference Figure 1 The message storage method of an embodiment of the present application can include the following steps S101-S104.

[0058] S101, obtaining message data of vehicle operation.

[0059] The message data is message data generated in the process of vehicle operation, for example, CAN message. The message data can include a message and a message header, and the message header can include a protocol header and / or a version header.

[0060] In an embodiment, a main thread is created, and the message data can be collected by using the main thread. After the message data is collected, the message data can be divided into two categories according to the canfd_flag parameter in the message data: CAN FD message (flexible data rate controller area network message) or CAN message, and the message data is respectively converted into the structure format of the storage file according to the corresponding message format, to obtain the message data after format conversion.

[0061] In an example, the format conversion of the message data can be encapsulation of the message data. Specifically, the message and the message header can be encapsulated into the structure format of the storage file, for example, the binary structure format.

[0062] In a specific example, the controller area network (CAN) communication of the vehicle is taken as a specific example. As shown in Figure 2 The CAN message in the process of collection and transmission is collected, and the protocol header corresponding to each CAN message is collected. Based on this, each CAN message and the corresponding protocol header are packaged and format-converted to obtain the binary structure CAN message data.

[0063] It should be noted that the frequency of CAN message transmission and reception is high when the vehicle is running, and the above-mentioned collection and packaging process does not involve frequent write-in, write-out and compression processes, and therefore does not cause a burden to the system.

[0064] In S101, based on the created main thread, before performing S102 described below, the related parameters of compression and export can be set in the main thread in advance, such as storage path, file name, maximum file number, compression ratio, storage space of container and dump condition.

[0065] S102, writing the message data into the container.

[0066] After obtaining the message data of vehicle operation, the message data is written into the container.

[0067] In one embodiment, the container is a container in a buffer of a platform system in communication with a vehicle, as shown in Figure 2 As shown, a plurality of containers can be included in the buffer, and writing the message data into the container can specifically include:

[0068] From the plurality of containers in the buffer, a container with an unfulfilled storage space is detected.

[0069] The message data is written into the container with an unfulfilled storage space in the buffer.

[0070] In one example, the container with an unfulfilled storage space for writing the message data can be referred to as a target container.

[0071] In one example, when selecting the target container, any container with an unfulfilled storage space can be selected from the plurality of containers in the buffer, or the container with an unfulfilled storage space used for writing the message data last time can be selected according to the order of the containers.

[0072] In one example, the message data can be immediately written into the target container each time the message data is obtained, or a plurality of message data can be written into the target container after being obtained.

[0073] Accordingly, according to the detected target container, the message data can be written into the target container, avoiding the message data from being unable to be stored, thereby affecting subsequent processing.

[0074] In one example, the buffer can be a ring buffer.

[0075] Based on one or more message data obtained in the foregoing steps, the message data can be written into the preset ring buffer.

[0076] The ring buffer specifically represents a plurality of containers arranged in a predetermined order, wherein after the storage space of each container is full, the next container is replaced for writing the message data, and after the storage space of the last container is full, that is, after the storage spaces of all containers are full, the earliest message data is deleted from the container in which the message data is first written according to the writing time.

[0077] In one example, the target container is provided with a pointer, and the pointer position of the pointer is used to identify the position of writing the message data in the storage space of the target container.

[0078] In one example, after determining the target container for writing the message data, the occupied space of the message data and the remaining space of the storage space of the target container for writing data need to be determined before writing the message data.

[0079] Based on this, the writing of the message data can be performed according to the occupied space of the message data and the remaining space of the target container, wherein the occupied space of the message data is the space required to be occupied when the message is written into the target container, and in some embodiments, the length of the message is also used to represent the occupied space.

[0080] In one example, the occupied space of the message data can be compared with the remaining space of the target container.

[0081] Further, when the remaining space of the target container is greater than or equal to the occupied space of the message data, it can be considered that the message data can be written into the target container in its entirety, and the entire message data is written into the target container.

[0082] In one example, when the remaining space of the target container is less than the occupied space of the message data, it can be considered that the message data cannot be written into the target container in its entirety.

[0083] Based on this, the current target container can be regarded as a first container, and according to the remaining space of the first container, the first part of the message data can be written first, and the occupied space of the first part of the message data is equal to the remaining space of the first container, so that the storage space of the first container is full after writing the first part of the message data.

[0084] Based on this, the storage space of the first container is marked as full.

[0085] Further, after the first part of the message data is written into the first container, the second part of the message data can be written into another target container with an unfulfilled storage space, and the other target container with an unfulfilled storage space is regarded as a second container.

[0086] Among them, the second part of the message data is the remaining part of the entire message data except the first part of the message data.

[0087] In some examples, when the remaining space of the target container is greater than or equal to the occupied space of the message data, the pointer position of the target container can be obtained before the entire message data is written into the target container, and the message data can be written at the pointer position.

[0088] In one example, when the remaining space of the target container is greater than or equal to the occupied space of the message data, the message data can be written starting from the pointer position, and after the entire message data is written into the target container, the pointer position can be updated, specifically, the occupied space of the message data can be used to offset the pointer position to obtain an updated pointer position.

[0089] In one example, when the remaining space of the target container is less than the occupied space of the packet data, the first part of the packet data can be written starting from the pointer position, and after the first container storage space is filled with the first part of the packet data, the pointer position can be offset according to the occupied space of the written first part of the packet data to obtain an updated pointer position, and the storage space of the first container is marked as full.

[0090] Further, after the remaining second part of the packet data is written into the second container, the pointer position of the second container is updated.

[0091] In one specific example, variables representing the storage space and the occupied space of the target container can be set in advance, the storage space of the target container is represented by container_size, and the occupied space of the target container is represented by container_offset, according to which the remaining space of the target container can be represented by the difference between the variable container_size and the variable container_offset.

[0092] Further, the occupied space of the packet is represented by the variable length.

[0093] Further, the occupied space of the packet data is compared with the remaining space of the target container, which can be, for example, length and container_size-container_offset.

[0094] Accordingly, in the present embodiment, by using the occupied space of the packet data and the remaining space of the target container, the size of the written packet data can be adjusted in advance according to the remaining space of the target container, so that when the remaining space of the target container is greater than or equal to the occupied space of the packet data, all the packet data is written, and when the remaining space of the target container is insufficient to support the writing of all the packet data, the first part that can occupy the remaining space is written first, and the remaining part is written to another target container, so that the operation of writing the packet data can not be affected by the remaining space of the target container, thereby successfully completing the writing of all the packet data.

[0095] In one example, when the buffer is a ring buffer, based on the operation of writing the packet data in the foregoing steps, after the writing of the packet data is completed, it can be determined whether the next packet data is still written to the target container used in the foregoing steps or written to another target container with an empty storage space, according to whether the storage space of the target container is full.

[0096] In one example, after the writing of the packet data in the foregoing steps is completed, it can be determined whether the storage space of the target container is full.

[0097] If the target container for writing the message data is not marked as full, it is considered that the target container still has remaining space to continue writing other message data after writing the message data in the above step.

[0098] Based on this, the next message data can be continuously acquired and written into the target container until the target container is full.

[0099] Further, if the target container is full of the message data in the previous step or continuously acquired other message data, it is considered that the target container has no remaining space to continue writing other message data.

[0100] Based on this, the next message data can be continuously acquired and written into the target container until the target container is full.

[0101] In another example of the present application, when any target container is full after writing any message data, before selecting another target container, it can also be determined whether each target container in the buffer is full of message data.

[0102] Further, if each container is full, an alarm log is generated, wherein the alarm log is used to prompt the user that each container in the buffer has no space to continue writing message data.

[0103] Accordingly, in the present embodiment, the user can be informed of the storage status of the containers in the buffer in time by generating the alarm log.

[0104] Based on this, when the buffer is a ring buffer, in order to continuously use the containers in the ring buffer to write the next message data, the message data written earliest in each container in the ring buffer can be deleted, so that the ring buffer has remaining space for the next message data.

[0105] In some other scenarios, when the storage space of each container is full, in order to continuously use the containers in the ring buffer to write the next message data, the next message data can be used to overwrite the message data written earliest when the next message data is acquired.

[0106] In some other scenarios, based on the processing strategy of the packet data set by the buffer, when the storage spaces of the plurality of containers are all full, after the next packet data is obtained, the next packet data that is newly obtained can be discarded in addition to the packet data that is written earliest in the event. Accordingly, when the storage spaces of the containers are all full, by deleting or covering the packet data that is written earliest in time, the next packet data that is obtained can be written into the ring buffer in time, without affecting the processing of the next packet data, and since the packet data that is deleted or covered is the packet data that is written earliest in time, after the packet data is deleted or covered, the impact of information loss is minimal.

[0107] In step S103, when it is detected that the container reaches the write limit value, the packet data in the container is compressed to obtain compressed packet data.

[0108] The write limit value can be a space limit value or a time limit value.

[0109] In an example, the full storage space can be set as a space limit value, and when the storage space of the target container is full, it is considered that the space limit value is reached.

[0110] Further, a predetermined time length can be set as a time limit value, and when the time length for writing packet data by the same target container reaches the predetermined time length, it is considered that the time limit value is reached.

[0111] In an example, when the container reaches the write limit value, the entire packet data in the container can be compressed to obtain compressed packet data, and the compressed packet data can be referred to as compressed data.

[0112] In an example, based on the packet data written in the target container in the foregoing step, when the target container reaches the preset write limit value, a compression thread can be started to perform binary stream compression on the packet data in the target container with full storage space, and as shown in Figure 2 , compressed packet data is obtained, wherein the compressed packet data is in a binary structure format.

[0113] In an example, when the packet data in any target container is compressed, a compression ratio can be set in advance, and the packet data can be compressed according to the compression ratio.

[0114] In one specific example, when the set compression ratio is larger, the same occupied space of the message data after being compressed will have smaller occupied space of the compressed data, and correspondingly, the compression time will be longer. When the compression ratio is smaller, the same occupied space of the message data after being compressed will have larger occupied space of the compressed data, and correspondingly, the compression time will be shorter. Accordingly, the compression ratio can be used to adjust the occupied space of the compressed data according to the occupied space of the message data to be processed. Specifically, when the occupied space of the message data to be compressed is larger, a larger compression ratio can be set, and when the occupied space of the message data to be compressed is smaller, a smaller compression ratio can be set, so that the occupied space of the compressed data after compression can be flexibly applied to the requirement of the data flow in the message storage process. In one example, different target containers of storage space can also be selected according to the requirement in the message storage process.

[0115] Specifically, if the storage space of the target container is larger, the target container will be filled up for a longer time, and the frequency of compressing the message data in the target container will be lower. If the storage space of the target container is smaller, the target container will be filled up for a shorter time, and the frequency of compressing the message data in the target container will be higher. That is, the target containers of different storage space will affect the frequency of the write-in and write-out operation of the message data.

[0116] On the other hand, if the storage space of the target container is larger, the target container will be filled up for a longer time, and the occupied space of the message data accumulated in the target container will be larger. Under the same compression ratio, the occupied space of the compressed data will be larger. If the storage space of the target container is smaller, the target container will be filled up for a shorter time, and the occupied space of the message data accumulated in the target container will be smaller. Under the same compression ratio, the occupied space of the compressed data will be smaller. That is, the target containers of different storage space will also affect the memory occupied by the compressed data in the message storage process.

[0117] Accordingly, the target containers of different storage space will affect the performance of the system in the message storage process. By setting target containers of different storage space, the performance of the system in the message storage process can be better.

[0118] In one example, an attachment file for recording the basic information of the target file can be set in advance. When the compression thread is ready to perform the compression operation, or starts to perform the compression operation, or after completing the above-mentioned dumping operation, the compression thread can open the attachment file in binary format and write the basic information of the target file to be dumped into the attachment file.

[0119] The basic information is used for analyzing the compressed data in the target file in subsequent work, and can specifically include the start storage time, the end storage time, the total amount of the written messages, etc.

[0120] In the present example, the compression thread always listens to the queue of the messages in the ring buffer, and after starting the corresponding compression operation, opens the content in the attachment file for updating, and after taking out the target container, compresses it according to a certain compression ratio, and then closes the attachment file.

[0121] In step S104, the compressed message data is stored.

[0122] In one example, based on the compressed data obtained in the foregoing steps, the compressed data can be written into a predetermined target file, thereby completing the storage of each message data.

[0123] In one specific example, since the compressed data is in the form of a binary structure, the compressed data can be written into the target file in the form of a binary stream.

[0124] In one example, when writing the compressed data into the target file, the obtained compressed data can be written into the target file after each compression, or the accumulated multiple compressed data can be written into the target file after multiple compressions.

[0125] In one example, one or more target files for storing compressed data can be set in advance, and before writing one or more compressed data into any target file, the target file to be written can be opened in binary format, and the one or more compressed data can be written into the opened target file.

[0126] In one specific example, when writing the compressed data, or before writing the compressed data, a start time stamp of starting to write the compressed data is identified in the target file.

[0127] Further, after writing the compressed data into the target file, an end time stamp of ending to write the compressed data is identified in the target file.

[0128] Further, after completing the writing of the compressed data this time, the start time stamp and the end time stamp of writing the compressed data next time are identified again when writing the compressed data next time, so as to update the start time stamp and the end time stamp identified last time.

[0129] Wherein, when writing the compressed data into the same target file each time, the file name of the target file can be kept in the form composed of a prefix and a time stamp.

[0130] In one specific example, as Figure 2As shown, File_timestamp1, File_timestamp2, and File_timestamp3 are the file names of three different target files, respectively. "File" represents the prefix of each file name, which can be set according to specific needs. "Timestamp1," "Timestamp2," and "Timestamp3" are the timestamps of each file name, which can be the start timestamp or end timestamp currently identified for each target file. Thus, by identifying the start and end timestamps for each target file table, the time when the compressed data was written to each target file can be reflected in the target file name. While different target files are distinguished by the prefix, even if the prefixes are the same, different target files can still be distinguished by the suffix timestamp. Furthermore, the prefix ensures that when multiple target files are running simultaneously, the target files are not confused, while the suffix timestamp facilitates searching for each target file. In one embodiment of the present application, to prevent the occurrence of target files that occupy too much space, a dump condition can be set for the target file write operation. When the dump condition is met, the target file currently writing the compressed data is replaced, and another target file that does not meet the dump condition is used to write the compressed data.

[0131] Specifically, the dump condition can be set based on the file size, such as the occupied space threshold of the target file, or it can be, for example, the write time threshold of the same target file used to write compressed data. Among them, the dump condition based on file size can be achieved by setting the file size variable in the compression thread that performs the compression operation.

[0132] In a specific example, when the dump condition is the occupied space threshold, for the target file currently used to write compressed data, if its occupied space is greater than or equal to the occupied space threshold, it is considered that the occupied space of the currently used target file is large enough. In order to avoid further increase in the occupied space of the target file, after the current compressed data is written to the target file, another target file whose occupied space is less than the occupied space threshold can be used to continue writing the next compressed data.

[0133] Furthermore, when the dump condition is a write duration threshold, for the target file currently used to write compressed data, if its write duration for writing compressed data is greater than or equal to the write duration threshold, it is considered that the occupied space of the currently used target file is large enough. In order to avoid further increase in the occupied space of the target file, after the current compressed data is written to the target file, another target file with a write duration less than the write duration threshold can be used to continue writing the next compressed data.

[0134] When the dump condition is a write duration threshold, a timing thread may be created through the main thread, thereby utilizing the timing thread to determine the write duration.

[0135] Furthermore, when the target file meets the dump conditions set above, the target file that meets the dump conditions is a target file that has completed writing compressed data, that is, there is no need to write compressed data to the target file. Accordingly, it can be stored on the disk according to the storage path set above.

[0136] In one example, based on the maximum number of files set above, after generating multiple target files according to the dump conditions, the total number of current target files can be monitored in real time. When the total number of target files is greater than or equal to the set maximum number of files, the oldest target file in time can be deleted, thereby keeping the total number of target files unchanged.

[0137] Specifically, the time of each target file can be distinguished based on any timestamp of the target file. Accordingly, in this embodiment, when writing compressed data in binary format to the target file, based on the set dump conditions, the final occupied space of the target file is controlled by the current occupied space or writing time of the target file, that is, when its occupied space is greater than or equal to the occupied space threshold, or when the writing time of the compressed data is greater than or equal to the writing time threshold, another target file is used to write the next compressed data, thereby avoiding the generation of a target file with too large an occupied space. It can be seen that the message storage method provided by this embodiment can temporarily store message data by first writing the message data to a container based on the acquired message data. In the case of frequent sending and receiving of messages, the process of acquiring message data and temporarily storing it in a container does not involve frequent writing, writing and compression processes, and therefore does not impose a burden on the system.

[0138] Furthermore, by detecting the write limit of the container, it can be determined that the container is not suitable for continuing to write message data when the write limit is reached, so that multiple message data written therein can be compressed together in a timely manner, thereby achieving a method of compressing multiple messages together instead of compressing each message one by one, thereby reducing the compression frequency. Therefore, when storing the compressed message data, multiple message data can be stored together, thereby reducing the storage frequency of the message data and improving the performance of the system.

[0139] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, an embodiment of the present application further provides a message storage device.

[0140] refer to Figure 3 , the message storage device comprises:

[0141] The acquisition module 301 is configured to acquire message data of vehicle operation.

[0142] The writing module 302 is configured to write the message data into the container.

[0143] The compression module 303 is configured to, in a case where it is detected that the container reaches a writing limit value, compress the message data in the container to obtain compressed message data.

[0144] The storage module 304 is configured to store the compressed message data.

[0145] In an embodiment, the writing module 302 is specifically configured to:

[0146] perform format conversion on the message data into a preset structure format, and write the message data into the container.

[0147] Further, a target container with an unfulfilled storage space is detected from the plurality of containers in the cache area.

[0148] The message data is written into the target container with the unfulfilled storage space.

[0149] The target container includes a first container and a second container.

[0150] Further, the writing of the message data into the target container with the unfulfilled storage space includes:

[0151] determining an occupied space of the message data and a remaining space of the storage space in the first container;

[0152] in a case where the remaining space is greater than or equal to the occupied space of the message data, writing the message data into the first container;

[0153] in a case where the remaining space is less than the occupied space of the message data, writing a first part of the message data into the first container and writing a second part of the message data into the second container, wherein the occupied space of the first part of the message data is equal to the remaining space, and the first part of the message data and the second part of the message data are equal to the message data.

[0154] Further, after the target container with the unfulfilled storage space is detected from the plurality of containers in the cache area, the following is performed:

[0155] in a case where the storage space of each container in the cache area is full, generating an alarm log.

[0156] Further, after the target container with the unfulfilled storage space is detected from the plurality of containers in the cache area, the following is performed:

[0157] In the case that the storage space of each container in the cache area is full, the message data with the earliest writing time is deleted from each container.

[0158] In one embodiment, the compression module 303 is specifically configured to:

[0159] According to the preset compression ratio, the message data in one or more containers is compressed to obtain compressed message data.

[0160] In one embodiment, the storage module 304 is specifically configured to:

[0161] The compressed message data is written into a preset target file, and the storage structure format of the message data in the target file is a preset structure format.

[0162] In the case that the occupied space of the target file is greater than or equal to the occupied space threshold, the next compressed message data is written into another target file with an occupied space less than the occupied space threshold; or,

[0163] In the case that the writing duration of the target file for writing the compressed message data is greater than or equal to the writing duration threshold, the next compressed message data is written into another target file with a writing duration less than the writing duration threshold. For the convenience of description, the above device is described in various modules according to functions. Of course, in the implementation of the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0164] The device of the above embodiment is used to implement the corresponding message storage method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described here.

[0165] Based on the same inventive concept, corresponding to any of the above method embodiments, the embodiments of the present application also provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the program to implement the message storage method of any one of the above embodiments.

[0166] Figure 4 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application is shown.

[0167] The electronic device can include a processor 401 and a memory 302 having computer program instructions stored therein.

[0168] In particular, the processor 401 can include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or can be configured to implement one or more integrated circuits that embody the embodiments of the present application.

[0169] The memory 402 can include mass storage for data or instructions. As an example and not by way of limitation, the memory 402 can include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disc (e.g., a compact disc (CD) or a digital versatile disc (DVD)), a solid-state drive (SSD), a USB drive, or a combination of two or more of these. Where appropriate, the memory 402 can include removable or non-removable (or fixed) media, where appropriate. Where appropriate, the memory 402 can be internal or external to the electronic device. In particular embodiments, the memory 402 is non-volatile, solid-state memory.

[0170] The memory 302 can include read-only memory (ROM), random-access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software that, when executed (e.g., by one or more processors), is operable to perform operations described with reference to the methods according to an aspect of the present disclosure.

[0171] The processor 401 implements any one of the packet storage methods in the above embodiments by reading and executing computer program instructions stored in the memory 402.

[0172] In one example, the electronic device can further include a communication interface 403 and a bus 410. As shown, the processor 401, the memory 402, and the communication interface 403 are connected through the bus 410 and complete communication among each other. Figure 4

[0173] The communication interface 403 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiments of the present application.

[0174] ​Bus 410 includes a hardware, software, or both that couples components of electronic device to each other. As an example and not by way of limitation, bus can 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 Industry Standard Architecture (ISA) bus, an InfiniBand™ interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel 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 (VLB) bus, or another suitable bus or a combination of two or more of these. Where appropriate, bus 310 can include one or more buses. Although this application describes and shows a particular bus, this application contemplates any suitable bus or interconnect.

[0175] The electronic device can perform the packet storage method in the embodiments of the application based on the set buffer, thereby realizing the packet storage method described in combination with Figure 1 and Figure 2 the embodiments of the application.

[0176] In addition, in combination with the packet storage method in the above embodiments, the embodiments of the application can provide a computer storage medium to realize. The computer storage medium has computer program instructions stored thereon; the computer program instructions are executed by a processor to realize any one of the packet storage methods in the above embodiments.

[0177] The embodiments of the application also provide a computer program product, comprising a computer program, the computer program is executed by a processor to realize any one of the packet storage methods in the above embodiments.

[0178] It needs to be clear that the application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after understanding the spirit of the application.

[0179] The functions shown in the above-described structural block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, and the like. When implemented in software, the elements of the present application are program or code segments that are used to perform the required tasks. The program or code segments can be stored in a machine-readable medium, or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine-readable medium" can include any medium that can store or transfer information. Examples of the machine-readable medium include an electronic circuit, a semiconductor memory device, a ROM, a flash memory, an erasable ROM (EROM), a floppy diskette, a CD-ROM, an optical disk, a hard disk, a fiber optic medium, a radio frequency (RF) link, and the like. The code segments can be downloaded via a computer network, such as the Internet, an intranet, and the like.

[0180] Based on the same inventive concept, the present application also provides a vehicle, which comprises the message storage device and / or the electronic device of any of the preceding embodiments, and the electronic device performs the message storage method of any of the preceding embodiments.

[0181] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be performed simultaneously.

[0182] The above-described aspects and implementations of the present application can be implemented in digital electronic circuitry, or in computer software, firmware, or hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of them. The present application can be implemented using a computer program tangibly embodied in a computer-readable medium, e.g., in a machine-readable storage medium, for execution by, or to control the operation of, data processing apparatus. The computer storage medium can be a machine-readable storage medium or a machine-readable transmission medium. The present application can be implemented using computer-readable media, including magnetic media, optical media, electrical media, such as the electrical connections carrying the data signals in a system, and the like. The present application can be implemented using various computer-program products. For example, the computer-program product can include a computer-readable medium having stored computer program code means adapted to program the computer to implement the present application. The program code means can be executed to implement the present application on the computer.

[0183] The above merely describes a specific implementation of the present application. Those skilled in the art can clearly understand the specific working processes of the system, modules and units described above for the convenience and brevity of description, and can refer to the corresponding processes in the foregoing method embodiments, which will not be described herein again. It should be understood that the protection scope of the present application is not limited to this, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application.

Claims

1. A message storage method characterized by comprising: The method comprises: acquiring message data of vehicle operation; writing the message data into a container; in a case where it is detected that the container reaches a writing limit, performing compression processing on the message data in the container to obtain compressed message data; storing the compressed message data.

2. The message storage method according to claim 1, characterized by, The writing of the message data into the container comprises: format conversion of the message data into a preset structure format and writing into the container.

3. The message storage method according to claim 1, wherein: The writing of the message data into the container comprises: detecting a target container with an unfulfilled storage space among a plurality of containers in a cache area; writing the message data into the target container with the unfulfilled storage space.

4. The message storage method according to claim 3, characterized by, The target container comprises a first container and a second container; the writing of the message data into the target container with the unfulfilled storage space comprises: determining an occupied space of the message data and a remaining space of the storage space in the first container; in a case where the remaining space is greater than or equal to the occupied space of the message data, writing the message data into the first container; in a case where the remaining space is less than the occupied space of the message data, writing a first part of the message data into the first container and writing a second part of the message data into the second container, wherein the occupied space of the first part of the message data is equal to the remaining space, and the sum of the first part of the message data and the second part of the message data is the message data.

5. The message storage method according to claim 3, characterized by, After the detection of the target container with the unfulfilled storage space among the plurality of containers in the cache area, the method further comprises: in a case where the storage space of each container in the cache area is full, generating an alarm log.

6. The message storage method according to claim 3, wherein After the detection of the target container with the unfulfilled storage space among the plurality of containers in the cache area, the method further comprises: in a case where the storage space of each container in the cache area is full, deleting the message data with the earliest writing time from each container.

7. The message storage method of claim 1, wherein The compression processing of the message data in the container to obtain the compressed message data comprises: compression of the message data in one or more containers according to a preset compression ratio to obtain the compressed message data.

8. The message storage method according to any one of claims 1 to 7, characterized by, The storage of the compressed message data comprises: writing the compressed message data into a preset target file, wherein the storage structure format of the message data in the target file is a preset structure format; in a case where the occupied space of the target file is greater than or equal to an occupied space threshold, writing the next compressed message data into another target file with an occupied space less than the occupied space threshold; or in a case where the writing duration of the target file for writing the compressed message data is greater than or equal to a writing duration threshold, writing the next compressed message data into another target file with a writing duration less than the writing duration threshold.

9. A message storage device, characterized by comprising: The device comprises: an acquisition module configured to acquire message data of vehicle operation; a writing module configured to write the message data into a container; a compression module configured to, in a case where it is detected that the container reaches a writing limit, perform compression processing on the message data in the container to obtain compressed message data; and a storage module configured to store the compressed message data. A storage module is configured to store the compressed packet data.

10. An electronic device, comprising: The device comprises a processor and a memory storing computer program instructions; The processor executes the computer program instructions to implement the packet storage method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Communication message storage method for data acquisition system

    CN105160013A

  • Message storage method, device and equipment

    CN114598669A

  • Method, device and equipment for compressing and decompressing network message and readable storage medium

    CN114710565A

  • Data writing method and device, storage medium and computer equipment

    CN115185458A

  • Full-flow data storage method, related method and device

    CN118764542A