CN113868231A - Data structure updating method and device - Google Patents

Data structure updating method and device Download PDF

Info

Publication number
CN113868231A
CN113868231A CN202111464681.3A CN202111464681A CN113868231A CN 113868231 A CN113868231 A CN 113868231A CN 202111464681 A CN202111464681 A CN 202111464681A CN 113868231 A CN113868231 A CN 113868231A
Authority
CN
China
Prior art keywords
data
data structure
information
change
changed
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.)
Granted
Application number
CN202111464681.3A
Other languages
Chinese (zh)
Other versions
CN113868231B (en
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.)
Nanchang Longqi Information Technology Co ltd
Original Assignee
Nanchang Longqi Information 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 Nanchang Longqi Information Technology Co ltd filed Critical Nanchang Longqi Information Technology Co ltd
Priority to CN202111464681.3A priority Critical patent/CN113868231B/en
Publication of CN113868231A publication Critical patent/CN113868231A/en
Application granted granted Critical
Publication of CN113868231B publication Critical patent/CN113868231B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • 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
    • G06F16/2365Ensuring data consistency and integrity

Abstract

The embodiment of the application provides a method and a device for updating a data structure, wherein the method comprises the following steps: receiving an update instruction sent by terminal equipment, wherein the update instruction is used for adjusting version control data of a data structure in a target application; determining an information item to be changed in header information of the data structure according to the change type of the data structure indicated by the adjusted version control data; the data structure in the target application is updated by changing the information item to be changed. By the method, the version control data is adopted to indicate the change type of the data structure, so that the corresponding information item is updated based on different change types, and the compatibility of the data structures of different versions is ensured.

Description

Data structure updating method and device
Technical Field
The invention relates to the technical field of Internet of things, in particular to a method and a device for updating a data structure.
Background
Internet of Things (IoT) embedded software products generally require the design of data structures for configuration data, status data, etc. of the system. Different IoT embedded software products can be designed according to the targeted data structure of software functions and software modules.
In the related art, the data structure of the IoT embedded software product has little inheritance. Thus, when the data structure changes as a result of changes in product requirements, incompatibility between different versions of the IoT embedded software product may result.
Disclosure of Invention
The embodiment of the application provides a method and a device for updating a data structure, so as to solve the technical problem that the compatibility of data structures of different versions cannot be guaranteed in the prior art.
In a first aspect, an embodiment of the present application provides a method for updating a data structure, where the method includes:
receiving an update instruction sent by a terminal device, wherein the update instruction is used for adjusting version control data of a data structure in a target application;
determining an information item to be changed in header information of the data structure according to the change type of the data structure indicated by the adjusted version control data;
updating the data structure in the target application by changing the information item to be changed;
and setting or acquiring data structures in different data modules according to the indexes of the data structures.
In an optional embodiment, the change type of the data structure includes deleting member data in the data structure, inserting new member data in the member data of the data structure, and inserting the new member data at the tail of the member data of the data structure.
In an alternative embodiment, the information item to be changed includes version information and data size information.
In an optional embodiment, the determining an information item to be changed in the header information of the data structure includes:
and if the change type is deleting the member data in the data structure or inserting newly added member data into the member data in the data structure, determining the information item to be changed as the version information.
In an optional embodiment, the updating the data structure in the target application by changing the information item to be changed includes:
replacing the version information before the change with the version information after the change in the header information of the data structure;
and replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
In an optional embodiment, the determining an information item to be changed in the header information of the data structure includes:
and if the change type is that the newly added member data is inserted into the tail part of the member data of the data structure, determining the information item to be changed as the data size information.
In an optional embodiment, the updating the data structure in the target application by changing the information item to be changed includes:
replacing the default value of the member data in the updated data structure according to the data size information before the change;
determining the data increment of the data structure according to the data size information before change and the data size information after change;
and updating the newly added member data by using a default value according to the data increment.
In an optional implementation manner, the header information of the data structure further includes check information, and the check information is used to perform a cyclic redundancy check on the integrity of the data structure.
In an alternative embodiment, the data modules are divided according to the type of data.
In a second aspect, an embodiment of the present application provides an apparatus for updating a data structure, where the apparatus includes:
the system comprises a receiving module, a sending module and a processing module, wherein the receiving module is used for receiving an updating instruction sent by terminal equipment, and the updating instruction is used for adjusting version control data of a data structure in a target application;
the determining module is used for determining an information item to be changed in the header information of the data structure according to the change type of the data structure indicated by the adjusted version control data;
the updating module is used for updating the data structure in the target application by changing the information item to be changed;
and the calling module is used for setting or acquiring the data structures in different data modules according to the indexes of the data structures.
In an optional embodiment, the change type of the data structure includes deleting member data in the data structure, inserting new member data in the member data of the data structure, and inserting the new member data at the tail of the member data of the data structure.
In an alternative embodiment, the information item to be changed includes version information and data size information.
In an optional implementation manner, the determining module is specifically configured to determine that the information item to be changed is the version information if the change type is to delete member data in the data structure or insert newly added member data into member data in the data structure.
In an optional implementation manner, the update module is specifically configured to replace, in the header information of the data structure, the version information before the change with the version information after the change; and replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
In an optional implementation manner, the determining module is specifically configured to determine that the information item to be changed is the data size information if the change type is that the newly added member data is inserted at the tail of the member data in the data structure.
In an optional implementation manner, the update module is specifically configured to replace a default value of the member data in the updated data structure according to the size information of the data before the change; determining the data increment of the data structure according to the data size information before change and the data size information after change; and updating the newly added member data by using a default value according to the data increment.
In an optional implementation manner, the header information of the data structure further includes check information, and the check information is used to perform a cyclic redundancy check on the integrity of the data structure.
In an alternative embodiment, the data modules are divided according to the type of data.
In a third aspect, the present application further provides an electronic device, including: a processor and a memory;
wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to the first aspect.
In a fourth aspect, the present application also provides a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method according to the first aspect.
According to the method and the device for updating the data structure, the updating indication sent by the terminal equipment is received, and the updating indication is used for adjusting the version control data of the data structure in the target application. Then, according to the change type of the data structure indicated by the adjusted version control data, an information item to be changed in the header information of the data structure is determined. Finally, the data structure in the target application is updated by changing the information item to be changed. By the method, the version control data is adopted to indicate the change type of the data structure, so that the corresponding information item is updated based on different change types, and the compatibility of the data structures of different versions is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings needed to be used in the description of the embodiments or the prior art, and obviously, the drawings in the following description are some embodiments of the present invention, and those skilled in the art can obtain other drawings according to the drawings without inventive labor.
Fig. 1 is a schematic view of an application scenario of a data structure updating method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for updating a data structure according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a data structure provided by an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a data structure according to an embodiment of the present application;
fig. 5 is a data distribution diagram of a system configuration according to an embodiment of the present application;
FIG. 6 is a data distribution diagram of another system configuration provided by embodiments of the present application;
fig. 7 is a schematic diagram illustrating a modification of a data structure according to an embodiment of the present application;
FIG. 8 is a diagram illustrating an alternative data structure provided in an embodiment of the present application;
FIG. 9 is a flowchart illustrating another method for updating a data structure according to an embodiment of the present application;
fig. 10 is a flowchart illustrating a further method for updating a data structure according to an embodiment of the present application;
FIG. 11 is a diagram illustrating an example of a configuration of a conventional data structure;
FIG. 12 is a diagram illustrating an exemplary configuration of a data structure according to an embodiment of the present disclosure;
FIG. 13 is a schematic structural diagram of an apparatus for updating a data structure according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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, and it is obvious that the described embodiments are some embodiments of the present application, but 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.
Internet of Things (IoT) embedded software products generally require the design of data structures for configuration data, status data, etc. of the system. Different IoT embedded software products can be designed according to the targeted data structure of software functions and software modules.
In the related art, the data structure of the IoT embedded software product has little inheritance. Thus, when the data structure changes as a result of changes in product requirements, incompatibility between different versions of the IoT embedded software product may result.
In order to solve the foregoing technical problem, embodiments of the present application provide a method and an apparatus for updating a data structure, where version control data is used to indicate a change type of the data structure, so that corresponding information items are updated based on different change types, and compatibility of data structures of different versions is ensured.
First, an application scenario according to an embodiment of the present application will be described below.
Fig. 1 is a schematic view of an application scenario of a data structure updating method according to an embodiment of the present application. As shown in fig. 1, when an update of the data structure is required, the terminal device 101 may send an update request to the server 102, and then the server 102 may adjust the control data based on the update request and determine an information item to be changed in the header information of the data structure according to the change type of the data structure indicated by the version control data. Finally, the server 102 updates the data structure by changing the information items to be changed.
The terminal device 101 may be a tablet computer (pad), a computer with a wireless transceiving function, a Virtual Reality (VR) terminal device, an Augmented Reality (AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in unmanned driving (self driving), a wireless terminal in remote surgery (remote medical supply), a wireless terminal in smart grid (smart grid), a wireless terminal in smart home (smart home), and the like. In the embodiment of the present application, the apparatus for implementing the function of the terminal may be the terminal, or may be an apparatus capable of supporting the terminal to implement the function, such as a chip system, and the apparatus may be installed in the terminal. In the embodiment of the present application, the chip system may be composed of a chip, and may also include a chip and other discrete devices.
Server 102 may be, but is not limited to, a single web server, a server farm of multiple web servers, or a cloud of numerous computers or web servers based on cloud computing. Cloud computing is a kind of distributed computing, and is a super virtual computer composed of a group of loosely coupled computers.
It should be understood that the application scenario of the technical solution of the present application may be the scenario in fig. 1, but is not limited thereto, and may also be applied to other scenarios requiring text classification.
It can be understood that the above method for updating a data structure can be implemented by the data structure updating apparatus provided in the embodiments of the present application, and the data structure updating apparatus may be part or all of a certain device, for example, a server or a chip of the server.
The following takes a server integrated or installed with relevant execution codes as an example, and details the technical solution of the embodiment of the present application with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a schematic flowchart of a data structure updating method according to an embodiment of the present application, where the embodiment relates to a process of how a server updates a data structure. As shown in fig. 2, the method includes:
s201, receiving an update instruction sent by the terminal equipment, wherein the update instruction is used for adjusting version control data of a data structure in the target application.
In this application, when the data structure needs to be updated, the terminal device may send an update instruction to the server to instruct the server to adjust the version control data of the data structure in the target application.
The target application may be any application, such as IoT embedded software.
It should be understood that the data structure in the embodiment of the present application is not limited, and may be data in any preset structure. Fig. 3 is a schematic diagram of a data structure provided in an embodiment of the present application, and as shown in fig. 3, the data structure provided in the present application is composed of header information and member data. Various information items of the data structure may be included in the header information, and for example, version information (kv _ version), data size information (kv _ size), and check information (kv _ crc 16), etc. may be included. The version information is used for indicating the version of the data structure, the data size information is used for indicating the size of the member data, and the check information is used for performing cyclic redundancy check on the integrity of the data structure, so that the integrity of the data is ensured.
In some embodiments, the header information may further include a function pointer information item (change _ notify _ t), and when the data structure is changed through an Application Programming Interface (API) Interface, the function is automatically called through a modification notification function pointing to the corresponding data, so as to call the relevant registration function, thereby implementing the subscription mechanism. The function pointer information item may be set invalid when the data structure does not require a subscription mechanism function.
In some embodiments, the server may set or retrieve data structures in different data modules according to an index of data structures (KEY). Wherein, the data module is divided according to the type of the data.
It should be understood that the present application is not limited to the type of data structure, and in some embodiments, the data structure may be a digital password. The embodiment of the present application is not limited to how to determine the index of the data structure, and in some embodiments, a unique index may be assigned to each data structure through enumeration definition. The digital password may include a password valid flag and digital password content, and the digital password may be configured into a data structure of a configuration state so as to be matched when the data structure is set or acquired.
Fig. 4 is a schematic diagram illustrating an example of a data structure call provided in an embodiment of the present application. As shown in fig. 4, after the configuration data and the status data of the system are subjected to frame design to form a data structure, different KEYs may be set for different data structures, so that the data structure of the corresponding module may be obtained or set based on the KEY corresponding to the data structure. In the process of calling the data structure, the API interface can be kept unchanged and is distinguished only by the corresponding KEY, so that the code interface is clearer.
In some embodiments, different data structures may be added to different data modules according to the type of data, form a part of the data structures in the data modules, and the data structures are identified by corresponding KEYs, and whether each data structure is defined in the data module or not is determined by corresponding macro, so that the corresponding data structure can be flexibly selected and configured by a configuration file. The type of data may be divided according to configuration, status, user, and the like.
It should be understood that the embodiment of the present application is not limited to the version control data, and in some embodiments, the version control data may also be in the form of a data structure, and the storage space layout of the system configuration may be managed through the version control data, so that the indicated change type of the data structure is used to increase the flexibility of the project.
Illustratively, the number of data structures (item _ count) and the size of the data structures (item _ size) may be included in the version control data. In a non-volatile device, item _ size is used to indicate the space occupied by each data structure, and when item _ size is 0, it indicates that the respective data structures are stored contiguously (expansion is not supported).
Note that the data structure is stored in a different manner in the nonvolatile device and the random access memory device. Fig. 5 is a data distribution diagram of a system configuration provided in an embodiment of the present application, and fig. 6 is a data distribution diagram of another system configuration provided in the embodiment of the present application. As shown in fig. 5, the embedded product, due to limited hardware resources, occupies a Memory space by the actual size of each data structure when the system is configured in a Random Access Memory (RAM). As shown in fig. 6, when the system is configured in a non-volatile (NV) device, it is stored in a fixed size to support compatibility of data versions.
S202, determining an information item to be changed in the header information of the data structure according to the change type of the data structure indicated by the adjusted version control data.
In this step, after the server obtains the version control data of the adjusted data structure, the information item to be changed in the header information of the data structure may be determined according to the change type of the data structure indicated by the adjusted version control data.
The change type of the data structure may include deleting member data in the data structure, inserting newly added member data in the member data of the data structure, and inserting newly added member data at the tail of the member data of the data structure. Accordingly, the information item to be changed includes version information and data size information.
In some embodiments, if the change type is to delete member data in the data structure or insert newly added member data in the member data of the data structure, the server may determine that the information item to be changed is version information.
In other embodiments, if the change type is to insert newly added member data at the end of the member data of the data structure, the server may determine that the information item to be changed is data size information.
S203, updating the data structure in the target application by changing the information item to be changed.
In this step, after determining the information item to be changed in the header information of the data structure, the server may update the data structure in the target application by changing the information item to be changed.
It should be understood that, in the embodiment of the present application, no limitation is imposed on how to update the data structure, and the server may adopt different data structure changing manners based on different information items to be changed.
In some embodiments, if the information item to be changed is version information, the server may replace the version information before the change with the version information after the change in the header information of the data structure. And then, replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
Exemplarily, fig. 7 is a schematic diagram of a modification of a data structure provided in an embodiment of the present application. As shown in fig. 7, when the newly added member data "mobile phone number" is inserted into the member data in the data structure, the old version of the data cannot be compatible, so that the member data "height" and "weight" therein cannot guarantee data security. At this time, the entire data structure may be changed by changing the version information from "kv _ version = 1" to "kv _ version = 2" to ensure that the user information in the new version is restored to the default value.
It should be noted that, when the version information is changed, the data size information may also be modified correspondingly, which is not limited in the embodiment of the present application.
In other embodiments, if the information item to be changed is data size information, the server may replace the default value of the member data in the updated data structure according to the data size information before the change. Then, the server determines the data increment of the data structure according to the data size information before the change and the data size information after the change. And finally, the server updates the newly added member data by using a default value according to the data increment.
And replacing the data size information before change with the changed data size information in the header information of the data structure, and then adding newly added member data at the tail end of the data member of the data structure by the server according to the changed data size information.
For example, fig. 8 is a schematic diagram of a modification of another data structure provided in an embodiment of the present application. As shown in fig. 8, when the new member data "mobile phone number" is inserted into the member data tail of the data structure, the "year of birth", "month", "day", "height", and "weight" in the user information indicated by the original member data are still compatible, and at this time, the data size information may be restored to the default data by modifying "kv _ size = 8" to "kv _ size = 20", so as to ensure that the previous and next versions of data are compatible.
In the application, by the above method for updating the data structure, the data structures of different items can be inherited and reusable, and some common data structures can be reused in different items. Secondly, in the process of project development, the data structure can be flexibly changed, and the problem of software version compatibility can not be caused. And the maintainability is improved, so that each data structure is maintained independently and is clear in structure. Finally, the expandability is enhanced, and the functions of adding, deleting and modifying the data structure are supported.
The method for updating a data structure provided in the embodiment of the present application, first receives an update instruction sent by a terminal device, where the update instruction is used to adjust version control data of the data structure in a target application. Then, according to the change type of the data structure indicated by the adjusted version control data, an information item to be changed in the header information of the data structure is determined. Finally, the data structure in the target application is updated by changing the information item to be changed. By the mode, the version control data is adopted to indicate the change type of the data structure, so that the corresponding information item is updated based on different change types, the compatibility of the data structures of different versions is ensured, and the occupation minimization of the data in the RAM can also be ensured.
On the basis of the above embodiment, the following describes the manner of updating the data structure based on the version information. Fig. 9 is a schematic flowchart of another data structure updating method according to an embodiment of the present application, and as shown in fig. 9, the data structure updating method includes:
s301, receiving an update instruction sent by the terminal device, wherein the update instruction is used for adjusting version control data of a data structure in the target application.
S302, if the change type indicated by the adjusted version control data is to delete the member data in the data structure or insert newly added member data into the member data in the data structure, determining that the information item to be changed is version information.
S303, the version information before the change is replaced with the version information after the change in the header information of the data structure.
S304, replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
The technical terms, technical effects, technical features and alternative embodiments of S301 to S304 can be understood by referring to S201 to S203 shown in fig. 2, and repeated descriptions thereof will not be repeated here.
In addition to the above embodiments, the following describes a data structure update method based on the data size information. Fig. 10 is a flowchart illustrating a further data structure updating method according to an embodiment of the present application, where as shown in fig. 10, the data structure updating method includes:
s401, receiving an update instruction sent by the terminal equipment, wherein the update instruction is used for adjusting version control data of a data structure in the target application.
S402, if the change type indicated by the adjusted version control data is that newly added member data is inserted into the tail part of the member data of the data structure, determining that the information item to be changed is data size information.
And S403, replacing the default value of the member data in the updated data structure according to the data size information before the change.
S404, determining the data increment of the data structure according to the data size information before the change and the data size information after the change.
And S405, updating the newly added member data by using a default value according to the data increment.
The technical terms, technical effects, technical features, and alternative embodiments of S401 to S405 can be understood with reference to S201 to S203 shown in fig. 2, and repeated descriptions thereof will not be repeated here.
On the basis of the above-described embodiment, the data structure is further explained below.
In some embodiments, partial data configurations may have duplicity, which may result in an excessively large data structure for the system configuration if the duplicated data configurations are all member data of the data structure.
For example, fig. 11 is a schematic diagram of a configuration manner of an existing data structure provided in an embodiment of the present application. As shown in fig. 11, when account information is configured into a data structure as duplicate information, if there are 100 pieces of account information on the smart watch, account information 0 to account information 99 need to be sequentially added to the data structure as member data. For devices with limited memory resources, such as embedded systems, the size of the data structure needs to be reduced. Because only one effective repeated information exists currently, the effective repeated information can be indicated through the update _ item _ t field in the header information of the data structure, so that the minimization of the occupation of the system configuration data memory is ensured while the support of the data structure is realized.
Fig. 12 is a schematic diagram illustrating an exemplary configuration of a data structure according to an embodiment of the present application. As shown in fig. 12, the data corresponding to the current KEYX represents the first data in the current data structure X, and when the user needs to access the 99 th data structure X, the index value 99 may be introduced through the unified API to obtain the data.
The method for updating a data structure provided in the embodiment of the present application, first receives an update instruction sent by a terminal device, where the update instruction is used to adjust version control data of the data structure in a target application. Then, according to the change type of the data structure indicated by the adjusted version control data, an information item to be changed in the header information of the data structure is determined. Finally, the data structure in the target application is updated by changing the information item to be changed. By the mode, the version control data is adopted to indicate the change type of the data structure, so that the corresponding information item is updated based on different change types, the compatibility of the data structures of different versions is ensured, and the occupation minimization of the data in the RAM can also be ensured.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Fig. 13 is a schematic structural diagram of an apparatus for updating a data structure according to an embodiment of the present application. The data structure updating device may be implemented by software, hardware or a combination of the two, for example, a server in the above embodiment, to execute the data structure updating method in the above embodiment. As shown in fig. 13, the data structure updating apparatus 500 includes:
a receiving module 501, configured to receive an update instruction sent by a terminal device, where the update instruction is used to adjust version control data of a data structure in a target application;
a determining module 502, configured to determine, according to a change type of the data structure indicated by the adjusted version control data, an information item to be changed in header information of the data structure;
an updating module 503, configured to update the data structure in the target application by changing the information item to be changed.
In an alternative embodiment, the change type of the data structure includes deleting member data in the data structure, inserting new member data in the member data of the data structure, and inserting new member data at the tail of the member data of the data structure.
In an alternative embodiment, the information item to be changed includes version information and data size information.
In an alternative embodiment, the determining module 502 is specifically configured to determine that the information item to be changed is version information if the change type is to delete member data in the data structure or insert newly added member data into member data in the data structure.
In an alternative embodiment, the updating module 503 is specifically configured to replace the version information before the change with the version information after the change in the header information of the data structure; and replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
In an alternative embodiment, the determining module 502 is specifically configured to determine that the information item to be changed is data size information if the change type is that newly added member data is inserted at the tail of the member data of the data structure.
In an optional implementation manner, the updating module 503 is specifically configured to replace a default value of the member data in the updated data structure according to the size information of the data before the change; determining the data increment of the data structure according to the data size information before change and the data size information after change; and updating the newly added member data by using a default value according to the data increment.
In an optional embodiment, the header information of the data structure further includes check information, and the check information is used to perform a cyclic redundancy check on the integrity of the data structure.
In an alternative embodiment, the apparatus further comprises:
and the calling module 504 is configured to set or obtain data structures in different data modules according to the index of the data structure.
In an alternative embodiment, the data modules are divided according to the type of data.
It should be noted that the updating apparatus of the data structure provided in the embodiment shown in fig. 13 may be used to execute the method provided in any of the above embodiments, and the specific implementation manner and the technical effect are similar, and are not described again here.
Fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 14, the electronic device may include: a processor 601 and a memory 602.
A memory 602 for storing programs. In particular, the program may include program code including computer operating instructions.
The memory 602 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 601 is used for executing computer-executable instructions stored in the memory 602 to implement the above-mentioned data structure updating method;
the processor 601 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present Application.
Alternatively, in a specific implementation, if the communication interface, the memory 602 and the processor 601 are implemented independently, the communication interface, the memory 602 and the processor 601 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. Buses may be classified as address buses, data buses, control buses, etc., but do not represent only one bus or type of bus.
Alternatively, in a specific implementation, if the communication interface, the memory 602 and the processor 601 are integrated into a chip, the communication interface, the memory 602 and the processor 601 may complete communication through an internal interface.
The embodiment of the application also provides a chip which comprises a processor and an interface. Wherein the interface is used for inputting and outputting data or instructions processed by the processor. The processor is configured to perform the methods provided in the above method embodiments. The chip can be applied to the updating device of the data structure.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, are specifically, the computer-readable storage medium stores program information, and the program information is used in the method for updating the data structure.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the invention are brought about in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (20)

1. A method for updating a data structure, the method comprising:
receiving an update instruction sent by a terminal device, wherein the update instruction is used for adjusting version control data of a data structure in a target application;
determining an information item to be changed in header information of the data structure according to the change type of the data structure indicated by the adjusted version control data;
updating the data structure in the target application by changing the information item to be changed;
and setting or acquiring data structures in different data modules according to the indexes of the data structures.
2. The method of claim 1, wherein the type of change in the data structure comprises deleting member data in the data structure, inserting new member data in the data structure, and inserting the new member data at the end of the member data in the data structure.
3. The method according to claim 2, wherein the information item to be changed includes version information and data size information.
4. The method of claim 3, wherein the determining the information item to be changed in the header information of the data structure comprises:
and if the change type is deleting the member data in the data structure or inserting newly added member data into the member data in the data structure, determining the information item to be changed as the version information.
5. The method according to claim 4, wherein the updating the data structure in the target application by changing the information item to be changed comprises:
replacing the version information before the change with the version information after the change in the header information of the data structure;
and replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
6. The method of claim 3, wherein the determining the information item to be changed in the header information of the data structure comprises:
and if the change type is that the newly added member data is inserted into the tail part of the member data of the data structure, determining the information item to be changed as the data size information.
7. The method according to claim 6, wherein the updating the data structure in the target application by changing the information item to be changed comprises:
replacing the default value of the member data in the updated data structure according to the data size information before the change;
determining the data increment of the data structure according to the data size information before change and the data size information after change;
and updating the newly added member data by using a default value according to the data increment.
8. The method according to any of claims 1-7, wherein the header information of the data structure further comprises check information, and the check information is used for performing cyclic redundancy check on the integrity of the data structure.
9. The method of claim 1, wherein the data modules are partitioned according to the type of data.
10. An apparatus for updating a data structure, the apparatus comprising:
the system comprises a receiving module, a sending module and a processing module, wherein the receiving module is used for receiving an updating instruction sent by terminal equipment, and the updating instruction is used for adjusting version control data of a data structure in a target application;
the determining module is used for determining an information item to be changed in the header information of the data structure according to the change type of the data structure indicated by the adjusted version control data;
the updating module is used for updating the data structure in the target application by changing the information item to be changed;
and the calling module is used for setting or acquiring the data structures in different data modules according to the indexes of the data structures.
11. The apparatus of claim 10, wherein the type of change in the data structure comprises deleting member data in the data structure, inserting new member data in the data structure, and inserting the new member data at the end of the member data in the data structure.
12. The apparatus of claim 11, wherein the information items to be changed comprise version information and data size information.
13. The apparatus according to claim 12, wherein the determining module is specifically configured to determine that the information item to be changed is the version information if the change type is to delete member data in the data structure or insert newly added member data into member data in the data structure.
14. The apparatus according to claim 13, wherein the updating module is specifically configured to replace the version information before the change with the version information after the change in the header information of the data structure; and replacing the data structure corresponding to the version information before the change by using the data structure corresponding to the version information after the change.
15. The apparatus according to claim 12, wherein the determining module is specifically configured to determine the information item to be changed as the data size information if the change type is that the new member data is inserted at a member data tail of the data structure.
16. The apparatus according to claim 15, wherein the updating module is specifically configured to replace a default value of the member data in the updated data structure according to the data size information before the change; determining the data increment of the data structure according to the data size information before change and the data size information after change; and updating the newly added member data by using a default value according to the data increment.
17. The apparatus according to any of claims 10-16, wherein the header information of the data structure further comprises check information, and the check information is used for performing cyclic redundancy check on the integrity of the data structure.
18. The apparatus of claim 10, wherein the data modules are partitioned according to types of data.
19. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to any of claims 1-9.
20. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to perform the method steps according to any of claims 1-9.
CN202111464681.3A 2021-12-03 2021-12-03 Data structure updating method and device Active CN113868231B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111464681.3A CN113868231B (en) 2021-12-03 2021-12-03 Data structure updating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111464681.3A CN113868231B (en) 2021-12-03 2021-12-03 Data structure updating method and device

Publications (2)

Publication Number Publication Date
CN113868231A true CN113868231A (en) 2021-12-31
CN113868231B CN113868231B (en) 2022-03-18

Family

ID=78985727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111464681.3A Active CN113868231B (en) 2021-12-03 2021-12-03 Data structure updating method and device

Country Status (1)

Country Link
CN (1) CN113868231B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050289544A1 (en) * 2004-06-24 2005-12-29 Kalos Matthew J Method to update a data structure disposed in an embedded device
CN103218239A (en) * 2013-04-09 2013-07-24 沈阳美行科技有限公司 Method for supporting version increment and upgrading version of navigator map
CN104252364A (en) * 2013-06-25 2014-12-31 腾讯科技(深圳)有限公司 Increment updating method, equipment and system
CN107741833A (en) * 2017-10-30 2018-02-27 广东乐心医疗电子股份有限公司 Storage method and device of nestable key-value
CN110941673A (en) * 2019-11-26 2020-03-31 中国人民解放军战略支援部队信息工程大学 Block chain data structure and task processing method and device
CN111625598A (en) * 2020-05-15 2020-09-04 南京东垚建筑科技研究院有限公司 Engineering cooperation block chain data structure and application method
CN111684766A (en) * 2019-05-23 2020-09-18 深圳市大疆创新科技有限公司 Updating communication protocol version numbers in distributed systems
CN111782235A (en) * 2019-09-27 2020-10-16 北京沃东天骏信息技术有限公司 Data upgrading and querying method and device
CN112084258A (en) * 2020-08-18 2020-12-15 腾讯科技(深圳)有限公司 Data synchronization method and device
CN112685433A (en) * 2021-01-07 2021-04-20 网易(杭州)网络有限公司 Metadata updating method and device, electronic equipment and computer-readable storage medium
US20210117176A1 (en) * 2019-10-22 2021-04-22 Microsoft Technology Licensing, Llc Updating a metadata structure for a firmware update

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050289544A1 (en) * 2004-06-24 2005-12-29 Kalos Matthew J Method to update a data structure disposed in an embedded device
CN103218239A (en) * 2013-04-09 2013-07-24 沈阳美行科技有限公司 Method for supporting version increment and upgrading version of navigator map
CN104252364A (en) * 2013-06-25 2014-12-31 腾讯科技(深圳)有限公司 Increment updating method, equipment and system
CN107741833A (en) * 2017-10-30 2018-02-27 广东乐心医疗电子股份有限公司 Storage method and device of nestable key-value
CN111684766A (en) * 2019-05-23 2020-09-18 深圳市大疆创新科技有限公司 Updating communication protocol version numbers in distributed systems
CN111782235A (en) * 2019-09-27 2020-10-16 北京沃东天骏信息技术有限公司 Data upgrading and querying method and device
US20210117176A1 (en) * 2019-10-22 2021-04-22 Microsoft Technology Licensing, Llc Updating a metadata structure for a firmware update
CN110941673A (en) * 2019-11-26 2020-03-31 中国人民解放军战略支援部队信息工程大学 Block chain data structure and task processing method and device
CN111625598A (en) * 2020-05-15 2020-09-04 南京东垚建筑科技研究院有限公司 Engineering cooperation block chain data structure and application method
CN112084258A (en) * 2020-08-18 2020-12-15 腾讯科技(深圳)有限公司 Data synchronization method and device
CN112685433A (en) * 2021-01-07 2021-04-20 网易(杭州)网络有限公司 Metadata updating method and device, electronic equipment and computer-readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王彬等: "基于能量管理系统平台的嵌入式软件系统", 《电力系统自动化》 *

Also Published As

Publication number Publication date
CN113868231B (en) 2022-03-18

Similar Documents

Publication Publication Date Title
CN110597595A (en) Method for providing multi-language information, method for configuring multi-language information, device, equipment and medium
CN111736956A (en) Container service deployment method, device, equipment and readable storage medium
CN105515872A (en) Method, apparatus and system for updating configuration information
KR20190076197A (en) Apparatus and method for storing data based on blockchain
CN109885612B (en) Synchronous validation method and device for intelligent contracts of block chains
CN108345462B (en) Method and device for upgrading components
CN104573497A (en) Processing method and device for starting items
CN111385255B (en) Asynchronous call implementation method and device, server and server cluster
CN109167819B (en) Data synchronization system, method, device and storage medium
CN113868231B (en) Data structure updating method and device
CN106028144A (en) Method and device for monitoring audio and video resources in television terminal, and television terminal
CN104573496A (en) Method and device for inhibiting starting items from starting
CN112131478A (en) Transaction detection method and device
CN111092774A (en) Configuration method and equipment of acquisition gateway
CN112860595B (en) PCI (peripheral component interconnect express) equipment or PCIE (peripheral component interconnect express) equipment, data access method and related assembly
CN113132241B (en) ACL template dynamic configuration method and device
CN114265845A (en) Processing method and device of delay task and electronic equipment
CN115080068A (en) Resource file transmission method, device, equipment and storage medium
CN114675954A (en) Task scheduling method and device
KR20150029916A (en) Apparatus and method for setting up computting environments
CN108874560B (en) Method and communication device for communication
CN112463616A (en) Chaos testing method and device for Kubernetes container platform
CN107678928B (en) Application program processing method and server
CN111277435A (en) Method and device for upgrading network equipment, storage medium and electronic equipment
CN112306371A (en) Method, apparatus and computer program product for storage management

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
GR01 Patent grant
GR01 Patent grant