Data processing method, storage medium and equipment

By packaging the database file meta information into a byte stream and storing it in a preset list, the problem of excessive memory usage during the physical backup of the database is solved, efficient data storage and rapid search are achieved, and system performance is improved.

CN119883121APending Publication Date: 2025-04-25CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411959723.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

During the physical backup of the database, the memory occupied by the maintained file meta information list will increase in multiple orders as the database stores files increase, resulting in a decline in operating system performance or even crash.

Method used

By obtaining the data and data types of the data structure to be packaged, packaging them into a byte stream, and recording the index value in the byte stream, and storing it into a preset list, to achieve efficient storage of the data structure.

Benefits of technology

This method greatly saves physical memory consumption, ensures the consistency of data in storage and reading, and improves the convenience of data search and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883121A_ABST
    Figure CN119883121A_ABST
Patent Text Reader

Abstract

The invention relates to a database technology, in particular to a data processing method, a storage medium and equipment. The data processing method comprises the steps of obtaining data of a to-be-packaged data structure and a data type of the data; data of the to-be-packaged data structure is packaged into a byte stream, and an index value corresponding to the to-be-packaged data structure is recorded in the byte stream; the byte stream is stored in a preset list, and the preset list is used for storing the byte stream obtained by packaging the multiple data structures. According to the data processing method, the data structure is stored in the form of the byte stream, the index value is set in the byte stream to facilitate subsequent search, the problem that too much memory is occupied due to the fact that the data structure is stored in the modes of arrays, links and the like is avoided, consumption of physical memory is saved under the condition that the data is convenient to search, and the data processing efficiency is improved. And the cost is reduced, so that the normal operation of the operating system is ensured, and the performance of the whole system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to database technology, and in particular to a data processing method, storage medium and device. Background Art

[0002] When backing up a database physically, it is necessary to maintain the metadata of all backup files in memory. The metadata of backup files usually includes the attribute information of the backup files, such as the creator, creation date, modification date, size, permissions, type, etc. The metadata of each file usually exists as a common data structure, and the data structure of the metadata corresponding to each file is connected in series using arrays, links, etc.

[0003] However, as the database continues to run, the files stored in the database will increase and increase. When doing physical backup, the memory occupied by the maintained file meta information list will increase. Similar situations also exist in other fields. The bytes occupied by the elements in the list may only be tens or hundreds of bytes, but when the list length increases, the memory occupied by the entire list increases exponentially. Excessive memory usage will affect the normal operation of the operating system, reduce the performance of the entire system, and in severe cases, cause the operating system to freeze and crash.

[0004] The usual solution is to increase the physical memory of the operating system or to increase the swap partition of the operating system, but the former increases costs and the latter reduces the efficiency of system operation because the hard disk is used to simulate physical memory. Summary of the invention

[0005] In view of the above problems, a data processing method, a storage medium and a device are proposed to overcome the above problems or at least partially solve the above problems.

[0006] An object of the present invention is to provide a data processing method that can save consumption of physical memory.

[0007] A further object of the present invention is to improve the convenience of retrieval.

[0008] Another further object of the present invention is to ensure data integrity.

[0009] According to one aspect of the present invention, the present invention provides a data processing method, comprising:

[0010] Get the data of the data structure to be packaged and the data type of the data;

[0011] Packing the data of the data structure to be packed into a byte stream, wherein the byte stream records the index value corresponding to the data structure to be packed;

[0012] The byte stream is stored in a preset list, wherein the preset list is used to store the byte stream obtained by packaging multiple data structures.

[0013] Optionally, the byte stream has an index area and a data area arranged in sequence, the index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type; and

[0014] The steps of packaging the data of the data structure to be packaged into a byte stream include:

[0015] Obtain the index value corresponding to the data structure to be packaged and store it in the index area;

[0016] Based on the data type of the data of the data structure to be packaged, encoding the data and the data type of the data structure to be packaged in a preset order;

[0017] All the encoded data are merged into the data area to obtain a packaged byte stream.

[0018] Optionally, the data type of the data in the data structure to be packed includes at least one or more of the following data types: Boolean type, integer type, floating point type, character type and pointer type; and

[0019] Based on the data type of the data of the data structure to be packaged, the step of encoding the data and the data type of the data structure to be packaged in a preset order includes:

[0020] At least one field of integer type is set, wherein each field is used to store data of Boolean type and / or pointer type in the data structure to be packed;

[0021] Get the length information of the data whose data type is character type in the data structure to be packed;

[0022] Convert and / or maintain all data types except Boolean type, pointer type and character type in the data structure to be packed into integer type data;

[0023] The data, length information, character type data, and integer type data obtained by conversion and / or maintenance of each field are encoded in sequence.

[0024] Optionally, after the step of storing the byte stream in a preset list, the data processing method further comprises:

[0025] In response to a modification instruction to a target data structure, obtaining an index value of the target data structure;

[0026] Based on the index value of the target data structure, the byte stream to be unpacked corresponding to the target data structure is searched in the list;

[0027] Perform unpacking operation on the byte stream to be unpacked to obtain the target data structure after unpacking.

[0028] Optionally, based on the index value of the target data structure, the step of searching in the list to obtain a byte stream to be unpacked corresponding to the target data structure includes:

[0029] Read the data recorded in the index area of ​​each byte stream in the list to obtain the index value recorded in each byte stream;

[0030] Compare the index value of the target data structure with the index value recorded in each byte stream to obtain multiple comparison results;

[0031] Get the byte stream where the index value with the consistent comparison result is located as the byte stream to be unpacked.

[0032] Optionally, the step of performing an unpacking operation on the byte stream to be unpacked to obtain a target data structure after unpacking includes:

[0033] Split the byte stream to be unpacked into an index area and a data area;

[0034] The data in the data area of ​​the byte stream to be unpacked is decoded in a preset order to obtain a target data structure after unpacking.

[0035] Optionally, after the step of performing an unpacking operation on the byte stream to be unpacked to obtain the unpacked target data structure, the data processing method further includes:

[0036] Based on the modification instruction, modify the data of the unpacked target data structure;

[0037] Repack the modified data of the target data structure into a byte stream;

[0038] Update the repackaged byte stream into the list.

[0039] Optionally, the data of the packed data structure is stored in a byte stream in the form of integers, each integer occupies at least one byte in the byte stream, and the highest bit of each byte is used to indicate whether the byte is the last byte occupied by the integer to which the byte belongs.

[0040] According to another aspect of the present invention, a machine-readable storage medium is provided, on which a machine-executable program is stored. When the machine-executable program is executed by a processor, any of the above-mentioned data processing methods is implemented.

[0041] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the above data processing methods when executing the machine executable program.

[0042] The data processing method of the present invention, by obtaining the data of the data structure to be packaged and the data type of the data, packages the data of the data structure to be packaged into a byte stream, and stores the byte stream in a preset list, realizes the storage of the data structure in the form of a byte stream, and greatly saves the consumption of physical memory. In addition, the data processing method of the present invention can also ensure the consistency of data during storage and reading by recording the index value corresponding to the data structure to be packaged in the byte stream, and the index value can be used to quickly locate the position of the byte stream in the list, thereby avoiding the problem of data misalignment or confusion, and ensuring the integrity of the data record and the convenience of searching. Therefore, the data processing method of the present invention stores the data structure and the corresponding index value in the form of a byte stream, realizing that while ensuring the convenience of data searching, the consumption of physical memory is saved, and the problem of excessive memory occupation caused by storing data structures in arrays, links, etc. is avoided, thereby reducing the operating cost, thereby ensuring the normal operation of the operating system, and then improving the performance of the entire system.

[0043] Furthermore, the byte stream in the data processing method of the present invention has an index area and a data area arranged in sequence, the index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type, so that the index value is recorded in the first field of the byte stream, which further improves the speed of locating the position of the byte stream in the list, and further improves the convenience of data search. Accordingly, the data processing method of the present invention obtains the index value corresponding to the data structure to be packaged and stores it in the index area, encodes the data and data type of the data structure to be packaged in a preset order based on the data type of the data of the data structure to be packaged, and merges all the data obtained after encoding into the data area to obtain the packaged byte stream, so as to orderly encode the index value and data sequence of the data structure to be packaged into the byte stream, so as to ensure that the index value is recorded in the first field of the byte stream, thereby further ensuring the convenience of data search, and also further ensuring the integrity of the data.

[0044] Furthermore, the data processing method of the present invention obtains the index value of the target data structure in response to the modification instruction of the target data structure, searches the list for the byte stream to be unpacked corresponding to the target data structure based on the index value of the target data structure, and unpacks the byte stream to be unpacked to obtain the unpacked target data structure, thereby realizing the rapid positioning and accurate acquisition of the data to be modified, thereby further ensuring data integrity.

[0045] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0047] Figure 1 is a flow chart of a data processing method according to an embodiment of the present invention;

[0048] Figure 2 is a flowchart of a packaging operation of a data processing method according to an embodiment of the present invention;

[0049] Figure 3 is a flow chart of a data processing method according to another embodiment of the present invention;

[0050] Figure 4 is a schematic diagram of the structure of a machine-readable storage medium according to an embodiment of the present invention; and

[0051] Figure 5 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0052] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0053] In order to solve the above technical problem, an embodiment of the present invention proposes a data processing method. Figure 1 FIG. 1 is a schematic flow chart of a data processing method according to an embodiment of the present invention. Figure 1 As shown, the data processing method may generally include:

[0054] Step S102, obtaining data of the data structure to be packaged and the data type of the data. It should be noted that the data in the data structure in this step may include data of multiple different data types.

[0055] Step S104, packaging the data of the data structure to be packaged into a byte stream, wherein the byte stream records an index value corresponding to the data structure to be packaged;

[0056] Step S106, storing the byte stream in a preset list, wherein the preset list is used to store the byte stream obtained by packaging multiple data structures.

[0057] The data processing method of the present invention, by obtaining the data of the data structure to be packaged and the data type of the data, packages the data of the data structure to be packaged into a byte stream, and stores the byte stream in a preset list, realizes the storage of the data structure in the form of a byte stream, and greatly saves the consumption of physical memory. In addition, the data processing method of the present invention can also ensure the consistency of data during storage and reading by recording the index value corresponding to the data structure to be packaged in the byte stream, and the index value can be used to quickly locate the position of the byte stream in the list, thereby avoiding the problem of data misalignment or confusion, and ensuring the integrity of the data record and the convenience of searching. Therefore, the data processing method of the present invention stores the data structure and the corresponding index value in the form of a byte stream, realizing that while ensuring the convenience of data searching, the consumption of physical memory is saved, and the problem of excessive memory occupation caused by storing data structures in arrays, links, etc. is avoided, thereby reducing the operating cost, thereby ensuring the normal operation of the operating system, and then improving the performance of the entire system.

[0058] In some embodiments, each data structure can be used to store the meta information of a backup file, and the meta information of each file is stored in a different data structure. Accordingly, the data of the data structure can be all the meta information of a backup file. The meta information of a backup file generally refers to the attribute information of the file, for example, it can include one or more of the creator, creation date, modification date, size, permissions, type, etc. of the file. Therefore, the data in the data structure of the present invention can also include data of multiple different data types.

[0059] In some embodiments, a byte stream is a data stream that performs IO operations in bytes. Specifically, the byte stream has an index area and a data area arranged in sequence, the index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type. Therefore, the index value can be recorded in the first field of the byte stream, which improves the speed of locating the position of the byte stream in the list and further improves the convenience of data search.

[0060] Furthermore, the above-mentioned step S104 may include the following steps: obtaining an index value corresponding to the data structure to be packaged and storing it in the index area; encoding the data and data type of the data structure to be packaged in a preset order based on the data type of the data in the data structure to be packaged; merging all the data obtained after encoding into the data area to obtain a packaged byte stream.

[0061] Therefore, the data processing method of the present invention realizes orderly data encoding and ensures data integrity by encoding the index value, the data of the data structure to be packaged and the data type into the byte stream according to a preset order, while ensuring that the index value is recorded in the first field of the byte stream, thereby further ensuring the convenience of data search.

[0062] In some embodiments, the data type of the data of the data structure to be packaged may include at least one or more of the following data types: Boolean type, integer type, floating point type, character type and pointer type. Accordingly, based on the data type of the data structure to be packaged, the step of encoding the data and data type of the data structure to be packaged in a preset order may include the following steps: setting at least one integer type field, wherein each field is used to store data of the Boolean type and / or pointer type in the data structure to be packaged; obtaining the length information of the data of the character type in the data structure to be packaged; converting and / or maintaining all data types of the data structure to be packaged except the Boolean type, pointer type and character type into integer type data; encoding the data, length information, character type data of each field and the integer type data obtained by conversion and / or maintenance in sequence.

[0063] Therefore, the data processing method of the present invention can classify various types of data according to the data type and process them in sequence. For a large amount of similar data, due to having similar fields and data types, encoding processing can be performed simultaneously, effectively reducing the duplication of labor in the encoding process and improving the packaging efficiency. At the same time, the data processing method of the present invention realizes the orderly processing of various different types of data, ensures the integrity of the packaged data, and thus improves the overall performance and reliability of the system.

[0064] In some embodiments, after step S106, the data processing method of the present invention may further include the following steps: corresponding to the modification instruction of the target data structure, obtaining the index value of the target data structure; based on the index value of the target data structure, searching in the list to obtain the byte stream to be unpacked corresponding to the target data structure; performing an unpacking operation on the byte stream to be unpacked to obtain the unpacked target data structure.

[0065] Therefore, the data processing method of the present invention obtains the index value of the target data structure in response to the modification instruction of the target data structure, searches the list for the byte stream to be unpacked corresponding to the target data structure based on the index value of the target data structure, and unpacks the byte stream to be unpacked to obtain the unpacked target data structure, thereby realizing the rapid positioning and accurate acquisition of the data to be modified, thereby further ensuring the data integrity.

[0066] In some embodiments, the above-mentioned step of searching in the list based on the index value of the target data structure to obtain the byte stream to be unpacked corresponding to the target data structure may include the following steps: reading the data recorded in the index area of ​​each byte stream in the list to obtain the index value recorded in each byte stream; comparing the index value of the target data structure with the index value recorded in each byte stream to obtain multiple comparison results; obtaining the byte stream where the index value with the consistent comparison result is located as the byte stream to be unpacked.

[0067] Therefore, the data processing method of the present invention obtains the index value by reading the data recorded in the index area, and can quickly locate the byte stream to be unpacked corresponding to the target data structure in the list, avoiding traversing the entire list to find the target data, thereby significantly improving the efficiency of data retrieval.

[0068] In some embodiments, the above-mentioned step of unpacking the byte stream to be unpacked to obtain the target data structure after unpacking may include the following steps: splitting the byte stream to be unpacked into an index area and a data area; decoding the data in the data area of ​​the byte stream to be unpacked in a preset order to obtain the target data structure after unpacking.

[0069] Specifically, the step of decoding the data in the data area of ​​the byte stream to be unpacked in a preset order to obtain the target data structure after unpacking refers to: decoding each field in the data structure stored in the form of the byte stream to be unpacked in sequence according to the encoding method and the encoding order of each field of the data structure. That is to say, during the decoding process, the Boolean type value, whether the pointer is NULL, decoding to obtain the length of the character array and copying the content of the character array, and decoding other fields in sequence are sequentially decoded in the order of the encoding process.

[0070] Therefore, the data processing method of the present invention can ensure that each field of the data structure is correctly decoded by decoding according to the encoding method and field encoding order, avoiding decoding errors caused by encoding method mismatch or field order error, effectively maintaining the integrity and accuracy of data acquisition, and providing a reliable basis for subsequent data processing and analysis.

[0071] In some embodiments, after the above step of performing an unpacking operation on the byte stream to be unpacked to obtain the unpacked target data structure, the data processing method of the present invention may further include the following steps: modifying the data of the unpacked target data structure based on the modification instruction; repackaging the data of the modified target data structure into a byte stream; and updating the repacked byte stream into a list. Specifically, updating the repacked byte stream into a list means mounting the repacked byte stream into a list and releasing the old byte stream with the same index value in the list.

[0072] In this way, accurate modification of the data that needs to be modified is achieved. At the same time, the modified data is repackaged into a byte stream and updated in the list, ensuring that the data structure can still be stored in the form of a byte stream during subsequent storage and transmission, further ensuring system performance.

[0073] In some embodiments, the data of the packaged data structure is stored in a byte stream in the form of integers, each integer occupies at least one byte in the byte stream, and the most significant bit (MSB) of each byte is used to indicate whether the byte is the last byte occupied by the integer to which the byte belongs. Specifically, the MSB of each byte is used to indicate whether there are subsequent bytes to represent the integer. If the MSB is 1, it means that the subsequent bytes are still part of the integer. If the MSB is 0, it means that the current byte is the last byte of the integer. In addition to the most significant bit, the remaining 7 bits are used to represent a part of the integer. Therefore, each byte can represent 7 bits of valid data.

[0074] Therefore, the data processing method of the present invention can effectively represent a wide range of integers by allowing integers to be stored in a byte stream in a variable-length encoding manner and using the highest bit of each byte as an end mark, thereby achieving efficient integer storage and transmission.

[0075] In addition, compared with fixed-length encoding, the data processing method of the present invention can dynamically allocate byte length according to the size of the integer value, without the need to allocate fixed storage space for integers of each size, which significantly saves storage space and greatly improves data storage and reading efficiency.

[0076] In a specific implementation, this patent stores the metadata of the backup file in the form of a byte stream, and the data structure where the metadata of each backup file is located is packaged into a byte stream. Taking the data types of the data in the data structure including Boolean type, integer type, floating point type, character type and pointer type as an example, the specific technical solution is as follows:

[0077] 1. Packing: Pack the data structure into a byte stream, and the first few bytes of the byte stream are the index value of the data structure for easy search. The specific steps of packing include the following steps: (1) Add or select an index value as the first field of the packed byte stream; (2) Prepare one or more integer type fields, use bits as a representation of whether the Boolean type in the data structure is true, and use bits to indicate whether the pointer type in the data structure is NULL, and encode all the prepared integer type fields into the byte stream; (3) Finally, copy the character type into the byte stream (add the length code of the byte stream before copying), and force the remaining types to be converted to integer types (pointer types are memory addresses) and encode them into the byte stream.

[0078] 2. Unpacking: Decode each field of the data structure in sequence according to the encoding method and field encoding order.

[0079] 3. Add to the list: Encode the constructed data structure into a byte stream in the above way and mount it into the list.

[0080] 4. Retrieval: Each data structure is encoded into a byte stream and added to the list. It can be quickly retrieved through the index value of the byte stream header. After retrieving the target structure, it needs to be decoded into a specific data structure before it can be used.

[0081] 5. Modification: If you need to modify a data structure element in the list, you first need to retrieve the element, then decode it into a specific data structure, modify specific member variables, encode it into a byte stream again, mount the new byte stream into the list, and release the old byte stream.

[0082] It should be noted that the specific encoding method can be Base128 Varints encoding. In addition, Base128 Varints encoding is an encoding rule that divides integers into bytes. The specific encoding process of each data is not limited in the embodiment of the present application, as long as the data structure can be stored in the form of a byte stream.

[0083] Therefore, the data processing method of the present invention can have at least the following beneficial effects: (1) the metadata of the backup file whose data structure is an integer type is stored in the form of a byte stream, which saves the consumption of physical memory and reduces the cost; (2) the first field of the byte stream is used to store the index value of the metadata, which facilitates quick retrieval; (3) the sequential decoding of the byte stream is followed when encoding and decoding the data structure, ensuring the accuracy of data acquisition; (4) other types of data in the data structure are forcibly converted to integer types and encoded into the byte stream, ensuring the integrity of the data structure, while ensuring that all data are stored in the byte stream in the form of integers, further saving the consumption of physical memory.

[0084] Figure 2 1 is a flow chart of a packaging operation according to a data processing method according to an embodiment of the present invention. Figure 2 , taking the data types of the data in the data structure to be packed including Boolean type, integer type, floating point type, character type and pointer type as an example, the process steps of the packing operation of this embodiment are specifically described.

[0085] Step S202, obtaining data of the data structure to be packaged and the data type of the data.

[0086] Step S204, adding or selecting a corresponding index value for the data structure to be packaged as the first field of the packaged byte stream.

[0087] Step S206, encoding the data of the Boolean type and the pointer type in the data structure to be packed.

[0088] Step S208, encoding the length information of the data whose data type is character type in the data structure to be packed.

[0089] Step S210, encoding the character data in the data structure to be packed.

[0090] Step S212, converting the floating point data in the data structure to be packed into integer data.

[0091] Step S214, encoding the integer type data.

[0092] Step S216: merge the data obtained by the encoding process to obtain a packaged byte stream. At this point, this process ends.

[0093] The data processing method of the present invention, by obtaining the data of the data structure to be packaged and the data type of the data, packages the data of the data structure to be packaged into a byte stream, and stores the byte stream in a preset list, realizes the storage of the data structure in the form of a byte stream, and greatly saves the consumption of physical memory. In addition, the data processing method of the present invention can also ensure the consistency of data during storage and reading by recording the index value corresponding to the data structure to be packaged in the byte stream, and the index value can be used to quickly locate the position of the byte stream in the list, thereby avoiding the problem of data misalignment or confusion, and ensuring the integrity of the data record and the convenience of searching. Therefore, the data processing method of the present invention stores the data structure and the corresponding index value in the form of a byte stream, realizing that while ensuring the convenience of data searching, the consumption of physical memory is saved, and the problem of excessive memory occupation caused by storing data structures in arrays, links, etc. is avoided, thereby reducing the operating cost, thereby ensuring the normal operation of the operating system, and then improving the performance of the entire system.

[0094] Furthermore, the byte stream in the data processing method of the present invention has an index area and a data area arranged in sequence, the index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type, so that the index value is recorded in the first field of the byte stream, which further improves the speed of locating the position of the byte stream in the list, and further improves the convenience of data search. In addition, the data processing method of the present invention obtains the index value corresponding to the data structure to be packaged and stores it in the index area, and encodes the data and data type of the data structure to be packaged in a preset order based on the data type of the data of the data structure to be packaged, and merges all the data obtained after encoding into the data area to obtain the packaged byte stream, so as to orderly encode the index value and data sequence of the data structure to be packaged into the byte stream, so as to ensure that the index value is recorded in the first field of the byte stream, thereby further ensuring the convenience of data search, and also further ensuring the integrity of the data.

[0095] Figure 3 FIG. 1 is a flow chart of a data processing method according to another embodiment of the present invention. Figure 3 , the process steps of this embodiment are specifically described.

[0096] Step S302, obtaining data of the data structure to be packaged and the data type of the data.

[0097] Step S304, adding or selecting a corresponding index value for the data structure to be packaged as the first field of the packaged byte stream.

[0098] Step S306 , based on the data type of the data in the data structure to be packaged, encoding processing is performed on the data and data type of the data structure to be packaged in a preset order.

[0099] Step S308, merging all the data obtained after encoding into the data area to obtain a packaged byte stream.

[0100] Step S310, storing the packaged byte stream into a preset list.

[0101] Step S312, determine whether the data structure in the list needs to be modified, if so, proceed to step S314, if not, end this process.

[0102] Step S314, obtaining the index value of the target data structure to be modified.

[0103] Step S316: Based on the index value of the target data structure, search in the list to obtain the byte stream to be unpacked corresponding to the target data structure.

[0104] Step S318, decoding the data in the data area of ​​the byte stream to be unpacked according to a preset order to obtain a target data structure after unpacking.

[0105] Step S320, modifying the data of the unpacked target data structure.

[0106] Step S322, repackaging the data of the modified target data structure into a byte stream.

[0107] Step S324, the repackaged byte stream is updated into the list, and the process returns to step S312. At this point, this process ends.

[0108] Therefore, the data processing method of the present invention stores the data structure and the corresponding index value in the form of a byte stream, thereby ensuring the convenience of data search while saving the consumption of physical memory, avoiding the problem of excessive memory usage caused by storing data structures in arrays, links, etc., thereby reducing operating costs, thereby ensuring the normal operation of the operating system, and further improving the performance of the entire system.

[0109] Furthermore, the byte stream in the data processing method of the present invention has an index area and a data area arranged in sequence. The index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type, thereby realizing recording the index value in the first field of the byte stream, further improving the speed of locating the position of the byte stream in the list, and further improving the convenience of data search.

[0110] Furthermore, the data processing method of the present invention obtains the index value of the target data structure in response to the modification instruction of the target data structure, searches the list for the byte stream to be unpacked corresponding to the target data structure based on the index value of the target data structure, and unpacks the byte stream to be unpacked to obtain the unpacked target data structure, thereby realizing the rapid positioning and accurate acquisition of the data to be modified, thereby further ensuring data integrity.

[0111] This embodiment also provides a machine-readable storage medium and a computer device. Figure 4 is a schematic diagram of the structure of a machine-readable storage medium 10 according to an embodiment of the present invention, Figure 5 is a schematic diagram of the structure of a computer device 20 according to an embodiment of the present invention.

[0112] The machine-readable storage medium 10 stores a machine-executable program 11 , and when the machine-executable program 11 is executed by a processor, the processing method of any of the above embodiments is implemented.

[0113] The computer device 20 may include a memory 220, a processor 210, and a machine executable program 11 stored in the memory 220 and running on the processor 210, and the processor 210 implements the processing method of any of the above embodiments when executing the machine executable program 11.

[0114] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.

[0115] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.

Claims

1. A data processing method, comprising: Acquire data of the data structure to be packaged and the data type of the data; Packing the data of the data structure to be packaged into a byte stream, wherein the byte stream records an index value corresponding to the data structure to be packaged; The byte stream is stored in a preset list, wherein the preset list is used to store byte streams obtained by packaging multiple data structures.

2. The data processing method according to claim 1, wherein: The byte stream has an index area and a data area arranged in sequence, the index area is used to record the index value, and the data area is used to record the data of the data structure to be packaged and its data type; and The step of packaging the data of the data structure to be packaged into a byte stream comprises: Obtaining an index value corresponding to the data structure to be packaged, and storing it in the index area; Based on the data type of the data of the data structure to be packaged, encoding the data of the data structure to be packaged and the data type in a preset order; All the data obtained after encoding are merged into the data area to obtain the packaged byte stream.

3. The data processing method according to claim 2, wherein: The data type of the data in the data structure to be packaged includes at least one or more of the following data types: Boolean type, integer type, floating point type, character type and pointer type; and The step of encoding the data of the data structure to be packaged and the data type in a preset order based on the data type of the data structure to be packaged comprises: Setting at least one field of integer type, wherein each of the fields is used to store data of Boolean type and / or pointer type in the data structure to be packaged; Obtaining length information of data whose data type is character type in the data structure to be packaged; Convert and / or maintain all data types except Boolean type, pointer type and character type in the data structure to be packed into integer type data; The data of each field, the length information, the character type data, and the integer type data obtained by conversion and / or maintenance are encoded in sequence.

4. The data processing method according to claim 2, wherein: After the step of storing the byte stream in a preset list, the data processing method further comprises: In response to a modification instruction to a target data structure, obtaining an index value of the target data structure; Based on the index value of the target data structure, searching in the list to obtain a byte stream to be unpacked corresponding to the target data structure; An unpacking operation is performed on the byte stream to be unpacked to obtain the target data structure after unpacking.

5. The data processing method according to claim 4, wherein: The step of searching the list for a byte stream to be unpacked corresponding to the target data structure based on the index value of the target data structure comprises: Read the data recorded in the index area of ​​each byte stream in the list to obtain the index value recorded in each byte stream; Comparing the index value of the target data structure with the index value recorded in each of the byte streams to obtain a plurality of comparison results; The byte stream where the index value having the consistent comparison result is located is obtained as the byte stream to be unpacked.

6. The data processing method according to claim 4, wherein: The step of performing an unpacking operation on the byte stream to be unpacked to obtain the unpacked target data structure comprises: Splitting the byte stream to be unpacked into the index area and the data area; The data in the data area of ​​the byte stream to be unpacked is decoded in the preset order to obtain the target data structure after unpacking.

7. The data processing method according to claim 4, wherein: After the step of performing an unpacking operation on the byte stream to be unpacked to obtain the unpacked target data structure, the data processing method further includes: Based on the modification instruction, modify the unpacked data of the target data structure; Repackaging the modified data of the target data structure into a byte stream; The repackaged byte stream is updated into the list.

8. The data processing method according to claim 1, wherein: The data of the packed data structure are stored in the byte stream in the form of integers, each of the integers occupies at least one byte in the byte stream, and the highest bit of each byte is used to indicate whether the byte is the last byte occupied by the integer to which the byte belongs.

9. A machine-readable storage medium having a machine-executable program stored thereon, wherein the machine-executable program, when executed by a processor, implements the data processing method according to any one of claims 1 to 8.

10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the data processing method according to any one of claims 1 to 8 when executing the machine executable program.