Data transmission method and device, equipment and storage medium

By using the preset memory structure in multi -language development applications to generate target data objects and transmit it to different programming languages, solve the problem of low data transmission efficiency between different language modules, and achieve efficient data transmission.

CN119376973APending Publication Date: 2025-01-28BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411320541.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In applications developed by multilingual languages, due to different programming languages, data cannot be transmitted normally between functional modules developed by different languages. The existing methods require full serialization and deserialization of the data to be transmitted, resulting in data transmission Low efficiency.

Method used

Based on the first -function module, the target data object is generated based on the preset memory structure. The object includes key value data. The preset memory structure includes the storage unit, and the storage unit contains key fields and value fields. Then, transmit the target data object to the second function module, and obtain the value data corresponding to the target key data from the target data object from the target data object, and perform type conversion processing.

Benefits of technology

There is no need to conduct a full quantity serialization and derivativeization of the transmission data, which improves the data transmission efficiency between the functional modules of different programming languages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376973A_ABST
    Figure CN119376973A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a data transmission method and device, equipment and a storage medium, and the method comprises the steps: calling a first function module to generate a target data object based on a preset memory structure, transmitting the target data object to a second function module, and calling the second function module to obtain value data corresponding to target key data from the target data object, and performing type conversion processing on the value data according to the data type corresponding to the second function module to obtain converted value data corresponding to the target key data. Visibly, according to the embodiment of the invention, the preset memory structure universal for the functional modules developed by different programming languages is utilized to store the transmission data to generate the target data object, and the second functional module can obtain the value data corresponding to the required target key data from the target data object through transmission of the target data object; the transmission data does not need to be subjected to full-amount serialization and deserialization processing, and the efficiency of data transmission between function modules developed by different programming languages is improved on the whole.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a data transmission method, device, equipment and storage medium. Background Art

[0002] In the data transmission of multi-language applications, due to the differences in programming languages, data cannot be transmitted normally between different functional modules developed in different languages. At present, a serialization and deserialization solution is proposed to address the above problems. Among them, serialization and deserialization are relative. Serialization refers to the conversion of the data type of the data object into binary data, and deserialization refers to the conversion of binary data into other data types.

[0003] In an application scenario, take a module A written in the Java programming language calling a module B written in the C++ programming language as an example. Specifically, the Java data object in module A is first serialized into a byte array using a serialization and deserialization tool, and the byte array is sent to module B through network transmission. After module B receives the serialized byte array, it deserializes the byte array into a data type object that module B can recognize, and then obtains the required data type object from the data type object to perform subsequent operations.

[0004] However, the above method requires full serialization of the Java data object to be transmitted. At the same time, after module B receives the serialized byte array, the byte array also needs to be fully deserialized. However, since the transmitted data usually includes redundant data, the above processing method results in low data transmission efficiency between module A and module B. Summary of the invention

[0005] In order to solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides a data transmission method, apparatus, device and storage medium.

[0006] In a first aspect, an embodiment of the present disclosure provides a data transmission method, the method comprising:

[0007] Calling a first function module to generate a target data object based on a preset memory structure; wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data;

[0008] Transmitting the target data object to a second functional module; wherein the second functional module and the first functional module are functional modules generated based on different programming languages;

[0009] The second function module is called to obtain value data corresponding to the target key data from the target data object, and the value data is type-converted according to the data type corresponding to the second function module to obtain converted value data corresponding to the target key data.

[0010] In an optional implementation manner, the calling of the first functional module to generate a target data object based on a preset memory structure includes:

[0011] The first function module is called to write the key data in the key-value data into the key field of the storage unit in the preset memory structure, and write the value data in the key-value data into the value field of the storage unit to obtain the target data object.

[0012] In an optional implementation manner, the calling of the second function module to obtain value data corresponding to the target key data from the target data object includes:

[0013] Calling the second function module to determine the storage unit corresponding to the target key data from the target data object;

[0014] Based on the value field in the storage unit, value data corresponding to the target key data is obtained.

[0015] In an optional implementation, the preset memory structure further includes a data header, the data header includes a data volume field, and the data volume field is used to store the number of key-value pairs in the key-value data; the calling of the second function module to determine the storage unit corresponding to the target key data from the target data object includes:

[0016] Calling the second function module to obtain the number of key-value pairs stored in the data volume field in the data header from the target data object;

[0017] Based on the number of key-value pairs, a storage unit corresponding to the target key data is searched in the storage unit of the target data object.

[0018] In an optional implementation, the storage unit further includes a data type field, and the data type field is used to store data type information of the value data in the storage unit, and the data type information is used to identify a storage location of the value data.

[0019] In an optional implementation manner, the calling of the second function module to obtain value data corresponding to the target key data from the target data object includes:

[0020] Calling the second function module to determine the storage unit corresponding to the target key data from the target data object;

[0021] The data type information is obtained from the data type field in the storage unit, and the value data corresponding to the target key data is obtained according to the storage location identified by the data type information.

[0022] In an optional implementation, the storage location identified by the data type information includes a value field in the storage unit, and the value field in the storage unit is used to store value data of the target data type;

[0023] or,

[0024] The storage location of the data type information identifier includes a dynamic data field in the preset memory structure;

[0025] The dynamic data field in the preset memory structure is used to store value data of non-target data types.

[0026] In an optional implementation, obtaining the value data corresponding to the target key data according to the storage location identified by the data type information includes:

[0027] If the storage location indicates a value field in the storage unit, obtaining value data corresponding to the target key data from the value field;

[0028] If the storage location indicates a dynamic data field in the preset memory structure, the storage location information is obtained from the value field in the storage unit, and the value data corresponding to the target key data is obtained from the dynamic data field according to the storage location information.

[0029] In an optional implementation manner, the data header further includes a start identification field, and the start identification field is used to store a data reading start identification of the target data object.

[0030] In a second aspect, the present disclosure provides a data transmission device, the device comprising:

[0031] A generating module, configured to call the first function module to generate a target data object based on a preset memory structure; wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data;

[0032] A transmission module, used for transmitting the target data object to a second function module; wherein the second function module and the first function module are function modules generated based on different programming languages;

[0033] An acquisition module is used to call the second function module to obtain the value data corresponding to the target key data from the target data object, and perform type conversion on the value data according to the data type corresponding to the second function module to obtain the converted value data corresponding to the target key data.

[0034] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a data transmission method as provided in an embodiment of the present disclosure.

[0035] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the data transmission method provided by the embodiment of the present disclosure.

[0036] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0037] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0038] In the data transmission method provided by the embodiment of the present disclosure, first, a first functional module is called to generate a target data object based on a preset memory structure, wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store the key data in the key-value data, and the value field is used to store the value data corresponding to the key data, then, the target data object is transmitted to a second functional module, wherein the second functional module and the first functional module are functional modules generated based on different programming languages, and then, the second functional module is called to obtain the value data corresponding to the target key data from the target data object, and type conversion is performed on the value data according to the data type corresponding to the second functional module to obtain the converted value data corresponding to the target key data.

[0039] It can be seen that the embodiment of the present disclosure utilizes a preset memory structure common to functional modules developed in different programming languages ​​to store transmission data to generate a target data object. By transmitting the target data object, the second functional module can obtain the value data corresponding to the required target key data from the target data object, without the need to perform full serialization and deserialization processing on the transmission data, thereby improving the overall data transmission efficiency between functional modules developed in different programming languages. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0041] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present disclosure;

[0042] Figure 2 A schematic diagram of a data transmission process provided by an embodiment of the present disclosure;

[0043] Figure 3 A schematic diagram of the structure of a data transmission device provided in an embodiment of the present disclosure;

[0044] Figure 4 A schematic diagram of the structure of a data transmission device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0045] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0046] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0047] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0048] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0049] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0050] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0051] At present, in cross-language applications, how to improve the data transmission efficiency between functional modules developed in different programming languages ​​is a technical problem that needs to be solved.

[0052] To this end, an embodiment of the present disclosure provides a data transmission method, specifically, calling a first function module to generate a target data object based on a preset memory structure, wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data, and then, the target data object is transmitted to a second function module, wherein the second function module and the first function module are function modules generated based on different programming languages, and then, the second function module is called to obtain value data corresponding to the target key data from the target data object, and type conversion processing is performed on the value data according to the data type corresponding to the second function module to obtain converted value data corresponding to the target key data.

[0053] It can be seen that the embodiment of the present disclosure utilizes a preset memory structure common to functional modules developed in different programming languages ​​to store transmission data to generate a target data object. By transmitting the target data object, the second functional module can obtain the value data corresponding to the required target key data from the target data object, without the need to perform full serialization and deserialization processing on the transmission data, thereby improving the overall data transmission efficiency between functional modules developed in different programming languages.

[0054] Based on this, an embodiment of the present disclosure provides a data transmission method, which can be applied in a database system. The method is introduced below in conjunction with a specific embodiment.

[0055] Figure 1 The present invention provides a flow chart of a data transmission method provided in an embodiment of the present invention. The method can be executed by a data transmission device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:

[0056] S101: Calling a first functional module to generate a target data object based on a preset memory structure.

[0057] Among them, the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store the key data in the key-value data, and the value field is used to store the value data corresponding to the key data.

[0058] The data transmission method provided by the embodiments of the present disclosure is applied to a client. Specifically, the client can be deployed on a terminal such as a smart phone, a tablet computer, or a desktop computer.

[0059] The first function module in the embodiment of the present disclosure may be any function unit in the cross-language application. The function module may interact with other modules. The function module is used to implement one or more functions in the cross-language application.

[0060] In order to realize data transmission between functional modules of different programming languages, the embodiment of the present disclosure predefines a memory structure, namely, a preset memory structure in the embodiment of the present disclosure, and the preset memory structure is used to store key-value data transmitted between functional modules of different programming languages, namely, key-value data. Key-value data may refer to data stored in the form of key-value pairs. For example, the preset memory structure may be a byte array structure.

[0061] Specifically, the preset memory structure may be composed of at least one storage unit, each storage unit includes a key field and a value field, wherein a storage unit is used to store a pair of key-value data, specifically, the key field in the storage unit is used to store the key data in the key-value data, and the value field is used to store the value data in the key-value data. The number of key-value pairs of key-value data to be transmitted determines the number of storage units used by the target data object.

[0062] like Figure 2 The figure is a schematic diagram of a data transmission process provided by an embodiment of the present disclosure. The preset memory structure 201 includes a storage unit 202 and a storage unit 203, each storage unit includes a key field and a value field, such as the storage unit 202 includes a key field 204 and a value field 205.

[0063] In actual applications, since the preset memory structure is used to store key-value data, before calling the first functional module to generate a target data object based on the preset memory structure, it is also necessary to determine the type of data to be transmitted by the first functional module.

[0064] In an optional implementation, when a first function module calls a second function module, if the data to be transmitted from the first function module to the second function module is key-value data, the first function module is called to store the key-value data based on a preset memory structure to generate a target data object. Specifically, the key-value data is stored using a storage unit in the preset memory structure.

[0065] In another optional implementation, if it is determined that the data to be transmitted by the first functional module does not belong to key-value data, other serialization and deserialization methods may be used for data transmission, which is not limited in the embodiment of the present disclosure.

[0066] Since the storage unit of the preset memory structure includes a key field and a value field, calling the first function module to generate a target data object based on the preset memory structure may include calling the first function module to write the key data in the key-value data to be transmitted into the key field of the storage unit in the preset memory structure, and writing the value data in the key-value data into the value field of the storage unit to obtain the target data object.

[0067] Specifically, the key data and the value data of each pair of key-value data in the key-value data to be transmitted by the first functional module are respectively stored in the key field and the value field of the same storage unit in the preset memory structure.

[0068] S102: Transmit the target data object to a second functional module.

[0069] The second functional module and the first functional module are functional modules generated based on different programming languages.

[0070] The second functional module and the first functional module are functional modules implemented based on different programming languages. For example, the first functional module is implemented based on Java code, and the second functional module is implemented based on C++ code.

[0071] After the first functional module generates the target data object, the target data object is transmitted to the second functional module. There are multiple specific transmission methods. In an optional implementation, after the first functional module is called to generate the target data object based on the preset memory structure, the target data object is transmitted to the second functional module via network transmission.

[0072] In another optional implementation, after calling the first functional module to generate a target data object based on a preset memory structure, the target data object is stored in a preset storage area according to a file storage method, and the second functional module can obtain the transmitted data from the preset storage area based on the file storage address.

[0073] The embodiment of the present disclosure does not limit the manner in which the first functional module transmits the target data object to the second functional module.

[0074] S103: Call the second function module to obtain value data corresponding to the target key data from the target data object, and perform type conversion on the value data according to the data type corresponding to the second function module to obtain converted value data corresponding to the target key data.

[0075] In actual applications, since the key-value data is stored in the storage unit of the preset memory structure, the embodiment of the present disclosure supports the second functional module to obtain the target key-value data from the target data object. In other words, the second functional module does not need to obtain the full amount of the target data object.

[0076] The target key data is the key data in the target key value data that the second functional module needs to obtain. The target key data is used to obtain the corresponding value data.

[0077] In an optional implementation, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to determine the storage unit corresponding to the target key data in the preset memory structure from the target data object based on the target key data, and then, based on the storage unit, obtain the value data corresponding to the target key data from the value field in the storage unit.

[0078] In practical applications, in order to improve the efficiency of determining the storage unit corresponding to the target key data from the target data object, the preset memory structure in the embodiment of the present disclosure also includes a data header, which includes a data volume field, and the data volume field is used to store the number of key-value pairs of the key-value data.

[0079] Specifically, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to obtain the number of key-value pairs stored in the data volume field from the target data object, and then, based on the number of key-value pairs, the storage unit corresponding to the target key data is found in the storage unit of the target data object.

[0080] Among them, based on the number of key-value pairs, the storage unit corresponding to the target key data is searched in the storage unit of the target data object. Specifically, based on the number of key-value pairs, the storage unit corresponding to the target key data can be searched in the storage unit of the target data object using binary search.

[0081] As mentioned above Figure 2 The preset memory structure 201 shown includes a data header, and the data header includes a data amount field 206 .

[0082] In actual applications, in order to avoid reading the data stored in the target data object from the end of the target data object, which may cause inaccurate data reading, the data header in the preset memory structure in the embodiment of the present disclosure also includes a start identification field, which is used to store the data reading start identification of the target data object. The start identification field can be set at the first position in the data header, such as the first two bytes of the data header. Figure 2 The preset memory structure 201 shown includes a data header, and the data header includes a start identification field 207 .

[0083] In an optional implementation, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to detect whether the starting position of the data header of the target data object is the starting identification field. If it is determined that the starting position of the target data object is the starting identification field, it indicates that the target data object is currently being read from the header, and the second functional module can be called to continue to perform subsequent operations.

[0084] In another optional implementation, if it is determined that the starting position of the target data object is not the starting identification field, it indicates that the current position is the tail of the target data object, and the second function module is called to perform subsequent operations from the other end (head) of the target data object.

[0085] The data transmission method provided by the embodiment of the present disclosure specifically comprises: first, calling a first function module to generate a target data object based on a preset memory structure, wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data; then, the target data object is transmitted to a second function module, wherein the second function module and the first function module are function modules generated based on different programming languages; further, calling the second function module to obtain value data corresponding to the target key data from the target data object, and performing type conversion processing on the value data according to the data type corresponding to the second function module, to obtain converted value data corresponding to the target key data.

[0086] It can be seen that the embodiment of the present disclosure utilizes a preset memory structure common to functional modules developed in different programming languages ​​to store transmission data to generate a target data object. By transmitting the target data object, the second functional module can obtain the value data corresponding to the required target key data from the target data object, without the need to perform full serialization and deserialization processing on the transmission data, thereby improving the overall data transmission efficiency between functional modules developed in different programming languages.

[0087] In actual applications, since the length of the data type of the key-value data to be transmitted by the first functional module is not unique, and the length of the value data stored in the storage unit of the preset memory structure is preset, that is, the length of the value data stored in the storage unit of the preset memory structure is fixed, for example, the length of the value field in the storage unit is 8 bytes.

[0088] Therefore, when the length of the data type of the value data in the key-value data to be transmitted by the first functional module exceeds the length of the value data stored in the storage unit of the preset memory structure, the value data can be stored in a dynamic data field, wherein the dynamic data field can be a part included in the preset memory structure in the embodiment of the present disclosure, and the length of the dynamic data field can change with the change of the length of the data type of the value data.

[0089] As mentioned above Figure 2 The preset memory structure 201 shown includes dynamic data fields.

[0090] In an optional implementation, the value data in the key-value data to be transmitted by the first functional module whose data type is the target data type can be stored in the value field of the storage unit, and the value data in the key-value data whose data type is a non-target data type can be stored in the dynamic data field of a preset memory structure.

[0091] The data type of the value data of the target data type has a fixed length and is smaller than the length of the value field in the storage unit. The target data type may include a basic data type, which may include integer types such as byte, short, int, long, and floating point types such as float and double. The non-target data type may be a non-basic data type, and the length of the non-target data type is not unique.

[0092] On the basis of the above embodiment, in order to determine the data type of the key-value data to be transmitted by the first functional module, the storage unit of the preset memory in the embodiment of the present disclosure may also include a data type field. That is, each storage unit includes a key field, a value field, and a data type field, and the data type field is used to store the data type information of the value data in the storage unit of the preset memory, and the data type information is used to indicate the storage location of the value data. As described above Figure 2 The preset memory structure 201 shown includes a data type field 208 .

[0093] Specifically, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to determine the storage unit corresponding to the target key data from the target data object based on the target key data, and then, obtain the data type information corresponding to the value data in the storage unit from the data type field in the storage unit, and then obtain the value data corresponding to the target key data according to the storage location identified by the data type information.

[0094] In an optional implementation, the storage location identified by the data type information stored in the data type field in the storage unit of the target data object may include a value field in the storage unit. If the storage location identified by the data type information stored in the data type field indicates a value field of the storage unit, it can be represented that the value field in the storage unit currently stores value data corresponding to the target key data.

[0095] In another optional implementation, the storage location identified by the data type information stored in the data type field in the storage unit of the target data object may also include a dynamic data field in a preset memory structure. If the storage location identified by the data type information stored in the data type field indicates a dynamic data field in a preset memory structure, it can be represented that the value field in the storage unit currently does not store the value data corresponding to the target key data. At this time, the dynamic data field in the preset memory structure stores the value data.

[0096] In actual applications, when the storage location identified by the data type information stored in the data type field in the storage unit of the target data object is indicated as a dynamic data field in a preset memory structure, in order to obtain the value data corresponding to the target key data in the dynamic data field, the value field in the storage unit in the preset memory structure in the embodiment of the present disclosure can also be used to store the storage location information of the value data of the non-target data type in the dynamic data field.

[0097] The storage location information of the dynamic data field stored in the value field of the storage unit may include the starting location and the ending location of the value data in the dynamic data field.

[0098] In an optional implementation, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to determine the storage unit corresponding to the target key data from the target data object based on the target key data, and then obtain the data type information corresponding to the value data in the storage unit from the data type field in the storage unit. If the storage position identified by the data type information indicates the value field in the storage unit, the value data corresponding to the target key data is obtained from the value field of the storage unit.

[0099] In another optional implementation, after obtaining the target data object generated by the first functional module based on the preset memory structure, the second functional module is called to determine the storage unit corresponding to the target key data from the target data object based on the target key data, and then obtain the data type information corresponding to the value data in the storage unit from the data type field in the storage unit. If the storage position identified by the data type information indicates a dynamic data field in the preset memory structure, the storage location information of the value data corresponding to the target key data is obtained from the value field in the storage unit, and the value data corresponding to the target key data is obtained from the dynamic data field according to the storage location information.

[0100] In order to implement the above embodiments, the present disclosure also proposes a data transmission device. Figure 3 This is a schematic diagram of the structure of a data transmission device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 3 As shown, the device comprises:

[0101] A generation module 301 is used to call the first function module to generate a target data object based on a preset memory structure; wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data;

[0102] A transmission module 302, configured to transmit the target data object to a second function module; wherein the second function module and the first function module are function modules generated based on different programming languages;

[0103] The acquisition module 303 is used to call the second function module to obtain the value data corresponding to the target key data from the target data object, and perform type conversion on the value data according to the data type corresponding to the second function module to obtain the converted value data corresponding to the target key data.

[0104] In an optional implementation manner, the generating module is specifically used to:

[0105] The first function module is called to write the key data in the key-value data into the key field of the storage unit in the preset memory structure, and write the value data in the key-value data into the value field of the storage unit to obtain the target data object.

[0106] In an optional implementation, the acquisition module includes:

[0107] A first determining submodule, configured to call the second functional module to determine a storage unit corresponding to target key data from the target data object;

[0108] The first acquisition submodule is used to acquire value data corresponding to the target key data based on the value field in the storage unit.

[0109] In an optional implementation manner, the preset memory structure further includes a data header, the data header includes a data volume field, and the data volume field is used to store the number of key-value pairs in the key-value data; the first determination module includes:

[0110] A second acquisition submodule, used for calling the second function module to acquire the number of key-value pairs stored in the data volume field in the data header from the target data object;

[0111] A search submodule is used to search for a storage unit corresponding to the target key data in the storage unit of the target data object based on the number of the key-value pairs.

[0112] In an optional implementation, the storage unit further includes a data type field, and the data type field is used to store data type information of the value data in the storage unit, and the data type information is used to identify a storage location of the value data.

[0113] In an optional implementation manner, the first acquisition submodule includes:

[0114] A second determination submodule, configured to call the second function module to determine a storage unit corresponding to target key data from the target data object;

[0115] The third acquisition submodule is used to obtain data type information from the data type field in the storage unit, and obtain value data corresponding to the target key data according to the storage location identified by the data type information.

[0116] In an optional implementation, the storage location identified by the data type information includes a value field in the storage unit, and the value field in the storage unit is used to store value data of the target data type;

[0117] or,

[0118] The storage location of the data type information identifier includes a dynamic data field in the preset memory structure;

[0119] The dynamic data field in the preset memory structure is used to store value data of non-target data types.

[0120] In an optional implementation manner, the third acquisition submodule includes:

[0121] a fourth acquisition submodule, configured to acquire value data corresponding to the target key data from the value field when the storage position indicates a value field in the storage unit;

[0122] The fifth acquisition submodule is used to obtain storage location information from the value field in the storage unit if the storage location indicates a dynamic data field in the preset memory structure, and obtain value data corresponding to the target key data from the dynamic data field according to the storage location information.

[0123] In an optional implementation manner, the data header further includes a start identification field, and the start identification field is used to store a data reading start identification of the target data object.

[0124] In the data transmission device provided by the embodiment of the present disclosure, first, a first functional module is called to generate a target data object based on a preset memory structure, wherein the target data object includes key-value data stored based on the preset memory structure, and the preset memory structure includes at least one storage unit, and the storage unit includes a key field and a value field, the key field is used to store the key data in the key-value data, and the value field is used to store the value data corresponding to the key data, and then, the target data object is transmitted to a second functional module, wherein the second functional module and the first functional module are functional modules generated based on different programming languages, and then, the second functional module is called to obtain the value data corresponding to the target key data from the target data object, and type conversion is performed on the value data according to the data type corresponding to the second functional module to obtain the converted value data corresponding to the target key data.

[0125] It can be seen that the embodiment of the present disclosure utilizes a preset memory structure common to functional modules developed in different programming languages ​​to store transmission data to generate a target data object. By transmitting the target data object, the second functional module can obtain the value data corresponding to the required target key data from the target data object, without the need to perform full serialization and deserialization processing on the transmission data, thereby improving the overall data transmission efficiency between functional modules developed in different programming languages.

[0126] The data transmission device provided in the embodiments of the present disclosure can execute the data transmission method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0127] In order to implement the above embodiments, the present disclosure further proposes a computer program product, including a computer program / instruction, which implements the data transmission method in the above embodiments when executed by a processor.

[0128] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the data transmission method described in the embodiments of the present disclosure.

[0129] In addition, the present disclosure also provides a data transmission device, see Figure 4 As shown, it may include:

[0130] Processor 401, memory 402, input device 403 and output device 404. The number of processors 401 in the data transmission device can be one or more. Figure 4 In some embodiments of the present disclosure, the processor 401, the memory 402, the input device 403 and the output device 404 may be connected via a bus or other means, wherein: Figure 4 The example of connecting through bus is taken in the following.

[0131] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing of the data transmission device by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 403 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the data transmission device.

[0132] Specifically in this embodiment, the processor 401 will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 will run the applications stored in the memory 402, thereby realizing the various functions of the above-mentioned data transmission device.

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

[0134] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data transmission method, characterized in that: include: Calling a first function module to generate a target data object based on a preset memory structure; wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data; Transmitting the target data object to a second functional module; wherein the second functional module and the first functional module are functional modules generated based on different programming languages; The second function module is called to obtain value data corresponding to the target key data from the target data object, and the value data is type-converted according to the data type corresponding to the second function module to obtain converted value data corresponding to the target key data.

2. The method according to claim 1, characterized in that The calling of the first function module to generate a target data object based on a preset memory structure includes: The first function module is called to write the key data in the key-value data into the key field of the storage unit in the preset memory structure, and write the value data in the key-value data into the value field of the storage unit to obtain the target data object.

3. The method according to claim 1, characterized in that The calling of the second function module to obtain value data corresponding to the target key data from the target data object includes: Calling the second function module to determine the storage unit corresponding to the target key data from the target data object; Based on the value field in the storage unit, value data corresponding to the target key data is obtained.

4. The method according to claim 3, characterized in that The preset memory structure further includes a data header, the data header includes a data volume field, and the data volume field is used to store the number of key-value pairs in the key-value data; the calling of the second function module to determine the storage unit corresponding to the target key data from the target data object includes: Calling the second function module to obtain the number of key-value pairs stored in the data volume field in the data header from the target data object; Based on the number of key-value pairs, a storage unit corresponding to the target key data is searched in the storage unit of the target data object.

5. The method according to claim 1, characterized in that The storage unit also includes a data type field, and the data type field is used to store data type information of the value data in the storage unit, and the data type information is used to identify the storage location of the value data.

6. The method according to claim 5, characterized in that The calling of the second function module to obtain value data corresponding to the target key data from the target data object includes: Calling the second function module to determine the storage unit corresponding to the target key data from the target data object; The data type information is obtained from the data type field in the storage unit, and the value data corresponding to the target key data is obtained according to the storage location identified by the data type information.

7. The method according to claim 6, characterized in that The storage location identified by the data type information includes a value field in the storage unit, and the value field in the storage unit is used to store value data of the target data type; or, The storage location of the data type information identifier includes a dynamic data field in the preset memory structure; The dynamic data field in the preset memory structure is used to store value data of non-target data types.

8. The method according to claim 7, characterized in that The acquiring, according to the storage location identified by the data type information, value data corresponding to the target key data comprises: If the storage location indicates a value field in the storage unit, obtaining value data corresponding to the target key data from the value field; If the storage location indicates a dynamic data field in the preset memory structure, the storage location information is obtained from the value field in the storage unit, and the value data corresponding to the target key data is obtained from the dynamic data field according to the storage location information.

9. The method according to claim 4, characterized in that The data header also includes a start identification field, and the start identification field is used to store a data reading start identification of the target data object.

10. A data transmission device, characterized in that: The device comprises: A generating module, configured to call the first function module to generate a target data object based on a preset memory structure; wherein the target data object includes key-value data stored based on the preset memory structure, the preset memory structure includes at least one storage unit, the storage unit includes a key field and a value field, the key field is used to store key data in the key-value data, and the value field is used to store value data corresponding to the key data; A transmission module, used for transmitting the target data object to a second function module; wherein the second function module and the first function module are function modules generated based on different programming languages; An acquisition module is used to call the second function module to obtain the value data corresponding to the target key data from the target data object, and perform type conversion on the value data according to the data type corresponding to the second function module to obtain the converted value data corresponding to the target key data.

11. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the data transmission method described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the data transmission method described in any one of claims 1 to 9.

13. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • Data transmission method and apparatus, device, and storage medium

    WO2026060947A1