CN115185885A - Method and device for converting serialized data - Google Patents

Method and device for converting serialized data Download PDF

Info

Publication number
CN115185885A
CN115185885A CN202210798761.0A CN202210798761A CN115185885A CN 115185885 A CN115185885 A CN 115185885A CN 202210798761 A CN202210798761 A CN 202210798761A CN 115185885 A CN115185885 A CN 115185885A
Authority
CN
China
Prior art keywords
data
model file
file
converting
modified
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
CN202210798761.0A
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.)
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Wuhan Fiberhome Technical Services 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 Fiberhome Telecommunication Technologies Co Ltd, Wuhan Fiberhome Technical Services Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN202210798761.0A priority Critical patent/CN115185885A/en
Publication of CN115185885A publication Critical patent/CN115185885A/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/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/116Details of conversion of file system types or formats
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Abstract

The invention relates to a method and a device for converting serialized data. The method mainly comprises the following steps: acquiring original data and a first model file corresponding to the original data; converting the original data into first intermediate data according to the first model file; acquiring a second model file and a preset rule file of the target data; converting the first intermediate data into second intermediate data according to the comparison between the second model file and the first model file and a preset rule file; and serializing the second intermediate data into target data according to the serialization type of the second model file. The invention uses the predefined data model to analyze the original data, produces the intermediate data, uses the predefined rule to assign value to the newly added/modified field in the intermediate data, and then generates the target data.

Description

Method and device for converting serialized data
Technical Field
The present invention relates to the field of data conversion technologies, and in particular, to a method and an apparatus for converting serialized data.
Background
With the rapid development of the 5G technology, the network scale is larger and larger, and the requirements of network upgrade on upgrade time and data correctness are higher and higher.
At present, a lot of network configuration data are stored in a serialization mode, and the data are in binary forms and cannot be visually checked and modified. For network upgrades, the network configuration data structure is more or less variable, and some are even incompatible.
For these incompatible data changes, the current approach is to perform the upgrade using the UU upgrade tool. The method comprises the following steps:
1. the network element configuration data and version information to be upgraded are obtained in advance.
2. And comparing the configuration before upgrading with the configuration model after upgrading to obtain a list of configuration data needing to be modified and which modifications (field addition, field deletion and the like) need to be carried out on the configuration data.
3. Writing a UU upgrading tool, and carrying out targeted modification on each configuration data modification needing to be modified (deserializing original data, redefining data according to upgraded configuration, copying a corresponding field, supplementing other information, and serializing to obtain target data).
4. And directly using the modified configuration data for replacement during upgrading.
The main problems of the prior art means are:
1. the efficiency is low, each modified configuration block needs to be modified by writing codes, and different data of the same configuration block may also need to be modified in a targeted manner.
2. Rework is easy to occur, if the conversion code of certain data is written incorrectly, the code needs to be modified, and the conversion tool is compiled and packaged into a new conversion tool, which is time-consuming and labor-consuming.
In view of this, how to overcome the defects in the prior art, a more efficient upgrading method is provided in network upgrading, which upgrades the serialized data of the old version into the data of the new version quickly and transparently, so as to improve the quality and efficiency of network upgrading.
Disclosure of Invention
Aiming at the defects or the improvement requirements in the prior art: in the network upgrading process, upgrading codes are compiled by means of one-by-one configuration, upgrading verification is configured one by one, the efficiency is low, rework is easy, and the upgrading time is possibly too long to return. The invention provides a method and a device for converting serialized data, which analyze original data by using a predefined data model, produce intermediate data, assign values to newly added/modified fields in the intermediate data by using predefined rules, and then generate target data.
The embodiment of the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for converting serialized data, including:
acquiring original data and a first model file corresponding to the original data;
converting the original data into first intermediate data according to the first model file;
acquiring a second model file and a preset rule file of target data;
converting the first intermediate data into second intermediate data according to the comparison between the second model file and the first model file and a preset rule file;
and serializing the second intermediate data into target data according to the serialization type of the second model file.
Further, the acquiring the original data and the first model file corresponding to the original data specifically includes:
acquiring original data and the data type of the original data;
and acquiring the definition of the first model file corresponding to the original data.
Further, the converting the original data into the first intermediate data according to the first model file specifically includes:
finding a corresponding deserializing tool according to the original data and the serialization type of the original data;
deserializing the original data into first intermediate data according to the data type and the deserializing tool corresponding to the original data;
and saving the first intermediate data as a first file, and simultaneously recording basic information of the data, wherein the basic information comprises one or more of data type, unique identifier, key words and version information.
Further, the acquiring the second model file of the target data and the preset rule file specifically includes:
acquiring the definition of a second model file corresponding to the target data;
acquiring a preset rule file; the content defined by the preset rule file comprises the following contents: defining default values, defining a mapping relationship between members of the first model file and the second model file.
Further, the converting the first intermediate data into the second intermediate data according to the comparison between the second model file and the first model file and the preset rule file specifically includes:
reading the data structure definitions of the first model file and the second model file, comparing the data structure differences of the first model file and the second model file, neglecting the data structures with the same structure, acquiring the data structures with the differences, and storing the data structure types and the added or deleted member variables;
reading the first intermediate data, and judging whether the data needs to be modified according to the obtained data structure difference; if the condition needing to be modified is found, modifying according to the difference of the data structure to obtain first intermediate modified data;
reading preset rule file information, and modifying the first intermediate modified data according to the preset rule file information to obtain second intermediate modified data;
and checking the second intermediate modified data, judging whether the second intermediate modified data needs to be modified, if not, directly taking the second intermediate modified data as the second intermediate data and storing the second intermediate data, and if so, taking the second intermediate modified data as the second intermediate data and storing the second intermediate data.
Further, the serializing the second intermediate data into the target data according to the serialization type of the second model file specifically includes:
reading second intermediate data according to the serialization type of the second model file, and serializing the second intermediate data into target data; when reading the second intermediate data, if the field data is found to be incorrect, modifying the second intermediate data, and then serializing the modified second intermediate data into the target data.
Further, the first model file and the second model file both include a data structure definition and a serialization type corresponding to the target data; wherein:
the data structure definition comprises one or more of member variable names, types, default values and value ranges;
the serialization types comprise one or more of proto buffer, ice, thrift and Avro;
the member variable types in the data structure definition comprise one or more of pool, int, short, long, string, char, int64 and copy data structures;
if the member variable in the data structure definition is also a data structure, then the data structure is also defined in the corresponding first model file and/or second model file.
Further, the first intermediate data and the second intermediate data are both plaintext, and the storage format uses one or more of txt, xml, xsd, and json.
Further, depending on the configuration, one serialized data is saved as one file, or one type of data is saved as one file.
On the other hand, the invention provides a conversion device for serialized data, which specifically comprises: the method comprises at least one processor and a memory, wherein the at least one processor and the memory are connected through a data bus, and the memory stores instructions capable of being executed by the at least one processor, and the instructions are used for completing the method for converting the serialized data in the first aspect after being executed by the processor.
Compared with the prior art, the invention has the beneficial effects that:
1. the prior art needs to write adaptive code separately for each configuration block, and the workload is proportional to the type of the configuration block. The invention can adapt to all the configuration blocks only by writing a set of codes, thereby greatly reducing the workload.
2. In the prior art, modification is troublesome after configuration blocks are adapted, and if a certain configuration block needs to be modified in a verification stage, codes need to be modified, compiling, packaging and verifying again, so that the time is long. After the codes are written, only the relevant configuration files need to be modified, or the intermediate data need to be modified, and the codes do not need to be modified again.
3. The prior art writes code for a specific version, such as an upgrade from version a to version B, and an upgrade from version B to version C all require different adapted code to be written. The invention only needs to write a set of codes to adapt to the versions A to B and B to C, and only needs to modify the definition of the configuration block and the configuration file.
Generally, the conversion logic and the specific configuration of the prior art are combined tightly, and each configuration block needs to be written with code separately. The invention separates the conversion logic and the configuration, the conversion logic is abstracted into a code program, the concrete configuration is used as input data, and different data can obtain different results.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below. It is obvious that the drawings described below are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a flowchart of a method for converting serialized data according to embodiment 1 of the present invention;
FIG. 2 is an expanded flowchart of step 100 provided in embodiment 1 of the present invention;
FIG. 3 is an expanded flowchart of step 200 provided in embodiment 1 of the present invention;
FIG. 4 is an expanded flowchart of step 300 provided in embodiment 1 of the present invention;
FIG. 5 is an expanded flowchart of step 400 provided in embodiment 1 of the present invention;
fig. 6 is a schematic structural diagram of a conversion apparatus for serialized data according to embodiment 3 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The present invention is a system structure of a specific function system, so the functional logic relationship of each structural module is mainly explained in the specific embodiment, and the specific software and hardware implementation is not limited.
In addition, the technical features related to the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other, and the order of the steps may be changed if they are logical and do not conflict with each other. The invention will now be described in detail with reference to the figures and examples.
Example 1:
as shown in fig. 1, an embodiment of the present invention provides a method for converting serialized data, which includes the following steps.
Step 100: the method comprises the steps of obtaining original data and a first model file corresponding to the original data. In this step, the raw data and the definition (including data structure, data type, and serialization type) of the first model file corresponding to the raw data need to be obtained.
Step 200: and converting the original data into first intermediate data according to the first model file. In the step, the original data is converted into first intermediate data, and specifically, the original data is deserialized into the first intermediate data through definition of the original data, a serialization type and a data structure.
Step 300: and acquiring a second model file and a preset rule file of the target data. In this step, the definition (including data structure, data type, serialization type) of the second model file of the target data needs to be obtained, and a preset rule file is obtained, where the rule file defines the mapping relationship of members in some data structures.
Step 400: and converting the first intermediate data into second intermediate data according to the comparison between the second model file and the first model file and the preset rule file.
Step 500: and serializing the second intermediate data into target data according to the serialization type of the second model file.
The upgrading method realized by the steps can be better used in the scenes of network upgrading, data conversion and the like. When there is a reduced field/structure in the data structure, the content of the relevant field/structure can be automatically reduced through the above steps. When the data structure has the added fields/structures, the content of the related fields/structures can be automatically added through the steps, and the default values are filled according to the data types. The technology of the steps is safer and more transparent, and the upgrade personnel can quickly compare the configuration difference before and after the upgrade and support manual modification. By the steps, the system upgrading efficiency can be effectively improved, and the maintenance labor cost is reduced.
The above is an overview of technical contents and effects of the present embodiment, and the technical contents of the present embodiment are described in detail below by expanding descriptions of respective steps.
Specifically, as shown in fig. 2, the step 100 (acquiring the original data and the first model file corresponding to the original data) of the present preferred embodiment may be expanded to the following steps.
Step 101: and acquiring the original data and the data type of the original data.
Step 102: and acquiring the definition of the first model file corresponding to the original data. In this step, the first model file includes a data structure definition and a serialization type corresponding to the target data. The data structure definition comprises one or more of member variable names, types, default values and value ranges; the serialization types comprise one or more of proto buffer, ice, thrift and Avro; the member variable types in the data structure definition comprise one or more of a pool, int, short, long, string, char, int64 and a copy data structure; if the member variable in the data structure definition is also a data structure, then the data structure is also defined in the corresponding first model file.
In this embodiment, through step 100, the original data, the data model, the data structure, the member variables, and the serialization types are used as the input data, so that the same set of code can logically process data of various types, and the compatibility is better.
Specifically, as shown in fig. 3, the step 200 (converting the original data into the first intermediate data according to the first model file) of the preferred embodiment can be extended to the following steps.
Step 201: and finding out a corresponding deserializing tool according to the original data and the serialization type of the original data. It should be noted that the serialization tool and the deserialization tool in this embodiment are both serialization and deserialization tools generated by defining an idl (interface description language) and then compiling using different languages (such as java python c + +, etc.), that is, these tools are generated by a serialization type + compilation language + model definition (idl). The specific generation process, the generated serialization tool and the deserialization tool belong to the prior art, and are not described herein again.
Step 202: and deserializing the original data into first intermediate data according to the data type and the deserializing tool corresponding to the original data.
Step 203: and saving the first intermediate data as a first file, and simultaneously recording basic information of the data, wherein the basic information comprises one or more of data type, unique identifier, key words and version information.
Optionally, according to the configuration, one serialized data may be saved as one file, or one type of data may be saved as one file.
In addition, the first intermediate data in the above steps is plaintext, and the storage format may use one or more of txt, xml, xsd, json and the like.
In this embodiment, through step 200, the original data is saved as the first intermediate data, and the values of the fields in the original data can be visually checked.
Specifically, as shown in fig. 4, step 300 (obtaining the second model file of the target data and the preset rule file) of the preferred embodiment may be extended to the following steps.
Step 301: and acquiring the definition of a second model file corresponding to the target data. In this step, the second model file includes a data structure definition and a serialization type corresponding to the target data; the data structure definition comprises one or more of member variable name, type, default value and value range; the serialization types comprise one or more of proto buffer, ice, thrift and Avro; the member variable types in the data structure definition comprise one or more of a pool, int, short, long, string, char, int64 and a copy data structure; if the member variable in the data structure definition is also a data structure, then the data structure is also defined in the corresponding second model file.
Step 302: acquiring a preset rule file; the content defined by the preset rule file comprises the following contents: defining default values, defining a mapping relationship between members of the first model file and the second model file. For this step, the conversion between the data structures in the first model file of the raw data and the second model file of the target data and the member variables within the data structures is identified by default by name, and raw data members of the same name are assigned to members of the target data. Based on this, the preset rule file of the embodiment defines the following contents:
default values are defined. The same data structure is absent from a first model file of the original data, and when present in a second model file of the target data, and the default value of the second model file does not meet the requirements, the default value of the target data is defined.
A mapping relationship between a first model file member of the raw data and a second model file member of the target data is defined.
Specifically, as shown in fig. 5, the step 400 (converting the first intermediate data into the second intermediate data according to the comparison between the second model file and the first model file and the preset rule file) of the preferred embodiment can be extended to the following steps.
Step 401: reading the data structure definitions of the first model file and the second model file, comparing the data structure differences of the first model file and the second model file, neglecting the data structures with the same structure, acquiring the data structures with the differences, and storing the data structure types and the added or deleted member variables. The added or deleted member variables comprise information such as member variable names, types, default values, value ranges and the like.
Step 402: reading the first intermediate data, and judging whether the data needs to be modified according to the data structure difference obtained in the step (401); and if the condition needing to be modified is found, modifying according to the difference of the data structure to obtain first intermediate modified data.
Step 403: and reading the preset rule file information, and modifying the first intermediate modified data according to the preset rule file information to obtain second intermediate modified data.
Step 404: and checking the second intermediate modified data, judging whether the second intermediate modified data needs to be modified, if not, directly taking the second intermediate modified data as the second intermediate data and storing the second intermediate data, and if so, taking the second intermediate modified data as the second intermediate data and storing the second intermediate data. In this step, the second intermediate modified data may be modified into the second intermediate data by an external program or manually, and stored. The second intermediate data is in plain text, and the format can be saved by using txt, xml, xsd, json and the like.
In step 402, when the data structure definition of the second model file has a reduced field/structure for the first model file, the present embodiment can automatically reduce the content of the relevant field/structure. When there is an added field/structure in the data structure, the present embodiment can automatically add the content of the relevant field/structure.
In step 403, the default values may be filled up according to the data type.
In step 404, the data before the target data serialization is saved as the second intermediate data, which can be compared with the first intermediate data generated in step 200, and verified or modified manually. It should be noted that the second intermediate modified data in this step is automatically generated from the model and the preset rule file, but the integrity of the modified data cannot be guaranteed sometimes, for example, 10 fields are added, and there may be a field in the automation program that has no value assigned, or a value assigned error. Then we can get what fields' data we specifically modified (what was added, what was deleted, what was added field value) when comparing the second intermediate modified data with the first intermediate data. If so, no further modification is necessary. If not, then a modification is required. So here it is equivalent to a mechanism to keep one check. There are two ways to determine if the expectation is met: manual judgment and external program use a set of rules to check.
Specifically, step 500 (serializing the second intermediate data into the target data according to the serialization type of the second model file) of the preferred embodiment may be extended as follows: and reading the second intermediate data according to the serialization type of the second model file, and serializing the second intermediate data into target data. In this step, when reading the second intermediate data, if the field data is found to be incorrect, the second intermediate data is modified, and then the modified second intermediate data is serialized into the target data. Therefore, the efficiency in the configuration upgrading and data conversion process can be greatly improved. The second intermediate data in this step is obtained by determining the correctness of the second intermediate modified data and modifying the second intermediate data, generally speaking, the second intermediate data is accurate, but errors and omissions may occur sometimes, if there are no errors and omissions, the second intermediate data is directly serialized into the target data, and when an error and an omission are found, the second intermediate data can be corrected and then serialized into the target data.
In summary, in the prior art, adaptation codes need to be written separately for each configuration block, and the workload is proportional to the type of the configuration block, whereas in the embodiment of the present invention, only one set of codes needs to be written, so that all configuration blocks can be adapted, and the workload is greatly reduced. In the prior art, modification is troublesome after the configuration blocks are adapted, and if a certain configuration block needs to be modified in a verification stage, code modification, compiling, packaging and re-verification are needed, so that time is consumed. The existing writing code is specific to a specific version, for example, the version A is upgraded to the version B, and the version B is upgraded to the version C, different adaptive codes are required to be written, but the embodiment of the invention can adapt to the versions A to B and B to C by writing only one set of codes, and only the definition of the configuration block and the configuration file need to be modified. Generally, the conversion logic and the concrete configuration in the prior art are combined closely, each configuration block needs to write codes separately, but the embodiment of the invention separates the conversion logic and the configuration, the conversion logic is abstracted into a code program, the concrete configuration is used as input data, and different data can obtain different results.
Example 2:
based on the method for converting serialized data provided in embodiment 1, embodiment 2 provides a specific example as an example to describe the method provided in embodiment 1 in detail.
For example, a first model file corresponding to existing original data is defined as an xsd file, and the content is as follows:
Figure BDA0003736680000000111
Figure BDA0003736680000000121
the second model file is defined as follows:
Figure BDA0003736680000000122
Figure BDA0003736680000000131
in the first model file and the second model file, there are 3 structures, which are GroupBasicInfmtn, access control and SNMPGroupConfig, wherein SNMPGroupConfig contains the structures GroupBasicInfmtn and Access control. In addition, the model files are serialized and deserialized by using protobuffer3, and the types of the structure bodies are defined as 1, 2 and 3 respectively.
The difference between the first model file and the second model file is: the structure Access control of the second model file is one more member NotifyNodeView than the first model file.
For existing raw data, a file save is used, the file name is 3_13172738.Pb, where 3 is the type of the raw data, corresponding to SNMPGroupConfig in the model file. The file content is as follows: 088280A406120D0A097465737467726F757010011A11080110011A 04726561642205777974652207636F 6E74657874.
The original data is deserialized through step 200 in example 1, and the generated first intermediate data is xml, which is as follows:
Figure BDA0003736680000000141
through step 402 in embodiment 1, first intermediate modification data is generated as follows:
Figure BDA0003736680000000142
Figure BDA0003736680000000151
the first intermediate modified data will complete the missing fields NotifyNodeView, giving the default value null.
Defining a preset rule file xml, wherein the content is as follows:
Figure BDA0003736680000000152
the rule file sets the member NotifyNodeView of the AccessControl to "notify".
Through step 403 in embodiment 1, second intermediate modified data is obtained according to the first intermediate modified data and the rule file:
Figure BDA0003736680000000153
Figure BDA0003736680000000161
and checking the second intermediate modified data, and directly processing the second intermediate modified data without modifying the second intermediate modified data.
Target data is generated through step 500 in embodiment 1, and the content is as follows:
088280A406120D0A097465737467726F757010011A11080110011A0472656164220577726974652A066E6F746966792207636F6E74657874。
example 3:
on the basis of the method for converting serialized data provided in embodiment 1, the present invention further provides a device for converting serialized data, which can be used to implement the method and system described above, as shown in fig. 6, which is a schematic diagram of a device architecture according to an embodiment of the present invention. The serialized data conversion apparatus of the present embodiment includes one or more processors 21 and a memory 22. In fig. 6, one processor 21 is taken as an example.
The processor 21 and the memory 22 may be connected by a bus or other means, such as the bus connection in fig. 6.
The memory 22, which is a nonvolatile computer-readable storage medium, may be used to store nonvolatile software programs, nonvolatile computer-executable programs, and modules, such as the conversion method of serialized data in embodiment 1. The processor 21 executes various functional applications of the conversion apparatus of the serialized data and data processing, that is, realizes the conversion method of the serialized data of embodiment 1, by executing the nonvolatile software program, instructions, and modules stored in the memory 22.
The memory 22 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 22 may optionally include memory located remotely from the processor 21, and these remote memories may be connected to the processor 21 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The program instructions/modules are stored in the memory 22 and, when executed by the one or more processors 21, perform the method of converting serialized data in embodiment 1 described above, for example, perform the various steps shown in fig. 1-5 described above.
Those of ordinary skill in the art will appreciate that all or part of the steps of the various methods of the embodiments may be implemented by associated hardware as instructed by a program, which may be stored on a computer-readable storage medium, which may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, etc.
The above description is intended to be illustrative of the preferred embodiment of the present invention and should not be taken as limiting the invention, but rather, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention. Those not described in detail in this specification are within the skill of the art.

Claims (10)

1. A method for converting serialized data, comprising:
acquiring original data and a first model file corresponding to the original data;
converting the original data into first intermediate data according to the first model file;
acquiring a second model file and a preset rule file of target data;
converting the first intermediate data into second intermediate data according to the comparison between the second model file and the first model file and a preset rule file;
and serializing the second intermediate data into target data according to the serialization type of the second model file.
2. The method for converting serialized data according to claim 1, wherein the acquiring of the original data and the first model file corresponding to the original data specifically comprises:
acquiring original data and the data type of the original data;
and acquiring the definition of the first model file corresponding to the original data.
3. The method for converting serialized data according to claim 2, wherein the converting the original data into the first intermediate data according to the first model file specifically comprises:
finding out a corresponding anti-serialization tool according to the original data and the serialization type of the original data;
deserializing the original data into first intermediate data according to the data type and the deserializing tool corresponding to the original data;
and saving the first intermediate data as a first file, and simultaneously recording basic information of the data, wherein the basic information comprises one or more of data type, unique identifier, key words and version information.
4. The method for converting serialized data according to claim 3, wherein the obtaining of the second model file and the preset rule file of the target data specifically includes:
acquiring definition of a second model file corresponding to target data;
acquiring a preset rule file; the content defined by the preset rule file comprises the following contents: defining default values, defining a mapping relationship between members of the first model file and the second model file.
5. The method according to claim 4, wherein the converting the first intermediate data into the second intermediate data according to the comparison between the second model file and the first model file and the preset rule file specifically comprises:
reading the data structure definitions of the first model file and the second model file, comparing the data structure differences of the first model file and the second model file, neglecting the data structures with the same structure, acquiring the data structures with the differences, and storing the data structure types and the added or deleted member variables;
reading the first intermediate data, and judging whether the data needs to be modified according to the obtained data structure difference; if the condition needing to be modified is found, modifying according to the difference of the data structure to obtain first intermediate modified data;
reading preset rule file information, and modifying the first intermediate modified data according to the preset rule file information to obtain second intermediate modified data;
and checking the second intermediate modified data, judging whether the second intermediate modified data needs to be modified, if not, directly taking the second intermediate modified data as the second intermediate data and storing the second intermediate data, and if so, taking the second intermediate data after modification as the second intermediate data and storing the second intermediate data.
6. The method for converting serialized data according to claim 5, wherein the serializing second intermediate data into target data according to the serialization type of the second model file specifically comprises:
reading second intermediate data according to the serialization type of the second model file, and serializing the second intermediate data into target data; when reading the second intermediate data, if the field data is found to be incorrect, modifying the second intermediate data, and then serializing the modified second intermediate data into the target data.
7. The method for converting serialized data according to any one of claims 1-6, wherein the first model file and the second model file each include a data structure definition corresponding to the target data and a serialization type; wherein:
the data structure definition comprises one or more of member variable names, types, default values and value ranges;
the serialization types comprise one or more of proto buffer, ice, thrift and Avro;
the member variable types in the data structure definition comprise one or more of pool, int, short, long, string, char, int64 and copy data structures;
if the member variable in the data structure definition is also a data structure, then the data structure is also defined in the corresponding first model file and/or second model file.
8. The method of converting serialized data as recited in any of claims 1-6 wherein the first intermediate data and the second intermediate data are in plain text and the storage format uses one or more of txt, xml, xsd, json.
9. The method for converting serialized data as claimed in any one of claims 1 to 6 wherein a serialized data is stored as a file or a type of data is stored as a file depending on the configuration.
10. A device for converting serialized data, comprising:
comprising at least one processor and a memory, said at least one processor and said memory being connected by a data bus, said memory storing instructions executable by said at least one processor, said instructions, after execution by said processor, being adapted to perform a method of converting serialized data according to any of claims 1-9.
CN202210798761.0A 2022-07-08 2022-07-08 Method and device for converting serialized data Pending CN115185885A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210798761.0A CN115185885A (en) 2022-07-08 2022-07-08 Method and device for converting serialized data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210798761.0A CN115185885A (en) 2022-07-08 2022-07-08 Method and device for converting serialized data

Publications (1)

Publication Number Publication Date
CN115185885A true CN115185885A (en) 2022-10-14

Family

ID=83516438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210798761.0A Pending CN115185885A (en) 2022-07-08 2022-07-08 Method and device for converting serialized data

Country Status (1)

Country Link
CN (1) CN115185885A (en)

Similar Documents

Publication Publication Date Title
US10409587B2 (en) Method for programming vehicle electronic control modules
CN111399853B (en) Templated deployment method for machine learning model and custom operator
CN105022630B (en) A kind of assembly management system and assembly management method
CN112558980A (en) Multi-software-package management method and device
CA2539433A1 (en) Systems and methods for dynamically linking application software into a running operating system kernel
CN108197027B (en) Software performance optimization method, storable medium, computer program
US8914482B2 (en) Translation of technology-agnostic management commands into multiple management protocols
CN104881311A (en) Method and apparatus for judging version compatibility
CN112799677A (en) Hook method, device, equipment and storage medium for compilation period
CN111767589A (en) Batch processing method, system, terminal and storage medium based on static rigidity of automobile mounting point
WO2023039741A1 (en) Online development method and apparatus based on microservice system, device, and storage medium
CN104283947A (en) Java script dynamic consolidated server and work process thereof
US20100218200A1 (en) Method for programmatic editing of text files
CN110968339B (en) Method and device for front-end building tool and electronic equipment
CN115185885A (en) Method and device for converting serialized data
CN110806891B (en) Method and device for generating software version of embedded device
CN114579141A (en) Method and device for converting require frame into VUE frame
CN115185821A (en) Version labeling method, system, equipment and storage medium in program test
CN115373707A (en) Task online updating system and method under spacecraft real-time system memory limited condition
CN114489675A (en) Processing method and device of automatic driving system and electronic equipment
CN113590179A (en) Plug-in detection method and device, electronic equipment and storage medium
CN111930361A (en) Artificial intelligence operation mirror image templating construction method and device
WO2023115397A1 (en) Method and apparatus for generating automated script
CN109857018B (en) Digital sensor soft model system
WO2018171335A1 (en) Set-top box upgrade data selection method and system, and set-top box

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