CN112988706A - Data management method and device and electronic controller - Google Patents

Data management method and device and electronic controller Download PDF

Info

Publication number
CN112988706A
CN112988706A CN202110257229.3A CN202110257229A CN112988706A CN 112988706 A CN112988706 A CN 112988706A CN 202110257229 A CN202110257229 A CN 202110257229A CN 112988706 A CN112988706 A CN 112988706A
Authority
CN
China
Prior art keywords
data
target file
changed
file
target
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110257229.3A
Other languages
Chinese (zh)
Inventor
屠东平
闫雪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
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 Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN202110257229.3A priority Critical patent/CN112988706A/en
Priority to PCT/CN2021/094763 priority patent/WO2022188265A1/en
Publication of CN112988706A publication Critical patent/CN112988706A/en
Pending legal-status Critical Current

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

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

The embodiment of the application provides a data management method, a data management device and an electronic controller, which relate to the technical field of vehicles, and the method comprises the following steps: determining whether data contained in a target file is changed, wherein the target file belongs to a first process; when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process; sending a data change instruction to the second process, the data change instruction including the key-value pair. According to the data management method provided by the embodiment of the application, when the target file of the first process is determined to be changed, the changed data is sent to the second process, so that the data management efficiency can be improved to a certain extent.

Description

Data management method and device and electronic controller
Technical Field
The application relates to the technical field of vehicles, in particular to a data management method and device and an electronic controller.
Background
With the continuous development and application of technologies such as cloud computing and internet of things, massive data are continuously generated in the fields of production and management, business activities, social life and the like. People are in the information age, some countries even promote data management to the national strategic level, and many enterprises also take data management as an important means for improving the self competitiveness. Therefore, the management of data is affecting the work and life of people, and thus the management of databases is very important.
Content of application
In view of the above problems, embodiments of the present application provide a data management method, an apparatus and an electronic controller to solve the above technical problems.
The embodiment of the application is realized by adopting the following technical scheme:
in a first aspect, some embodiments of the present application provide a data management method, including: determining whether data contained in a target file is changed, wherein the target file belongs to a first process; when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process; sending a data change instruction to the second process, the data change instruction including the key-value pair.
In a second aspect, some embodiments of the present application further provide a data management apparatus, which includes a determining module, an obtaining module, and a sending module. The determining module is used for determining whether data contained in a target file is changed, wherein the target file belongs to the first process. And the obtaining module is used for obtaining the key value pair corresponding to the changed data and determining a second process associated with the first process when the data contained in the target file is changed. A sending module, configured to send a data change instruction to the second process, where the data change instruction includes the key-value pair.
In a third aspect, some embodiments of the present application further provide an electronic controller comprising a processor and a memory, the memory storing computer program instructions that, when invoked by the processor, perform any of the data management methods described above.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, in which computer program instructions are stored, where the computer program codes can be called by a processor to execute the data management method of any one of the foregoing methods.
According to the data management method and device and the electronic controller, the data changed in the first process are sent to the second process, and therefore the data management efficiency can be improved. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent.
These and other aspects of the present application will be more readily apparent from the following description of the embodiments.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a flowchart of a data management method according to an embodiment of the present application.
Fig. 2 shows a flowchart of step S120 in a data management method according to an embodiment of the present application.
Fig. 3 is a flowchart illustrating a data management method according to another embodiment of the present application.
Fig. 4 is a flowchart illustrating other steps in a data management method according to another embodiment of the present application.
Fig. 5 is a flowchart illustrating other steps in a data management method according to another embodiment of the present application.
Fig. 6 shows a flowchart of a data management method according to another embodiment of the present application.
Fig. 7 is a schematic flowchart illustrating a process of reading a file in a data management method according to another embodiment of the present application.
Fig. 8 is a schematic flowchart illustrating a process of writing a file in a data management method according to another embodiment of the present application.
Fig. 9 is a flowchart illustrating a data management method according to another embodiment of the present application.
Fig. 10 is a schematic diagram illustrating a format of table configuration data in a data management method according to another embodiment of the present application.
Fig. 11 shows a block diagram of a data management apparatus according to an embodiment of the present application.
Fig. 12 shows a block diagram of modules of an electronic controller according to an embodiment of the present application.
Fig. 13 shows a schematic structural diagram of a vehicle according to an embodiment of the present application.
Fig. 14 illustrates a block diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the continuous development and application of technologies such as cloud computing and internet of things, massive data are continuously generated in the fields of production and management, business activities, social life and the like. People are in the information age, some countries even promote data management to the national strategic level, and many enterprises also take data management as an important means for improving the self competitiveness. It can be seen that the management of data is affecting the work and life of people, and especially the management of databases is very important. In addition, the existing embedded system usually needs to design a Middle-Layer (Middle-Layer) which mainly has a universal service request for serving the APP (APPlication) of the upper Layer. Such as log management, IPC (Inter-process Communication), and database storage. Compared with vehicle-mounted products, the reading and writing efficiency of the database and the use of resources are particularly important, so the requirements for reading and writing the database and the use of resources are small.
In addition, with continuous iteration of the application program version, the data structure of the table is also continuously changed, in this change, the use data of the user is likely to be damaged, and the reliability of the data cannot be guaranteed when the prior art manages the database. In the existing database model selection, Sqlite is general, but Sqlite can not meet the customization requirement, and after data corresponding to one application program is changed, the data can not be notified to other application programs.
In order to solve the above technical problem, the applicant has long studied and proposed a data management method, an apparatus and an electronic controller in the embodiments of the present application, in which the data management method can improve the efficiency of data management by sending data changed in a first process to a second process. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent.
As shown in fig. 1, fig. 1 schematically shows a flowchart of a data management method provided in an embodiment of the present application. The method may include the following steps S110 to S130.
Step S110: determining whether data contained in a target file is changed, wherein the target file belongs to a first process.
As one way, the embodiment of the present application may be applied to an electronic device, and the electronic device may be configured with a data management module, where the data management module is mainly used for managing a database in the electronic device. In the implementation of the present application, the database may be a mapping table based on Key-Value pairs (Key-Value pairs), which is mainly stored in a file, and in version iteration, a Key is newly added, modified, or deleted by a user, and a corresponding database file also needs to update the Key, and meanwhile, Value corresponding to other keys is not affected. The database file is referred to as the target file, and it is understood that the target file may include a plurality of different data, which may be vehicle-related control parameters, such as temperature, humidity, version number, vehicle speed, and trip parameter.
Alternatively, the target file may belong to a first process, which may be a running activity of a program in the computer on a certain data set, and is a basic unit for resource allocation and scheduling of the system. Moreover, the first process may also be a process corresponding to a preset application program, that is, the processes corresponding to different application programs may also be different. For example, a process corresponding to a first application may be referred to as a first process, and a process corresponding to a second application may be referred to as a second process.
In some embodiments, the electronic device may obtain a target file corresponding to a target application, and then determine whether data contained in the target file is changed, where the target file may be composed of a plurality of key value pairs, and when one or more of the key value pairs is changed, it may be determined that the data contained in the target file is changed. In this embodiment of the present application, determining whether data contained in a destination file changes may be determining whether a Key (Key) in the destination file changes, determining whether a Value (Value) in the destination file changes, or determining whether both the Key (Key) and the Value (Value) in the destination file change.
In other embodiments, the change in determining whether the data contained in the target file has changed may be a case where the target file has an increased Key value, where the Key value may be composed of a Key and a value, for example, if the original target file does not have a Key3, the user inputs a Key3 through the application program interface, and at this time, it may be determined that the target file has changed, and the changed data is "increased Key 3". In addition, the change may be the situation that the Key value of the target file is reduced, or if there is a Key4 in the original file, the user deletes the Key4 through the application program interface, at this time, it can be determined that the target file is changed, and the changed data is "the Key3 is deleted". The change can also be the situation that the target file has Key value replacement, such as the original target file has a Key5, and the user inputs the Key6 through the application program and replaces the Key5 with the Key 6. The determination of whether the data of the target file version changes may be in other situations, and the specific situation is not described in detail here.
To sum up, determining whether the data contained in the target file is changed may be determining whether the target file belonging to the first process is changed, and if it is determined that the data contained in the target file is changed, in this embodiment of the application, the key value pair corresponding to the changed data may be obtained, that is, step S120 is performed. If the target file is determined not to be changed, whether the data contained in the target file is changed or not is monitored again. The embodiment of the application can be monitored once every preset time length, or can be monitored once when data input by a user are determined to be received, and the like.
Step S120: and when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process.
In some embodiments, when determining that the data contained in the target file has changed, the electronic device may determine a key-value pair corresponding to the changed data, where the changed data may be the changed data in the target file. In addition, when it is determined that the data included in the target file is changed, the embodiment of the present application may also locate the position information of the changed data in the target file first, and the changed data may be located quickly through the position information. By obtaining the Key Value pair corresponding to the changed data, the embodiment of the present application can determine what the changed data is, for example, the Key changes, the Value changes, or both the Key and the Value change.
In the embodiment of the application, the changed data may be used as the target data, after the key value pair corresponding to the target data is obtained, the electronic device may determine a second process associated with the first process, and then send the data change instruction to the second process, that is, step S130 is performed.
In other embodiments, referring to fig. 2, step S120 may include steps S121 to S122.
Step S121: and acquiring historical data corresponding to each process, and determining whether the corresponding process is related to the first process according to each historical data.
In some embodiments, the historical data corresponding to the processes may include user-entered tag information, and the electronic device may obtain tag information corresponding to each process, where the tag information may be user-entered description information that is to be used to describe other processes related to the first process. For example, the description information corresponding to the process a is "the processes related to the process include the process B and the process C", and in this case, the process B and the process C may be referred to as the processes related to the process a.
In one way, the second process associated with the first process may be a higher frequency of data interaction with the first process, or may be an importance level between the first process and the second process, where the importance level may be an influence level of the second process on the first process, or an influence level of the first process on the second process. In addition, the importance degree between the first process and the second process can also be set by the user according to the requirement of the user. For example, the user a may set the second process as the process associated with the first process when the user a feels that the change of the data of the first process greatly affects the operation of the second process.
Alternatively, one or more second processes related to the first process in the electronic device may be provided, and when the second process related to the first process is one, the embodiment of the present application may directly send the data change instruction to the second process. When the number of the second processes related to the first process is multiple, the embodiment of the present application may also send the data change instruction to the second processes at the same time.
As another mode, when there are multiple second processes related to the first process, in the embodiment of the present application, the frequency of data interaction between each second process and the first process may also be obtained first, and then the multiple processes are sorted from high to low according to the frequency of the data interaction, so as to obtain a frequency sorting result. And then sending a data change instruction to the second process according to the sequence of the frequency sorting result.
Alternatively, when there are a plurality of second processes related to the first process, the embodiment of the present application may also monitor which process of the plurality of second processes is to be executed, and send the data change instruction to the second process when it is determined that the process is to be executed, where the sending operation is performed at a time after the time when it is determined that the target file in the first process is changed, and at a time when the second process is opened for the first time.
As an example, the first process and the second process may be processes corresponding to different application programs, and when it is determined that data of the first application process is changed, the electronic device may determine the second application process associated with the first application process and send the changed data to the second application process, and by sending the data, the second application process may know which data of the first application process is changed, a position of the changed data in the target file, and what the data is changed, and the like.
Step S122: and if so, taking the related process as the second process.
In some embodiments, when determining that the corresponding process is related to the first process according to the history data, the embodiment of the present application may use the related process as the second process. The second process may be multiple, that is, when it is determined that there are multiple processes related to the first process, the multiple processes may be all regarded as the second process.
In addition, when determining that the number of processes related to the first process is multiple, the embodiment of the present application may also determine whether a weakly related process exists in the multiple processes, where the weakly related process refers to a process that is related to the first process but has a smaller degree of association. When it is determined that a weakly related process exists in the plurality of processes, the embodiment of the application may use other processes except the weakly related process as the second process, so that unnecessary power consumption brought to the electronic device by data transmission may be reduced.
Step S130: sending a data change instruction to the second process, the data change instruction including the key-value pair.
In some embodiments, after determining the second process associated with the first process, embodiments 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 to indicate which data has been changed by the first process. Additionally, the data change instruction may include changing a key-value pair of the data, and sending the changed key-value pair of the data to the second process may prompt the second process. In other words, the second process may be prompted by the data change instruction "which data the first process has changed", and what the data has changed to.
In addition, the data change instruction may also include an address of the changed data in the target file, and the second process may quickly locate the changed data through the data change instruction, so that the second process may further monitor the changed data.
It should be noted that the change data in the embodiment of the present application may include a plurality of sub-change data, and the sub-change data may be data that is changed within a preset time period, where the preset time period may be a time when a time for last sending of the data change instruction has passed a preset time period. For example, the last time the data change instruction was sent is 14:00 at 03/month 05/2021, the preset time duration is 1 hour, that is, the data changed within 14:00 at 03/month 05/2021 to 15:00 at 03/month 05/2021 is counted in the embodiment of the present application, and the Key1 and the Key2 at this time may be collectively referred to as changed data by confirming that the Key of the changed data is classified as Key1 and Key 2.
In addition, the first process may be a process of interest to the second process, i.e., the second process may achieve the preset goal through data process analysis of the first process. For example, the second process determines the use habit of the user through the analysis of the use data of the first process, and then recommends different advertisements for the user according to the use habit.
According to the data management method provided by the embodiment of the application, the changed data in the first process is sent to the second process, so that the data management efficiency can be improved. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent.
As shown in fig. 3, another embodiment of the present application provides a data management method, which may include the following steps S210 to S250.
Step S210: and acquiring a target file, and storing the target file in a first partition of a magnetic disk.
As a manner, after the target file is obtained, the embodiment of the present application may store the target file in the first partition of the disk, then obtain the backup file according to the target file, and store the backup file in the second partition of the disk, that is, step S220 is performed.
Step S220: and acquiring a backup file according to the target file, and storing the backup file in a second partition of the disk.
In this application embodiment, the disk of the electronic device may be dual-partition, and in order to improve the reliability of data management, the database file corresponding to the electronic device may be designed as dual-partition, that is, the target file may be protected by a policy of dual-partition backup. In some embodiments, referring to fig. 4, 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: determining whether the target file is changed.
Step S222: and if the target file is changed, determining changed data, and updating the backup file based on the changed data.
As a way, in order to ensure data security, in the embodiment of the present application, partition storage is performed on a target file, and when a target file stored in a first partition is changed, a backup file stored in a second partition may 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 changed substantially simultaneously, so that it can be ensured that the data stored in the second partition is the latest when the data in the first partition is abnormal.
Referring to fig. 5, after acquiring the backup file according to the target file and storing the backup file in the second partition of the disk, steps S223 to S224 may be further included.
Step S223: determining whether the target file is formatted.
In other embodiments, when it is determined that the target file is abnormal, for example, when the target file is formatted, the data in the first partition is lost, and then the target file in the first partition may be restored by using the backup file in the second partition, that is, step 224 is entered.
Step S224: and if the target file is formatted, restoring the target file in the first partition according to the backup file in the second partition.
In order to more clearly understand the dual partition data protection strategy, the embodiment of the present application provides a flowchart as shown in fig. 6. The primary database file in fig. 6 is the target file, while the backup database file may be the backup file, and the target file and the backup file may be stored in a partitioned manner. The embodiment of the application can monitor whether a main database file exists or not during data management, when the main database file exists, the electronic equipment can further determine whether a standby database file exists or not, the size of the database file is acquired if the main database file and the standby database file both exist, whether the structure of the database is changed or not is judged, and if the structure of the database is changed, the main database file is traversed, the current configuration is synchronized, and the default configuration is updated. And if the standby database file is not changed, opening handles of the standby file and the active file at the same time, and finishing initialization.
In addition, as can be known from fig. 6, when it is determined that the backup database file does not exist, the embodiment of the present application may recover the backup database from the primary database file, that is, obtain the backup file according to the target file. When determining that the primary database file does not exist, the embodiment of the application can further judge whether the standby database file exists, if so, the primary database file is created, and the primary database is recovered from the standby database file. If the backup database does not exist, creating a primary database file and a backup database file based on the default data structure. Wherein the main database file does not exist generally because the data is formatted, or the data is in a read-only format, etc.
Step S230: determining whether data contained in a target file is changed, wherein the target file belongs to a first process.
Step S240: and when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process.
Step S250: sending a data change instruction to the second process, the data change instruction including the key-value pair.
In some embodiments, after the target file is acquired, the data in the target file may be read and written in the embodiment of the present application, and the read and write process may include a read-write lock or a mutual exclusion lock. In order to more clearly understand the read-write process, the embodiments of the present application provide flowcharts shown in fig. 7 and fig. 8, where fig. 7 is a read flow and fig. 8 is a write flow. It can be known from fig. 7 that in the process of reading a file, the embodiment of the present application may first determine whether the type and the length of the target file satisfy the preset length, that is, check the type and the length of the target file, and when the check condition is satisfied, may perform read locking and locking by using a file lock, and lock a thread lock. And then searching the file offset corresponding to the Key, adjusting the file handle to point to the offset and copying data, unlocking the file lock-read lock, and finally finishing reading.
In addition, as can be seen from fig. 8, in the process of writing a file, the embodiment of the present application may first determine whether the type and the length of the target file satisfy the preset length, that is, check the type and the length of the target file, and when the check condition is satisfied, may use the file lock to perform write locking and locking, and use the thread lock to perform locking. And then searching a file offset corresponding to the Key, adjusting a file handle to point to the offset and copying data, unlocking a file lock-write lock, unlocking a thread lock, initiating an IPC (IPC notification) APP when determining that the content of the Database (DB) is changed, and finally finishing writing. Therefore, when the content of the database is determined to be changed, the changed data can be sent to other processes by means of communication among the processes.
According to the data management method provided by the embodiment of the application, the changed data in the first process is sent to the second process, so that the data management efficiency can be improved. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent. In addition, in order to improve the reliability of data management, the embodiment of the application performs partition storage on the target file, and can ensure the security of the database file to a certain extent.
As shown in fig. 9, another embodiment of the present application provides a data management method, which may include the following steps S310 to S360.
Step S310: receiving table configuration data, wherein the table configuration data comprises a data name, a data type, a maximum length of stored data and a default value.
In one way, the embodiment of the present application may receive table configuration data input by a user, where the table configuration data is used to construct a structure of a database, that is, a structured text may be generated by the embodiment of the present application. The table configuration data may include a data name, a data type, a maximum length of stored data, and a default value, and the format of the table configuration data is as shown in fig. 10. As can be seen from fig. 10, the table configuration data is composed of Key Name, Type, Max Size, and Default Value, where the Key Name is a data Name, which may be a Key of the corresponding data, and the Key Name has uniqueness; the Type is a data Type which is a data Type stored in the current item; max Size is the maximum length of the specified stored data, which is valid only for the data type String or Binary, and fixed for known data types. For example, u32 is fixed to be 4 bytes, and Max Size configured by the user does not take effect; the Default Value is a Default Value, and when neither the target file nor the backup file exists, the active/standby file is recreated based on the Default Value in the embodiment of the present application.
In this embodiment of the application, the default value may be set according to an empirical value, and the default values corresponding to different Key names are different, for example, the Key Name is the address of the NTP1 server, and the default value corresponding to the Key Name is NTP1. aliyun.com; also, for example, Key Name is the address of NTP2 server, and its corresponding default value is NTP2.aliyun.
Step S320: and generating a target table according to the table configuration data, taking the target table as a target file, and storing the target file in a first partition of a disk.
As a mode, generating a target table according to the table configuration data, taking the target table as a target file, and storing the target file in a first partition of a disk may include: it is determined whether a data creation instruction transmitted by an application program interface is received. And if a data creating instruction sent by the application program interface is received, updating the target table by using the data creating instruction to obtain a target file.
In the embodiment of the application, a user can update a data table through different application program interfaces to obtain a target file, the target file can be queried in a KEY-VALUE mode and in a type correlation mode, the type correlation refers to the type correlation of data, namely the size of a space occupied by a data type in a database file is correlated, for example, a uint8_ t fixedly occupies 1 byte, and a string type is variable in length. To better understand the application program interface, the present application presents a list of application program interfaces as shown in table 1 below.
TABLE 1
Figure BDA0002967988950000141
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, where a description part mainly performs data on types of the interfaces, and it can be known from table 1 that types of the application program interfaces in this embodiment of the present application may be a char type, an unorganized char type, a short type, an int type, a string type, binary data, and the like, and these interfaces make a database operation interface more complete, and the database is based on file design, is simple in operation, and can be easily migrated to other items.
Step S330: and acquiring a backup file according to the target file, and storing the backup file in a second partition of the disk.
Step S340: determining whether data contained in a target file is changed, wherein the target file belongs to a first process.
Step S350: and when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process.
Step S360: sending a data change instruction to the second process, the data change instruction including the key-value pair.
According to the data management method provided by the embodiment of the application, the changed data in the first process is sent to the second process, so that the data management efficiency can be improved. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent. In addition, the database can be managed simply and effectively by using a complete database interface, the customization requirements of the database can be realized by configuring the table, and the use experience of a user can be improved.
As shown in fig. 11, an embodiment of the present application further provides a data management apparatus 400, where the data management apparatus 400 includes: a determination module 410, an acquisition module 420, and a sending module 430.
A determining module 410, configured to determine whether a change occurs in data included in a target file, where the target file belongs to a first process.
An obtaining module 420, configured to, when data included in the target file is changed, obtain a key-value pair corresponding to the changed data, and determine a second process associated with the first process.
Further, the obtaining module 420 is further configured to obtain historical data corresponding to each process, and determine whether the corresponding process is related to the first process according to each historical data; and if so, taking the related process as the second process.
Further, before determining whether data included in the target file is changed, 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; and acquiring a backup file according to the target file, and storing the backup file in a second partition of the disk.
Further, after obtaining a backup file according to the target file and storing the backup file in the second partition of the disk, the data management apparatus 400 is further configured to determine whether the target file is changed; and if the target file is changed, determining changed data, and updating the backup file based on the changed data.
Further, after obtaining a backup file according to the target file and storing the backup file in the second partition of the disk, the data management apparatus 400 is further configured to determine whether the target file is formatted; and if the target file is formatted, restoring the target file in the first partition according to the backup file in the second partition.
Further, the data management apparatus 400 is further configured to receive table configuration data, where the table configuration data includes a data name, a data type, a maximum length of stored data, and a default value; and generating a target table according to the table configuration data, and taking the target table as a target file.
Further, the data management apparatus 400 is further configured to determine whether a data creation instruction sent by the application program interface is received; and if a data creating instruction sent by the application program interface is received, updating the target table by using the data creating instruction to obtain a target file.
The data management device provided by the embodiment of the application can improve the efficiency of data management by sending the changed data in the first process to the second process. Specifically, it is first determined whether data contained in a target file changes, where the target file belongs to a first process, and when it is determined that the data contained in the target file changes, a key-value pair corresponding to the changed data is obtained, and then a second process associated with the first process may be determined, and finally a data change instruction is sent to the second process, where the data change instruction may include the key-value pair. When the target file in the first process is determined to be changed, the data change instruction can be sent to the second process, so that the data can be conveniently managed by a user, and the efficiency of data management can be improved to a certain extent.
As shown in fig. 12, an embodiment of the present application further provides an electronic controller 500, where 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 invoked by the processor 510 to execute the data management method described above
Processor 510 may include one or more processing cores. The processor 510 interfaces with various components throughout the electronic controller using various interfaces and lines to perform various functions of the electronic controller and to process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 520 and invoking data stored in the memory 520. Alternatively, the processor 510 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 510 may integrate one or a combination of a Central Processing Unit (CPU) 510, a Graphics Processing Unit (GPU) 510, a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 510, but may be implemented by a communication chip.
The Memory 520 may include a Random Access Memory (RAM) 520 and may also include a Read-Only Memory (Read-Only Memory) 520. The memory 520 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, and the like. The stored data area may also store data created by the electronic controller in use, and the like.
As shown in fig. 13, an embodiment of the present application further provides a vehicle 600, where the vehicle 600 includes a vehicle body 610 and an electronic controller 620, where the electronic controller 620 is disposed in the vehicle body 610, and the electronic controller 620 is configured to manage data.
As shown in fig. 14, the present embodiment further provides a computer-readable storage medium 700, in which computer program instructions 710 are stored, and the computer program instructions 710 can be called by a processor to execute the method described in the above embodiment.
The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium includes a non-volatile computer-readable storage medium. The computer-readable storage medium 700 has storage space for program code for performing any of the method steps described above. The program code can be read from or written to one or more computer program products. The program code may be compressed, for example, in a suitable form.
Although the present application has been described with reference to the preferred embodiments, it is to be understood that the present application is not limited to the disclosed embodiments, but rather, the present application is intended to cover various modifications, equivalents and alternatives falling within the spirit and scope of the present application.

Claims (10)

1.A method for managing data, the method comprising:
determining whether data contained in a target file is changed, wherein the target file belongs to a first process;
when the data contained in the target file is changed, obtaining a key value pair corresponding to the changed data, and determining a second process associated with the first process;
sending a data change instruction to the second process, the data change instruction including the key-value pair.
2. The method of claim 1, applied to an electronic controller comprising a plurality of processes, said determining a second process associated with said first process comprising:
acquiring historical data corresponding to each process, and determining whether the corresponding process is related to the first process according to each historical data;
and if so, taking the related process as the second process.
3. The method of claim 1, wherein before determining whether the data contained in the target file has changed, the method comprises:
acquiring a target file, and storing the target file in a first partition of a disk;
and acquiring a backup file according to the target file, and storing the backup file in a second partition of the disk.
4. The method of claim 3, wherein after retrieving the backup file from the target file and storing the backup file in the second partition of the disk, the method comprises:
determining whether the target file is changed;
and if the target file is changed, determining changed data, and updating the backup file based on the changed data.
5. The method according to any one of claims 3 to 4, wherein after obtaining the backup file according to the target file and storing the backup file in the second partition of the disk, the method further comprises:
determining whether the target file is formatted;
and if the target file is formatted, restoring the target file in the first partition according to the backup file in the second partition.
6. The method according to any one of claims 3 to 4, wherein the obtaining the target file comprises:
receiving table configuration data, wherein the table configuration data comprises a data name, a data type, a maximum length of stored data and a default value;
and generating a target table according to the table configuration data, and taking the target table as a target file.
7. The method of claim 6, wherein generating a target form according to the form configuration data and using the target form as a target file comprises:
determining whether a data creation instruction sent by an application program interface is received;
and if a data creating instruction sent by the application program interface is received, updating the target table by using the data creating instruction to obtain a target file.
8. A data management apparatus, characterized in that the apparatus comprises:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining whether data contained in a target file is changed or not, and the target file belongs to a first process;
the acquisition module is used for acquiring a key value pair corresponding to changed data and determining a second process associated with the first process when the data contained in the target file is changed;
a sending module, configured to send a data change instruction to the second process, where the data change instruction includes the key-value pair.
9. An electronic controller, comprising:
one or more processors;
a memory;
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores program code that can be invoked by a processor to perform the method according to any one of claims 1 to 7.
CN202110257229.3A 2021-03-09 2021-03-09 Data management method and device and electronic controller Pending CN112988706A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110257229.3A CN112988706A (en) 2021-03-09 2021-03-09 Data management method and device and electronic controller
PCT/CN2021/094763 WO2022188265A1 (en) 2021-03-09 2021-05-20 Data management method and device and electronic controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110257229.3A CN112988706A (en) 2021-03-09 2021-03-09 Data management method and device and electronic controller

Publications (1)

Publication Number Publication Date
CN112988706A true CN112988706A (en) 2021-06-18

Family

ID=76336337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110257229.3A Pending CN112988706A (en) 2021-03-09 2021-03-09 Data management method and device and electronic controller

Country Status (2)

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

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159156A (en) * 2019-12-31 2020-05-15 杭州迪普科技股份有限公司 Backup method and device for SQLite database

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104778225B (en) * 2015-03-27 2017-12-12 浙江大学 A kind of method of synchrodata in more storage systems of unstructured data
CN109918215B (en) * 2019-03-05 2023-06-30 上海联影医疗科技股份有限公司 Process communication method, system, terminal and storage medium
CN110569210B (en) * 2019-06-24 2022-12-06 陕西天行健车联网信息技术有限公司 Master-slave structure of vehicle-mounted terminal and method thereof
CN111580954B (en) * 2020-04-01 2021-09-14 中国科学院信息工程研究所 Extensible distributed data acquisition method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111159156A (en) * 2019-12-31 2020-05-15 杭州迪普科技股份有限公司 Backup method and device for SQLite database

Also Published As

Publication number Publication date
WO2022188265A1 (en) 2022-09-15

Similar Documents

Publication Publication Date Title
US9965364B2 (en) Fault tolerant listener registration in the presence of node crashes in a data grid
WO2019217481A1 (en) Conflict resolution for multi-master distributed databases
WO2019121656A1 (en) Blockchain lifecycle management
WO2022143242A1 (en) Blockchain-based transaction distribution executing method and apparatus, server, and storage medium
CN109766349B (en) Task duplicate prevention method, device, computer equipment and storage medium
CN109873904A (en) User of message status report process method, device and the storage medium of message push
US10747749B2 (en) Methods and systems for managing distributed concurrent data updates of business objects
CN112084161A (en) Database-based data processing method and device and readable storage medium
US20190362010A1 (en) Epsilon-closure for frequent pattern analysis
CN115023697A (en) Data query method and device and server
US11397750B1 (en) Automated conflict resolution and synchronization of objects
CN112988706A (en) Data management method and device and electronic controller
US20200257684A1 (en) Higher-order data sketching for ad-hoc query estimation
CN112925792B (en) Data storage control method, device, computing equipment and medium
US11269784B1 (en) System and methods for efficient caching in a distributed environment
CN111752961A (en) Data processing method and device
CN113760521A (en) Virtual resource allocation method and device
CN115086047B (en) Interface authentication method and device, electronic equipment and storage medium
CN109697224B (en) Bill message processing method, device and storage medium
US20090259795A1 (en) Policy framework to treat data
US7987210B1 (en) System for lightweight objects
US8656410B1 (en) Conversion of lightweight object to a heavyweight object
US8156297B2 (en) Smart device recordation
CN113703993A (en) Service message processing method, device and equipment
CN113031982A (en) Application program operation prediction method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination