WO2022188265A1 - 数据管理方法、装置以及电子控制器 - Google Patents

数据管理方法、装置以及电子控制器 Download PDF

Info

Publication number
WO2022188265A1
WO2022188265A1 PCT/CN2021/094763 CN2021094763W WO2022188265A1 WO 2022188265 A1 WO2022188265 A1 WO 2022188265A1 CN 2021094763 W CN2021094763 W CN 2021094763W WO 2022188265 A1 WO2022188265 A1 WO 2022188265A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
target file
changed
file
target
Prior art date
Application number
PCT/CN2021/094763
Other languages
English (en)
French (fr)
Inventor
屠东平
闫雪
Original Assignee
广州小鹏汽车科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州小鹏汽车科技有限公司 filed Critical 广州小鹏汽车科技有限公司
Publication of WO2022188265A1 publication Critical patent/WO2022188265A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Definitions

  • the present application relates to the technical field of vehicles, and in particular, to a data management method, device and electronic controller.
  • embodiments of the present application provide a data management method, an apparatus, and an electronic controller to solve the above technical problems.
  • some embodiments of the present application provide a data management method, the method includes: determining whether data contained in a target file has changed, and the target file belongs to a first process; when the data contained in the target file has changed When the data is changed, a key-value pair corresponding to the changed data is obtained, and a second process associated with the first process is determined; a data change instruction is sent to the second process, and the data change instruction includes the key-value pair.
  • some embodiments of the present application further provide a data management apparatus, the apparatus includes a determination module, an acquisition module, and a transmission module.
  • the determining module is configured to determine whether the data contained in the target file has changed, and the target file belongs to the first process.
  • the obtaining module is configured to obtain a key-value pair corresponding to the changed data when the data contained in the target file is changed, and determine a second process associated with the first process.
  • a sending module configured to send a data change instruction to the second process, where the data change instruction includes the key-value pair.
  • some embodiments of the present application further provide an electronic controller, including a processor and a memory, where the memory stores computer program instructions, and when the computer program instructions are called by the processor, execute any of the above method of data management.
  • embodiments of the present application further provide a computer-readable storage medium, where computer program instructions are stored in the computer-readable storage medium, and the computer program code can be invoked by a processor to execute any of the above data management methods.
  • the present application can improve the efficiency of data management by sending the data changed in the first process to the second process. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • FIG. 1 shows a schematic flowchart of a data management method provided by an embodiment of the present application.
  • FIG. 2 shows a schematic flowchart of step S120 in a data management method provided by an embodiment of the present application.
  • FIG. 3 shows a schematic flowchart of a data management method provided by another embodiment of the present application.
  • FIG. 4 shows a schematic flowchart of other steps in a data management method provided by another embodiment of the present application.
  • FIG. 5 shows a schematic flowchart of other steps in a data management method provided by another embodiment of the present application.
  • FIG. 6 shows a working flowchart of a data management method provided by another embodiment of the present application.
  • FIG. 7 shows a schematic flowchart of reading a file in a data management method provided by another embodiment of the present application.
  • FIG. 8 shows a schematic flowchart of writing a file in a data management method provided by another embodiment of the present application.
  • FIG. 9 shows a schematic flowchart of a data management method provided by another embodiment of the present application.
  • FIG. 10 shows a schematic diagram of a table configuration data format in a data management method provided by another embodiment of the present application.
  • FIG. 11 shows a module block diagram of a data management apparatus provided by an embodiment of the present application.
  • FIG. 12 shows a module block diagram of an electronic controller provided by an embodiment of the present application.
  • FIG. 13 shows a schematic structural diagram of a vehicle provided by an embodiment of the present application.
  • FIG. 14 shows a module block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the applicant after long-term research, proposes the data management method, device and electronic controller in the embodiments of the present application. Improve the efficiency of data management. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • FIG. 1 schematically shows a schematic flowchart of a data management method provided by an embodiment of the present application.
  • the method may include the following steps S110 to S130.
  • Step S110 Determine whether the data contained in the target file has changed, and the target file belongs to the first process.
  • the embodiments of the present application may be applied to an electronic device, and the electronic device may be configured with a data management module, and the data management module is mainly used to manage a database in the electronic device.
  • the database may be a mapping table based on Key-Vlue (key-value pair), which is mainly stored in a file.
  • Key-Vlue key-value pair
  • a user adds, modifies or deletes a key, and the corresponding database file is also This Key needs to be updated without affecting the Value corresponding to other Keys.
  • the database file here can be used as the target file. It can be seen that the target file can include a plurality of different data, and these data can be vehicle-related control parameters.
  • the control parameters can include temperature, humidity, version number, vehicle speed, and parameters. Wait.
  • the target file may belong to a first process
  • the first process may be a running activity of a program in a computer on a certain data set, and is a basic unit for resource allocation and scheduling by the system.
  • the first process may also be a process corresponding to a preset application, that is, different applications may have different corresponding processes.
  • the process corresponding to the first application may be referred to as the first process
  • the process corresponding to the second application may be referred to as the second process.
  • the electronic device may acquire the target file corresponding to the target application, and then determine whether the data contained in the target file has changed.
  • the target file may be composed of multiple key-value pairs, when one or more of the When the key-value pair changes, it can be determined that the data contained in the target file has changed.
  • to determine whether the data contained in the target file has changed it may be to determine whether the key (Key) in the target file has changed, or it may be to determine whether the value (Value) in the target file has changed change, or it may also be to determine whether both the key (Key) and the value (Value) in the target file are changed, and so on.
  • the change in determining whether the data contained in the target file has changed may be a situation in which a key value has been added to the target file, wherein the key value may be composed of a key Key and a value value, such as in the original target file. If there is no Key3, the user inputs Key3 through the application program interface. At this time, it can be determined that the target file has changed, and the changed data is "Added Key3".
  • the change can also be that the key value of the target file is reduced, or if there is Key4 in the original file, and the user deletes Key4 through the application program interface, it can be determined that the target file has changed, and the changed data is " Deleted Key3".
  • the change may also be a situation where the key value is replaced in the target file. For example, if the original target file contains Key5, the user inputs Key6 through an application program, and the Key5 is replaced by this Key6.
  • the change in determining whether the data of the target file version has changed may also be other situations, and the specific one will not be repeated here.
  • determining whether the data contained in the target file has changed may be determining whether the target file belonging to the first process has changed. If it is determined that the data contained in the target file has changed, the embodiment of the present application can obtain the corresponding data of the change. key-value pair, that is, go to step S120. If it is determined that the target file has not changed, then re-monitor whether the data contained in the target file has changed. In this embodiment of the present application, monitoring may be performed once every preset time period, or monitoring may be performed once when it is determined that data input by the user is received, or the like.
  • Step S120 When the data contained in the target file is changed, acquire a key-value pair corresponding to the changed data, and determine a second process associated with the first process.
  • the electronic device when it determines that the data contained in the target file has changed, it may determine a key-value pair corresponding to the changed data, and the changed data may be the changed data in the target file.
  • the embodiment of the present application can also first locate the position information of the changed data in the target file, and can quickly locate the changed data through the position information. By acquiring the key-value pair corresponding to the changed data, this embodiment of the present application can determine what the changed data is. For example, the key Key changes, the value Value changes, or both the key Key and the value Value change. change etc.
  • the changed data may be used as the target data.
  • the electronic device may determine the second process associated with the first process, and then send a data change instruction to the The second process, namely, goes to step S130.
  • step S120 may include steps S121 to S122.
  • Step S121 Acquire historical data corresponding to each of the processes, and determine whether the corresponding process is related to the first process according to each of the historical data.
  • the historical data corresponding to a process may include tag information input by a user, and the electronic device may obtain tag information corresponding to each process, where the tag information may be description information input by the user, the description information saying that the process is to be used for Describes information about other processes related to the first process.
  • the description information corresponding to process A is "The processes related to this process include process B and process C", and then process B and process C can be called processes related to process A.
  • the second process associated with the first process may have a relatively high frequency of data interaction with the first process, or may be the degree of importance between the first process and the second process, and the degree of importance may be The degree of influence of the second process on the first process, or the degree of influence of the first process on the second process.
  • the degree of importance between the first process and the second process may also be set by the user according to his own needs. For example, the user feels that the change of the data of the first process will greatly affect the operation of the second process. At this time, user A can set the second process as a process associated with the first process.
  • the number of second processes related to the first process in the electronic device may be one or multiple.
  • the embodiment of the present application may directly send data Change the command to the second process.
  • the embodiment of the present application may also send the data change instruction to the second process at the same time.
  • the embodiment of the present application may also first obtain the frequency of data interaction between each second process and the first process, and then interact according to the data.
  • the frequency of the multiple processes is sorted from high to low, and the frequency sorting result is obtained.
  • the data change instruction is then sent to the second process according to the order of the frequency sorting results.
  • this embodiment of the present application can also monitor which process is to be run among the multiple second processes, and when it is determined that the process is to be run
  • the data change instruction is sent to the second process, and the time of the sending operation is between the time when the target file in the first process is determined to be changed and the time when the second process is opened for the first time.
  • the first process and the second process may be processes corresponding to different application programs, and when it is determined that the data of the first application process has changed, the electronic device may determine the second application process associated with the first application process, The changed data is sent to the second application process.
  • the second application process can know which data has been changed in the first application process, the location of the changed data in the target file, and what the data has changed.
  • Step S122 If relevant, take the relevant process as the second process.
  • this embodiment of the present application may regard the related process as the second process.
  • the related process may be regarded as the second process.
  • the embodiment of the present application may also determine whether there is a weakly related process in the multiple processes, and the weakly related process refers to a process related to the first process, but Less associated processes.
  • the embodiments of the present application may use other processes except the weakly correlated processes as the second process, so that unnecessary power consumption brought by data transmission to the electronic device can be reduced.
  • Step S130 Send a data change instruction to the second process, where the data change instruction includes the key-value pair.
  • this embodiment of the present application may send a data change instruction to the second process.
  • the data change instruction may also be referred to as change prompt information, and the data change instruction is used to prompt the second process "what data has changed in the first process".
  • the data change instruction may include changing a key-value pair of data, and sending the key-value pair of changing data to the second process may prompt the second process. In other words, through the data change instruction, the second process can be prompted "what data has changed in the first process", and what the data has changed.
  • the data change instruction may also include changing the address of the data in the target file.
  • the second process can quickly locate the location of the changed data, so that the second process can further monitor the changed data. .
  • the change data in this embodiment of the present application may include a plurality of sub-change data, and these sub-change data may be data changed within a preset time period, and the preset time period may be the last time a data change instruction was sent The time elapses the preset time period.
  • the last time the data change instruction was sent was 14:00 on March 05, 2021, and the preset duration is 1 hour, that is, the statistics in this embodiment of the application are from 14:00 on March 5, 2021 to March 2021.
  • the data that changed within 15:00 on the 05th, after confirming that the keys of the changed data are divided into Key1 and Key2, at this time Key1 and Key2 can be collectively referred to as changed data.
  • the first process may be a process of interest to the second process, that is, the second process may achieve a preset goal by analyzing the data process of the first process.
  • the second process determines the user's usage habits by analyzing the usage data of the first process, and then recommends different advertisements for the user according to the usage habits.
  • the data management method provided by the embodiment of the present application can improve the efficiency of data management by sending the data changed in the first process to the second process. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • another embodiment of the embodiment of the present application provides a data management method, and the data management method may include the following steps S210 to S250.
  • Step S210 Obtain a target file, and store the target file in the first partition of the disk.
  • step S220 is entered.
  • Step S220 Acquire a backup file according to the target file, and store the backup file in the second partition of the disk.
  • the disk of the electronic device may be dual-partitioned.
  • the database file corresponding to the electronic device may adopt a dual-partition design, that is, the target file may be protected by a dual-partition backup strategy.
  • steps S221 to S222 may be included after obtaining a backup file according to the target file and storing the backup file in the second partition of the disk.
  • Step S221 Determine whether the target file has changed.
  • Step S222 If the target file is changed, determine the changed data, and update the backup file based on the changed data.
  • the embodiment of the present application performs partition storage on the target file.
  • the backup file stored in the second partition can also be changed accordingly. It can be seen that the data stored in the first partition and the data stored in the second partition are basically changed at the same time, so it can be ensured that when the data in the first partition is abnormal, the data stored in the second partition is the latest.
  • steps S223 to S224 may be further included.
  • Step S223 Determine whether the target file is formatted.
  • the data in the first partition is lost, and at this time, the backup file in the second partition can be used for the target file in the first partition Recovery is performed, ie the entry step is 224 .
  • Step S224 If the target file is formatted, restore the target file in the first partition according to the backup file in the second partition.
  • the embodiment of the present application provides a schematic flowchart as shown in FIG. 6 .
  • the primary database file in Figure 6 is the target file, and the standby database file can be a backup file, and the target file and the backup file can be stored in partitions.
  • the embodiment of the present application can monitor whether the main database file exists. When it is determined that the main database exists, the electronic device can further determine whether the standby database file exists. If both the main database file and the standby database file exist, obtain the database file size. , to determine whether the structure of the database has changed, if so, traverse the main database file, synchronize the current configuration, and update the default configuration. If the standby database file has not changed, the master and standby file handles are opened at the same time, and the initialization is completed.
  • the embodiment of the present application can restore the standby database from the main database file, that is, obtain the backup file according to the target file.
  • the embodiment of the present application can further determine whether the standby database file exists, and if the standby database exists, the main database file is created, and the main database is restored from the standby database file. If the standby database does not exist, the primary and standby database files are created based on the default data structure. Among them, the main database file does not exist usually because the data is formatted, or the data is in read-only format, etc.
  • Step S230 Determine whether the data contained in the target file has changed, and the target file belongs to the first process.
  • Step S240 When the data contained in the target file is changed, acquire a key-value pair corresponding to the changed data, and determine a second process associated with the first process.
  • Step S250 Send a data change instruction to the second process, where the data change instruction includes the key-value pair.
  • the embodiments of the present application may read and write data in the target file, and the read/write process may include a read-write lock or a mutual exclusion lock.
  • the embodiment of the present application provides the flow charts shown in FIG. 7 and FIG. 8 , wherein FIG. 7 is the reading process, and FIG. 8 is the writing process. It can be known from FIG. 7 that in the process of reading the file, the embodiment of the present application can first determine whether the type and length of the target file meet the preset length, that is, the type and length of the target file are checked, and when the check conditions are met, then You can use file locks for read locks and locks, as well as thread locks. Then find the file offset corresponding to the key, adjust the file handle to point to the offset and copy the data, then the file lock-read lock is unlocked, and finally the reading ends.
  • the embodiment of the present application can first determine whether the type and length of the target file satisfy the preset length, that is, the type and length of the target file are checked. , you can use file locks for write locks and locks, as well as thread locks. Then find the file offset corresponding to the key, adjust the file handle to point to the offset and copy the data, then unlock the file lock-write lock, unlock the thread lock, when it is determined that the content of the database (DB) has changed, initiate IPC to notify the APP, and finally write Finish. It can be seen that when it is determined that the content of the database has changed, the present application can send the changed data to other processes by using inter-process communication.
  • the data management method provided by the embodiment of the present application can improve the efficiency of data management by sending the data changed in the first process to the second process. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • the target file is stored in partitions, which can ensure the security of the database file to a certain extent.
  • another embodiment of the embodiment of the present application provides a data management method, and the data management method may include the following steps S310 to S360.
  • Step S310 Receive table configuration data, where the table configuration data includes data name, data type, maximum length of stored data, and default value.
  • the embodiment of the present application can receive the form configuration data input by the user, and the form data is used to construct the structure of the database, that is, the embodiment of the present application can generate structured text through the form configuration data.
  • the table configuration data may include data name, data type, maximum length of stored data and default value, and the format of the table configuration data is shown in Figure 10.
  • the table configuration data consists of Key Name, Type, Max Size and Default Value, where Key Name is the data name, which can be the Key of the corresponding data, and the Key Name is unique; Type is the data type and its The data type stored for the current entry; Max Size is the maximum length of the specified storage data, the Max Size is only valid for the data type String or Binary, and for known data types, the length is fixed. For example, u32 is fixed at 4 bytes, and the Max Size configured by the user does not take effect; Default Value is the default value. When neither the target file nor the backup file exists, the embodiment of the present application will recreate the main and backup files based on the default value.
  • the default value can be set according to the empirical value, and the corresponding default value is different depending on the Key Name. For example, if the Key Name is the address of the NTP1 server, the corresponding default value is ntp1.aliyun.com; Key Name is the address of the NTP2 server, and the corresponding default value is ntp2.aliyun.com.
  • Step S320 Generate a target table according to the table configuration data, use the target table as a target file, and store the target file in the first partition of the disk.
  • generating a target table according to the table configuration data, using the target table as a target file, and storing the target file in the first partition of the disk may include: determining whether to receive a message sent by an application program interface Data creation instructions. If the data creation instruction sent by the application program interface is received, the target table is updated by using the data creation instruction to obtain a target file.
  • the user can update the data table through different application program interfaces, and then obtain the target file.
  • the query of the target file can adopt the KEY-VALUE method and the type is related, and the type related refers to the type of the data.
  • Relevant that is, the size of the space occupied by the data type in the database file is related. For example, uint8_t occupies 1 byte fixedly, while the string type has a variable length.
  • this application provides a list of application program interfaces as shown in Table 1 below.
  • Table 1 shows different application program interfaces, which may include an application program read interface, an application program write interface, and descriptions of different interfaces, wherein the description part mainly carries data on the type of the interface.
  • the types of the application program interface in the embodiment of the present application may be char type, unsigned char type, short type, int type, string type, binary data, etc. These interfaces make the database operation interface more complete, and the database is designed based on files, and the operation is simple , which can be easily ported to other projects.
  • Step S330 Acquire a backup file according to the target file, and store the backup file in the second partition of the disk.
  • Step S340 Determine whether the data contained in the target file has changed, and the target file belongs to the first process.
  • Step S350 When the data contained in the target file is changed, acquire a key-value pair corresponding to the changed data, and determine a second process associated with the first process.
  • Step S360 Send a data change instruction to the second process, where the data change instruction includes the key-value pair.
  • the data management method provided by the embodiment of the present application can improve the efficiency of data management by sending the data changed in the first process to the second process. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • the embodiment of the present application can simply and effectively manage the database by using a complete database interface, and the embodiment of the present application can implement customized requirements for the database through the configuration table, which can improve the user experience.
  • an embodiment of the present application further provides a data management apparatus 400 .
  • the data management apparatus 400 includes: a determination module 410 , an acquisition module 420 , and a transmission module 430 .
  • the determining module 410 is configured to determine whether the data contained in the target file has changed, and the target file belongs to the first process.
  • the obtaining module 420 is configured to obtain a key-value pair corresponding to the changed data when the data contained in the target file is changed, and determine a second process associated with the first process.
  • the acquisition module 420 is also used to acquire historical data corresponding to each of the processes, and to determine whether the corresponding process is related to the first process according to each of the historical data; as the second process.
  • the data management apparatus 400 is further configured to obtain the target file, and store the target file in the first partition of the disk; obtain the backup file according to the target file, and The backup file is stored in the second partition of the disk.
  • the data management apparatus 400 is further configured to determine whether the target file has changed; If the file is changed, the changed data is determined, and the backup file is updated based on the changed data.
  • the data management apparatus 400 is further configured to determine whether the target file is formatted; if the target file is formatted; If the target file is formatted, the target file in the first partition is restored according to the backup file in the second partition.
  • the data management device 400 is further configured to receive table configuration data, where the table configuration data includes data name, data type, maximum length of stored data, and default value; generate a target table according to the table configuration data, and use the table configuration data to Target table as target file.
  • the data management apparatus 400 is further configured to determine whether to receive the data creation instruction sent by the application program interface; if the data creation instruction sent by the application program interface is received, then use the data creation instruction to perform the target table operation. Update, get the target file.
  • the data management apparatus can improve the efficiency of data management by sending the data changed in the first process to the second process. Specifically, it is first determined whether the data contained in the target file has changed, wherein the target file belongs to the first process, when it is determined that the data contained in the target file has changed, the key-value pair corresponding to the changed data is obtained, and then the key-value pair corresponding to the changed data can be determined. The associated second process finally sends a data change instruction to the second process, wherein the data change instruction may include a key-value pair.
  • the application can send a data change instruction to the second process, which can facilitate the management of data by the user and improve the efficiency of data management to a certain extent.
  • an embodiment of the present application further provides an electronic controller 500 .
  • the electronic controller 500 includes a processor 510 and a memory 520 .
  • the memory 520 stores computer program instructions, and the computer program instructions are called by the processor 510 in real time.
  • Processor 510 may include one or more processing cores.
  • the processor 510 uses various interfaces and lines to connect various parts in the entire electronic controller, and executes by running or executing the instructions, programs, code sets or instruction sets stored in the memory 520, and calling the data stored in the memory 520.
  • Various functions of the electronic controller and processing data may adopt at least one of a digital signal processing (Digital Signal Processing, DSP), a Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and a Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 510 may integrate one or a combination of a central processing unit 510 (Central Processing Unit, CPU), a graphics processor 510 (Graphics Processing Unit, GPU), a modem, and the like.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • the CPU mainly handles the operating system, user interface and application programs, etc.
  • the GPU is used for rendering and drawing of the display content
  • the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 510, and is implemented by a communication chip alone.
  • the memory 520 may include a random access memory 520 (Random Access Memory, RAM), or may include a read-only memory 520 (Read-Only Memory).
  • the memory 520 map may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • the memory 520 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the above method embodiments, and the like.
  • the storage data area can also store data etc. created by the electronic controller in use.
  • an embodiment of the present application further provides a vehicle 600 .
  • the vehicle 600 includes a vehicle body 610 and an electronic controller 620 .
  • the aforementioned electronic controller 620 is provided in the vehicle body 610 , and the electronic controller 620 uses for data management.
  • an embodiment of the present application further provides a computer-readable storage medium 700, where computer program instructions 710 are stored in the computer-readable storage medium 700, and the computer program instructions 710 can be called by a processor to execute the above methods described in the examples.
  • the computer-readable storage medium may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium includes a non-volatile computer-readable storage medium (non-transitory computer-readable storage medium).
  • the computer-readable storage medium 700 has storage space for program code to perform any of the method steps in the above-described methods. These program codes can be read from or written to one or more computer program products.
  • the program code may, for example, be compressed in a suitable form.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据管理方法、装置以及电子控制器,涉及车辆技术领域,该方法包括:确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程(S110);当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程(S120);发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对(S130)。所述数据管理方法在确定第一进程的目标文件发生改变时通过将改变的数据发送至第二进程,其在一定程度上可以提高数据管理的效率。

Description

数据管理方法、装置以及电子控制器
交叉引用
本申请要求2021年3月9日递交的发明名称为“数据管理方法、装置以及电子控制器”的申请号202110257229.3的在先申请优先权,上述在先申请的内容以引入的方式并入本文本中。
技术领域
本申请涉及车辆技术领域,具体涉及一种数据管理方法、装置以及电子控制器。
背景技术
随着云计算、物联网等技术的不断发展和应用,海量的数据在生产经营、商务活动、社交生活等领域不断产生。人们正处在信息时代,有些国家甚至把数据管理提升到了国家战略层面,很多企业也将数据管理作为提高自身竞争力的重要手段。可见,对数据的管理正在影响着人们的工作和生活,如此也使得对数据库的管理显得尤为重要。
申请内容
鉴于以上问题,本申请实施例提供一种数据管理方法、装置以及电子控制器,以解决上述技术问题。
本申请实施例是采用以下技术方案实现的:
第一方面,本申请一些实施例提供一种数据管理方法,所述方法包括:确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程;当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程;发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
第二方面,本申请一些实施例还提供一种数据管理装置,该装置包括确定模块、获取模块以及发送模块。确定模块,用于确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程。获取模块,用于当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程。发送模块,用于发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
第三方面,本申请一些实施例还提供一种电子控制器,包括处理器以及存储器,所述存储器存储有计算机程序指令,所述计算机程序指令被所述处理器调用时执行上述任一项所述的数据管理方法。
第四方面,本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序指令,计算机程序代码可被处理器调用以执行上述任一项的数据管理方法。
本申请实施例提供的数据管理方法、装置以及电子控制器,本申请通过将第一进程中改变的数据发送给第二进程,可以提高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。
本申请的这些方面或其他方面在以下实施例的描述中会更加简明易懂。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本申请一实施例提供的一种数据管理方法的流程示意图。
图2示出了本申请一实施例提供的一种数据管理方法中步骤S120的流程示意图。
图3示出了本申请另一实施例提供的一种数据管理方法的流程示意图。
图4示出了本申请另一实施例提供的一种数据管理方法中其他步骤的流程示意图。
图5示出了本申请另一实施例提供的一种数据管理方法中其他步骤的流程示意图。
图6示出了本申请另一实施例提供的一种数据管理方法的工作流程图。
图7示出了本申请另一实施例提供的一种数据管理方法中对文件进行读的流程示意图。
图8示出了本申请另一实施例提供的一种数据管理方法中对文件进行写的流程示意图。
图9示出了本申请又一实施例提供的一种数据管理方法的流程示意图。
图10示出了本申请又一实施例提供的一种数据管理方法中表格配置数据格式示意图。
图11示出了本申请实施例提供的一种数据管理装置的模块框图。
图12示出了本申请实施例提供的一种电子控制器的模块框图。
图13示出了本申请实施例提供的一种车辆的结构示意图。
图14示出了本申请实施例提供的一种计算机可读存储介质的模块框图。
具体实施方式
下面详细描述本申请的实施方式,实施方式的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施方式是示例性地,仅用于解释本申请,而不能理解为对本申请的限制。
下面详细描述本申请的实施方式,实施方式的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施方式是示例性地,仅用于解释本申请,而不能理解为对本申请的限制。
为了使本技术领域的人员更好地理解本申请的方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整的描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
随着云计算、物联网等技术的不断发展和应用,海量的数据在生产经营、商务活动、社交生活等领域不断产生。人们正处在信息时代,有些国家甚至把数据管理提升到了国家战略层面,很多企业也将数据管理作为提高自身竞争力的重要手段。可见,对数据的管理正在影响着人们的工作和生活,尤其是对数据库的管理显得尤为重要。另外,现有的嵌入式系统通常需要设计中间层(Middle-Layer),该中间层主要有服务于上层的APP(APPlication,应用程序)的通用业务请求。比如,日志管理、IPC(Inter-Progress Communication,进程间通信)以及数据库存储等业务。相较于车载产品而言,数据库的读写效率和资源的使用尤为重要,故对数据库的读写和资源的使用的要求便是小巧。
另外,随着应用程序版本的不断迭代,表的数据结构也会不断发生变化,在这个变化中用户的使用数据很可能会被破坏,且现有技术在对数据库进行管理时无法保证数据的可靠性。现有的数据库选型上,Sqlite比较通用,但是,Sqlite无法完成定制化的需求,在一个应用程序对应的数据发生改变后,其不会通知给其他应用程序。
为了解决上述技术问题,申请人经过长期研究,提出了本申请实施例中的数据管理方法、装置以及电子控制器,该数据管理方法通过将第一进程中改变的数据发送给第二进程,可以提 高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。
如图1所示,图1示意性地示出了本申请实施例提供的数据管理方法的流程示意图。该方法可以包括以下步骤S110至步骤S130。
步骤S110:确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程。
作为一种方式,本申请实施例可以应用于电子设备,该电子设备可以配置有数据管理模块,该数据管理模块主要用于对电子设备中的数据库进行管理。本申请实施中,数据库可以是一张基于Key-Vlue(键值对)的映射表,其主要存放于文件中,在版本迭代中用户新增、修改或者删除了一个Key,对应的数据库文件也需要更新这个Key,同时不会影响其他的Key对应的Value。这里的数据库文件即可作为所述目标文件,可见,目标文件可以包括多个不同的数据,这些数据可以是车辆相关的控制参数,该控制参数可以包括温度、湿度、版本数、车速以及去参数等。
作为另一方式,目标文件可以属于第一进程,所述第一进程可以是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位。并且,第一进程也可以是预设应用程序对应的进程,即不同的应用程序则其对应的进程也可能不相同。比如,第一应用程序对应的进程可以称作是第一进程、第二应用程序对应的进程则可以称作是第二进程。
在一些实施方式中,电子设备可以获取目标应用程序对应的目标文件,而后确定所述目标文件包含的数据是否发生改变,所述目标文件可以由多个键值对组成,当其中一个或者多个键值对发生改变时,即可确定目标文件包含的数据发生了改变。本申请实施例中,确定目标文件包含的数据是否发生改变,其可以是确定所述目标文件中的键(Key)是否发生改变,也可以是确定所述目标文件中的值(Value)是否发生改变,或者也可以是确定所述目标文件中的键(Key)和值(Value)是否均发生改变等。
在另一些实施方式中,确定目标文件包含的数据是否发生改变中的改变可以是目标文件发生了键值增加的情形,其中,键值可以是由键Key和值value组成,如原目标文件中没有Key3,用户通过应用程序接口输入了Key3,此时即可确定目标文件发生了改变,且改变的数据是“增加了Key3”。另外,改变也可以是目标文件发生了键值减少的情形,或如原文件中有Key4,用户通过应用程序接口删除了Key4,此时即可确定目标文件发生了改变,且改变的数据是“删 除了Key3”。所述改变也可以是目标文件发生了键值替换的情形,如原目标文件中有Key5,用户通过应用程序输入了Key6,并通过该Key6替换了所述Key5。确定目标文件版的数据是否发生改变中的改变也可以是其他情形,具体是哪一种这里就不进行一一赘述了。
综上所述,确定目标文件包含的数据是否发生改变可以是确定属于第一进程的目标文件是否发生改变,如果确定目标文件包含的数据发生改变,本申请实施例则可以获取所述改变数据对应的键值对,即进入步骤S120。如果确定目标文件未发生改变,则重新监测目标文件包含的数据是否发生改变。本申请实施例可以每隔预设时长监测一次,或者也可以在确定接收到用户输入的数据时监测一次等。
步骤S120:当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程。
在一些实施方式,电子设备在确定目标文件包含的数据发生改变时,其可以确定改变数据对应的键值对,所述改变数据可以是目标文件中发生改变的数据。另外,在确定目标文件包含的数据发生改变时,本申请实施例也可以先定位出发生改变的数据在目标文件中的位置信息,通过该位置信息可以快速定位出改变的数据。通过获取改变数据对应的键值对,本申请实施例可以确定出改变的数据是什么,如可以是键Key发生改变,也可以是值Value发生改变,或者也可以是键Key和值Value均发生改变等。
本申请实施例可以将发生改变的数据作为目标数据,在获取到目标数据对应的键值对之后,电子设备可以确定出与第一进程关联的第二进程,然后将数据改变指令发送至所述第二进程,即进入步骤S130。
在另一些实施方式中,请参阅图2,步骤S120可以包括步骤S121至步骤S122。
步骤S121:获取每个所述进程对应的历史数据,并根据每个所述历史数据确定其对应的进程与所述第一进程是否相关。
在一些实施方式中,进程对应的历史数据可包括用户输入的标记信息,电子设备可以获取每个进程对应的标记信息,所述标记信息可以是用户输入的说明信息,该说明信息说要用于说明与第一进程相关的其他进程的信息。例如,进程A对应的说明信息为“与本进程相关的进程有进程B和进程C”,此时进程B和进程C则可以称作为是与进程A相关的进程。
作为一种方式,与第一进程关联的第二进程可以是与第一进程进行数据交互的频次比较高,也可以是第一进程与第二进程之间的重要程度,所述重要程度可以是第二进程对第一进程的影响程度,或者是第一进程对第二进程的影响程度。另外,第一进程和第二进程之间的重要程度也可以是用户根据其自身需求设置的。例如,用户觉得第一进程数据改变后会很大程度的 影响到第二进程的运行,此时用户A则可以将第二进程设置成与第一进程相关联的进程。
作为另一种方式,电子设备中与第一进程相关的第二进程可以是一个也可以是多个,当与第一进程相关的第二进程是一个是,本申请实施例则可以直接发送数据改变指令至第二进程。当与第一进程相关的第二进程是多个时,本申请实施例也可以将数据改变指令同时发送至第二进程。
作为另一种方式,当与第一进程相关的第二进程是多个时,本申请实施例也可以先获取每个第二进程与第一进程进行数据交互的频次,然后根据所述数据交互的频次对所述多个进程进行从高到低的排序,得到频次排序结果。然后根据频次排序结果的顺序将数据改变指令发送至第二进程。
作为另一种方式,当与第一进程相关的第二进程是多个时,本申请实施例也可以监测所述多个第二进程中哪个进程将要被运行,并在确定进程将要被运行时将所述数据改变指令发送至第二进程,所述发送操作的时间是间于确定第一进程内的目标文件发生改变的时间之后,以及首次打开第二进程的时间。
作为一个示例,第一进程和第二进程可以是不同应用程序对应的进程,在确定第一应用进程的数据发生改变时,电子设备可以确定与所述第一应用进程关联的第二应用进程,并将改变的数据发送至第二应用进程,通过发送该数据可以使第二应用进程知晓第一应用进程哪些数据改变了,改变的数据在目标文件中的位置,以及数据改变成什么了等。
步骤S122:如果相关,则把相关的进程作为所述第二进程。
在一些实施方式中,根据历史数据确定其对应的进程与第一进程相关时,本申请实施例可以将相关的进程作为第二进程。其中,第二进程可以是多个,即当确定与第一进程相关的进程为多个时,可以将所述多个进程均作为第二进程。
另外,在确定与第一进程相关的进程为多个时,本申请实施例也可以确定所述多个进程中是否存在弱相关进程,所述弱相关进程指的是与第一进程相关,但是关联程度较小的进程。当确定多个进程中存在弱相关进程时,本申请实施例可以将除弱相关进程之外的其他进程作为第二进程,如此可以降低数据传输为电子设备带来的不必要功耗。
步骤S130:发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
在一些实施方式中,在确定出与第一进程关联的第二进程之后,本申请实施例可以发送数据改变指令至第二进程。其中,数据改变指令也可以称作是变化提示信息,通过该数据改变指令以提示第二进程“第一进程哪些数据发生了改变”。另外,数据改变指令可以包括改变数据的键值对,将所述改变数据的键值对发送至第二进程可以提示第二进程。换句话说,通过数据 改变指令可以提示第二进程“第一进程有哪些数据发生改变了”,以及这些数据改变成什么了。
另外,数据改变指令也可以包括改变数据在目标文件中的地址,通过该数据改变指令,第二进程可以快速定位出改变数据的位置,以方便第二进程可以对所述改变数据进行进一步的监控。
需要说明的是,本申请实施例中的改变数据可以包括多个子变化数据,这些子变化数据可以是预设时间段内发生改变的数据,所述预设时间段可以是上一次发送数据改变指令的时间经过预设时长的时间。例如,上一次发送数据改变指令的时间是2021年03月05日14:00,预设时长为1小时,即本申请实施例统计的是2021年03月05日14:00到2021年03月05日15:00内发生改变的数据,通过确认发现发生改变的数据的键分为是Key1和Key2,此时的Key1和Key2可以统称为改变的数据。
另外,第一进程可以是第二进程感兴趣的进程,即第二进程通过对第一进程的数据进程分析可以实现预设目标。例如,第二进程通过对第一进程使用数据的分析,确定出用户的使用习惯,进而根据使用习惯为用户推荐不同的广告。
本申请实施例提供的数据管理方法通过将第一进程中改变的数据发送给第二进程,可以提高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。
如图3所示,本申请实施例另一实施例提供了一种数据管理方法,该数据管理方法可以其包括以下步骤S210至步骤S250。
步骤S210:获取目标文件,并将所述目标文件存储于磁盘的第一分区内。
作为一种方式,本申请实施例在获取到目标文件之后,其可以将目标文件存储于磁盘的第一分区内,而后根据目标文件获取备份文件,并将备份文件存储于磁盘的第二分区内,即进入步骤S220。
步骤S220:根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内。
本申请实施例中,电子设备的磁盘可以是双分区的,为了提高数据管理的可靠性,电子设备对应的数据库文件可以采用双分区设计,即目标文件可以以双分区备份的策略进行保护。在一些实施方式中,请参阅图4,根据所述目标文件获取备份文件,并将所述备份文件存储于所 述磁盘的第二分区内之后可以包括步骤S221至步骤S222。
步骤S221:确定所述目标文件是否发生改变。
步骤S222:如果所述目标文件发生改变,则确定发生改变的数据,并基于所述发生改变的数据对所述备份文件进行更新。
作为一种方式,为了保证数据的安全,本申请实施例对目标文件进行了分区存储,当第一分区内存储的目标文件发生改变时,第二分区内存储的备份文件也可以随之改变。可见,第一分区内存储的数据和第二分区内存储的数据是基本是同时改变的,如此可以保证在第一分区内的数据发生异常时,第二分区内存储的数据是最新的。
请参阅图5,根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内之后还可以包括步骤S223至步骤S224。
步骤S223:确定所述目标文件是否发生格式化。
在另一些实施方式中,当确定目标文件发生异常,如目标文件发生格式化时,第一分区内的数据丢失,此时则可以利用第二分区内的备份文件对第一分区内的目标文件进行恢复,即进入步骤是224。
步骤S224:如果所述目标文件发生格式化,则根据所述第二分区内的所述备份文件对所述第一分区内的所述目标文件进行恢复。
为了更清楚的理解双分区数据保护策略,本申请实施例给出了如图6所示的流程示意图。图6中的主数据库文件为目标文件,而备数据库文件则可以是备份文件,目标文件和备份文件可以分区存储。在进行数据管理时本申请实施例可以监测主数据库文件是否存在,当确定主数据库存在时,电子设备可以进一步确定备数据库文件是否存在,如果主数据库文件和备数据库文件均存在则获取数据库文件大小,判断数据库的结构是否发生改变,如果发生改变,则遍历主数据库文件,同步当前配置,并更新默认配置。如果备数据库文件未发生改变,则同时打开主备文件句柄,初始化完成。
另外,通过图6可以知道,在确定备数据库文件不存在时,本申请实施例则可以从主数据库文件中恢复出备数据库,即根据目标文件获取到备份文件。当确定主数据库文件不存在时,本申请实施例可以进一步判断备数据库文件是否存在,如果备数据库存在,则创建主数据库文件,并从备数据库文件中恢复出主数据库。如果备数据库不存在,则基于默认数据结构创建主、备数据库文件。其中,主数据库文件不存在通常是因为数据被格式化,或者是数据是只读格式等。
步骤S230:确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程。
步骤S240:当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程。
步骤S250:发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
在一些实施方式中,获取到目标文件之后,本申请实施例可以对目标文件中的数据进行读写,而该读写过程则可以包含有读写锁或者互斥锁等。为了更清楚的理解读写过程,本申请实施例给出了如图7和图8所示的流程图,其中,图7为读的流程,而图8则为写的流程。通过图7可以知道在对文件进行读的过程中,本申请实施例可以先确定目标文件的类型以及长度是否满足预设长度,即对目标文件的类型和长度进行检查,当满足检查条件,则可以利用文件锁进行读锁和上锁,以及线程锁上锁。然后查找Key对应的文件偏移,调整文件句柄指向该偏移并拷贝数据,接着文件锁-读锁解锁,最后读结束。
另外,通过图8可以知道在对文件进行写的过程中,本申请实施例可以先确定目标文件的类型以及长度是否满足预设长度,即对目标文件的类型和长度进行检查,当满足检查条件,则可以利用文件锁进行写锁和上锁,以及线程锁上锁。然后查找Key对应的文件偏移,调整文件句柄指向该偏移并拷贝数据,接着文件锁-写锁解锁,线程锁解锁,当确定数据库(DB)内容发生改变时,发起IPC通告APP,最后写结束。可见,本申请在确定数据库的内容发生改变时,可以利用进程间的通信将改变的数据发送至其他进程。
本申请实施例提供的数据管理方法通过将第一进程中改变的数据发送给第二进程,可以提高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。另外,本申请实施例为了提高数据管理的可靠性,对目标文件进行分区存储,在一定程度上可以保证数据库文件的安全性。
如图9所示,本申请实施例又一实施例提供了一种数据管理方法,该数据管理方法可以其包括以下步骤S310至步骤S360。
步骤S310:接收表格配置数据,所述表格配置数据包括数据名称、数据类型、存储数据的最大长度以及默认值。
作为一种方式,本申请实施例可以接收用户输入的表格配置数据,所述表格数据用于构建数据库的结构,即通过所述表格配置数据本申请实施例可以生成结构化的文本。其中,表格配 置数据可以包括数据名称、数据类型、存储数据的最大长度以及默认值,表格配置数据的格式如图10所示。从图10可以看出表格配置数据由Key Name、Type、Max Size以及Default Value组成,其中,Key Name为数据名称,其可以是对应数据的Key,且Key Name具有唯一性;Type为数据类型其为当前条目存储的数据类型;Max Size为指定存储数据的最大长度,所述Max Size仅对数据类型String或者Binary有效,而对于已知的数据类型,长度则是固定的。比如u32固定是4字节,用户配置Max Size不生效;Default Value为默认值,当目标文件或者备份文件均不存在时,本申请实施例会基于默认值重新创建主备文件。
本申请实施例中,默认值可以根据经验值设置,且Key Name不同其对应的默认值则不相同,如Key Name为NTP1服务器的地址,其对应的默认值为ntp1.aliyun.com;又如Key Name为NTP2服务器的地址,其对应的默认值则为ntp2.aliyun.com。
步骤S320:根据所述表格配置数据生成目标表格,将所述目标表格作为目标文件,并将所述目标文件存储于磁盘的第一分区内。
作为一种方式,根据所述表格配置数据生成目标表格,将所述目标表格作为目标文件,并将所述目标文件存储于磁盘的第一分区内可以包括:确定是否接收到应用程序接口发送的数据创建指令。如果接收到所述应用程序接口发送的数据创建指令,则利用所述数据创建指令对所述目标表格进行更新,得到目标文件。
本申请实施例中,用户通过不同的应用程序接口可以实现对数据表格的更新,进而得到目标文件,目标文件的查询可以采用KEY-VALUE方式且类型相关,所述类型相关指的是数据的类型相关,即数据类型在数据库文件中占有的空间大小相关,如uint8_t固定占用1字节,而string类型则为可变长度。为了更好的理解应用程序接口,本申请给出了如下表1所示的应用程序接口列表。
表1
Figure PCTCN2021094763-appb-000001
Figure PCTCN2021094763-appb-000002
表1示出了不同的应用程序接口,其可以包括应用程序读接口,应用程序写接口,以及对不同接口的说明,其中,说明部分主要是对接口的类型进行数据,通过表1可以知道,本申请实施例中的应用程序接口的类型可以是char类型、Unsigned char类型、short类型、int类型、string类型以及二进制数据等,这些接口使得数据库操作接口更加完整,且数据库基于文件设计、操作简单,可轻松移植到其他项目。
步骤S330:根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内。
步骤S340:确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程。
步骤S350:当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程。
步骤S360:发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
本申请实施例提供的数据管理方法通过将第一进程中改变的数据发送给第二进程,可以提高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。另外,本申请实施例通过利用完整的数据库接口能够简单有效的对数据库进行管理,并且本申请实施例通过配置表格可以实现对数据库的定制化需求,可以提高用户的使用体验。
如图11所示,本申请实施例还提供一种数据管理装置400,该数据管理装置400包括:确定模块410、获取模块420和发送模块430。
确定模块410,用于确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程。
获取模块420,用于当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程。
进一步地,获取模块420还用于获取每个所述进程对应的历史数据,并根据每个所述历史数据确定其对应的进程与所述第一进程是否相关;如果相关,则把相关的进程作为所述第二进程。
进一步地,确定目标文件包含的数据是否发生改变之前,数据管理装置400还用于获取目标文件,并将所述目标文件存储于磁盘的第一分区内;根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内。
进一步地,根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内之后,数据管理装置400还用于确定所述目标文件是否发生改变;如果所述目标文件发生改变,则确定发生改变的数据,并基于所述发生改变的数据对所述备份文件进行更新。
进一步地,根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内之后,数据管理装置400还用于确定所述目标文件是否发生格式化;如果所述目标文件发生格式化,则根据所述第二分区内的所述备份文件对所述第一分区内的所述目标文件进行恢复。
进一步地,数据管理装置400还用于接收表格配置数据,所述表格配置数据包括数据名称、数据类型、存储数据的最大长度以及默认值;根据所述表格配置数据生成目标表格,并将所述目标表格作为目标文件。
进一步地,数据管理装置400还用于确定是否接收到应用程序接口发送的数据创建指令;如果接收到所述应用程序接口发送的数据创建指令,则利用所述数据创建指令对所述目标表格进行更新,得到目标文件。
本申请实施例提供的数据管理装置通过将第一进程中改变的数据发送给第二进程,可以提高数据管理的效率。具体的,首先确定目标文件包含的数据是否发生改变,其中,目标文件属于第一进程,当确定目标文件包含的数据发生改变时,获取改变数据对应的键值对,而后可以确定与第一进程关联的第二进程,最后发送数据改变指令至第二进程,其中,数据改变指令可以包括键值对。本申在确定位于第一进程中的目标文件发生改变时,其可以将数据改变指令发送至第二进程,如此可以方便用户对数据的管理,在一定程度上可以提高数据管理的效率。
如图12所示,本申请实施例还提供一种电子控制器500,该电子控制器500包括处理器510以及存储器520,存储器520存储有计算机程序指令,计算机程序指令被处理器510调用 时实执行上述的数据管理方法
处理器510可以包括一个或者多个处理核。处理器510利用各种接口和线路连接整个电子控制器内的各个部分,通过运行或执行存储在存储器520内的指令、程序、代码集或指令集,以及调用存储在存储器520内的数据,执行电子控制器的各种功能和处理数据。可选地,处理器510可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器510可集成中央处理器510(Central Processing Unit,CPU)、图像处理器510(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器510中,单独通过一块通信芯片进行实现。
存储器520可以包括随机存储器520(Random Access Memory,RAM),也可以包括只读存储器520(Read-Only Memory)。存储器520图可用于存储指令、程序、代码、代码集或指令集。存储器520图可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令、用于实现上述各个方法实施例的指令等。存储数据区还可以存储电子控制器在使用中所创建的数据等。
如图13所示,本申请实施例还提供一种车辆600,该车辆600包括车体610和电子控制器620,上述的电子控制器620设于车体610内,所述电子控制器620用于对数据进行管理。
如图14所示,本申请实施例还提供一种计算机可读取存储介质700,该计算机可读取存储介质700中存储有计算机程序指令710,计算机程序指令710可被处理器调用以执行上述实施例中所描述的方法。
计算机可读取存储介质可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读取存储介质包括非易失性计算机可读取存储介质(non-transitory computer-readable storage medium)。计算机可读取存储介质700具有执行上述方法中的任何方法步骤的程序代码的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码可以例如以适当形式进行压缩。
以上,仅是本申请的较佳实施例而已,并非对本申请作任何形式上的限制,虽然本申请已以较佳实施例揭示如上,然而并非用以限定本申请,任何本领域技术人员,在不脱离本申请技术方案范围内,当可利用上述揭示的技术内容做出些许更动或修饰为等同变化的等效实施例, 但凡是未脱离本申请技术方案内容,依据本申请的技术实质对以上实施例所作的任何简介修改、等同变化与修饰,均仍属于本申请技术方案的范围内。

Claims (10)

  1. 一种数据管理方法,其特征在于,所述方法包括:
    确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程;
    当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程;
    发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
  2. 根据权利要求1所述的方法,其特征在于,所述方法应用于电子控制器,所述电子控制器包括多个进程,所述确定与所述第一进程关联的第二进程,包括:
    获取每个所述进程对应的历史数据,并根据每个所述历史数据确定其对应的进程与所述第一进程是否相关;
    如果相关,则把相关的进程作为所述第二进程。
  3. 根据权利要求1所述的方法,其特征在于,所述确定目标文件包含的数据是否发生改变之前,包括:
    获取目标文件,并将所述目标文件存储于磁盘的第一分区内;
    根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内。
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内之后,包括:
    确定所述目标文件是否发生改变;
    如果所述目标文件发生改变,则确定发生改变的数据,并基于所述发生改变的数据对所述备份文件进行更新。
  5. 根据权利要求3至4任一所述的方法,其特征在于,所述根据所述目标文件获取备份文件,并将所述备份文件存储于所述磁盘的第二分区内之后,还包括:
    确定所述目标文件是否发生格式化;
    如果所述目标文件发生格式化,则根据所述第二分区内的所述备份文件对所述第一分区内的所述目标文件进行恢复。
  6. 根据权利要求3至4任一所述的方法,其特征在于,所述获取目标文件,包括:
    接收表格配置数据,所述表格配置数据包括数据名称、数据类型、存储数据的最大长度以及默认值;
    根据所述表格配置数据生成目标表格,并将所述目标表格作为目标文件。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述表格配置数据生成目标表格, 并将所述目标表格作为目标文件,包括:
    确定是否接收到应用程序接口发送的数据创建指令;
    如果接收到所述应用程序接口发送的数据创建指令,则利用所述数据创建指令对所述目标表格进行更新,得到目标文件。
  8. 一种数据管理装置,其特征在于,所述装置包括:
    确定模块,用于确定目标文件包含的数据是否发生改变,所述目标文件属于第一进程;
    获取模块,用于当所述目标文件包含的数据发生改变时,获取改变数据对应的键值对,并确定与所述第一进程关联的第二进程;
    发送模块,用于发送数据改变指令至所述第二进程,所述数据改变指令包括所述键值对。
  9. 一种电子控制器,其特征在于,包括:
    一个或多个处理器;
    存储器;
    一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1-7中任意一项所述的方法。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-7中任意一项所述的方法。
PCT/CN2021/094763 2021-03-09 2021-05-20 数据管理方法、装置以及电子控制器 WO2022188265A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110257229.3A CN112988706A (zh) 2021-03-09 2021-03-09 数据管理方法、装置以及电子控制器
CN202110257229.3 2021-03-09

Publications (1)

Publication Number Publication Date
WO2022188265A1 true WO2022188265A1 (zh) 2022-09-15

Family

ID=76336337

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/094763 WO2022188265A1 (zh) 2021-03-09 2021-05-20 数据管理方法、装置以及电子控制器

Country Status (2)

Country Link
CN (1) CN112988706A (zh)
WO (1) WO2022188265A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159156B (zh) * 2019-12-31 2023-04-28 杭州迪普科技股份有限公司 SQLite数据库的备份方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778225A (zh) * 2015-03-27 2015-07-15 浙江大学 一种非结构化数据多存储系统中同步数据的方法
CN109918215A (zh) * 2019-03-05 2019-06-21 上海联影医疗科技有限公司 一种进程通信方法、系统、终端和存储介质
CN110569210A (zh) * 2019-06-24 2019-12-13 陕西天行健车联网信息技术有限公司 车载终端的主从结构及其方法
CN111580954A (zh) * 2020-04-01 2020-08-25 中国科学院信息工程研究所 一种可扩展的分布式数据采集方法和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778225A (zh) * 2015-03-27 2015-07-15 浙江大学 一种非结构化数据多存储系统中同步数据的方法
CN109918215A (zh) * 2019-03-05 2019-06-21 上海联影医疗科技有限公司 一种进程通信方法、系统、终端和存储介质
CN110569210A (zh) * 2019-06-24 2019-12-13 陕西天行健车联网信息技术有限公司 车载终端的主从结构及其方法
CN111580954A (zh) * 2020-04-01 2020-08-25 中国科学院信息工程研究所 一种可扩展的分布式数据采集方法和系统

Also Published As

Publication number Publication date
CN112988706A (zh) 2021-06-18

Similar Documents

Publication Publication Date Title
US11762815B2 (en) Multi-framework managed blockchain service
US10318391B2 (en) Non-blocking listener registration in the presence of data grid nodes joining the cluster
JP2020514935A (ja) データベース用の方法及びシステム
WO2022143242A1 (zh) 基于区块链的交易分发执行方法、装置服务器及存储介质
US11176099B2 (en) Lockless synchronization of LSM tree metadata in a distributed system
EP3724786A1 (en) Blockchain lifecycle management
Chun et al. Mobius: unified messaging and data serving for mobile apps
CN109684330A (zh) 用户画像库构建方法、装置、计算机设备及存储介质
CN109766349B (zh) 任务防重方法、装置、计算机设备及存储介质
US20100199109A1 (en) Abstracting programmatic represention of data storage systems
US9965327B2 (en) Dynamically scalable data collection and analysis for target device
US11397750B1 (en) Automated conflict resolution and synchronization of objects
US11093496B1 (en) Performance-based query plan caching
US20170371922A1 (en) Database Management for Mobile Devices
US11687520B1 (en) Systems and methods for application data servers
US20160321317A1 (en) Methods and systems for managing distributed concurrent data updates of business objects
WO2022188265A1 (zh) 数据管理方法、装置以及电子控制器
US7895247B2 (en) Tracking space usage in a database
CN114003569A (zh) 一种qcow2镜像文件增量更新方法及装置
US20230094293A1 (en) Method and apparatus for constructing recommendation model and neural network model, electronic device, and storage medium
CN116226202A (zh) 多维数据库查询方法、装置、计算机设备和存储介质
US10067678B1 (en) Probabilistic eviction of partial aggregation results from constrained results storage
CN114356945A (zh) 数据处理方法、装置、计算机设备和存储介质
Zhu et al. Lap: A latency‐aware parallelism framework for content‐based publish/subscribe systems
CN114365112A (zh) 标签数据的更新方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21929735

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 070224)