Data storage method, device, equipment, storage medium and computer program product
By converting frame data into bytecode of a specified number of bytes for serialization, the problem of wasted storage space in key-value pair storage is solved, achieving more efficient data storage.
Patent Information
- Application Number
- CN202210761475.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2042-06-29
AI Technical Summary
In existing technologies, the key-value pair storage method for frame data results in a large data volume for multiple frames with the same cache key value, placing a heavy burden on computer storage and leading to poor storage performance.
By determining the data format type of the frame data, it is converted into bytecode corresponding to a specified number of bytes and then serialized, replacing the key-value pair-based serialization process.
It reduces the space occupied by data storage, saves computer data storage bandwidth, and improves storage performance.
Smart Images

Figure CN117348792B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to a data storage method, apparatus, device, storage medium, and computer program product. Background Technology
[0002] Frame data refers to the collection of raw data generated for each frame during the operation of an application. Taking a game program as an example, frame data can be realized as interactive data generated during the current operation, such as engine performance data, real-time running data generated by the game program code, etc. The data generated by frame data is all code-level data.
[0003] In related technologies, the storage method for frame data is usually to use Extensible Markup Language (XML) to serialize the frame data and then store the corresponding serialization result. In the process of storing the serialization result, the frame data is usually stored through a distributed storage system (key-value pairs).
[0004] However, in the aforementioned related technologies, when frame data is stored in key-value pairs, multiple frames are distinguished by different cache values. As a result, multiple frames correspond to the same cache key during storage, leading to a large amount of data storage, which in turn results in a heavy computer storage burden and poor data storage performance. Summary of the Invention
[0005] This application provides a data storage method, apparatus, device, storage medium, and computer program product that can save data storage space. The technical solution is as follows:
[0006] On the one hand, a data storage method is provided, the method comprising:
[0007] Obtain a data set corresponding to a specified screen frame displayed during terminal operation, wherein the data set includes multiple associated data related to the specified screen frame;
[0008] Determine the data format type corresponding to the plurality of associated data in the data set;
[0009] Based on the data format types corresponding to the multiple associated data, the multiple associated data are converted into bytecode corresponding to a specified number of bytes, wherein the specified number of bytes corresponds to the data format type;
[0010] The bytecode obtained from the conversion of multiple related data is serialized and arranged to obtain the serialization result;
[0011] store the serialization processing result as a storage result of the data set corresponding to the specified picture frame, the storage result being used to indicate reading the byte code according to the specified byte amount in a deserialization processing process.
[0012] In another aspect, a data storage apparatus is provided, the apparatus comprising:
[0013] an obtaining module configured to obtain a data set corresponding to a specified picture frame displayed in a terminal running process, the data set comprising a plurality of associated data associated with the specified picture frame;
[0014] a determining module configured to determine data format types corresponding to the plurality of associated data in the data set respectively;
[0015] a converting module configured to convert the plurality of associated data into byte code corresponding to a specified byte amount based on the data format types corresponding to the plurality of associated data respectively, wherein the specified byte amount corresponds to the data format type;
[0016] an arranging module configured to arrange the byte code obtained by converting the plurality of associated data in a serialization manner to obtain a serialization processing result;
[0017] a storing module configured to store the serialization processing result as a storage result of the data set corresponding to the specified picture frame, the storage result being used to indicate reading the byte code according to the specified byte amount in a deserialization processing process.
[0018] In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the data storage method according to any one of the above embodiments of the present application.
[0019] In another aspect, a computer readable storage medium is provided, the storage medium storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by a processor to implement the data storage method according to any one of the above embodiments of the present application.
[0020] In another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the data storage method according to any one of the above embodiments.
[0021] The technical scheme provided by the embodiments of the present application has at least the following beneficial effects:
[0022] After obtaining the plurality of associated data associated with the specified picture frame, the process of determining the data format types corresponding to the plurality of associated data respectively, and converting the plurality of associated data into byte codes corresponding to the specified number of bytes based on the data format types to obtain the serialization processing result, replaces the mode of obtaining the serialization processing result by serializing the associated data based on the key-value pair, and can realize the serialization processing of different associated data by determining the data format types and converting the associated data into byte codes, thereby avoiding storing the same content corresponding to different associated data in the data storage process, reducing the occupied space of data storage, saving the bandwidth occupied space in the data storage process, and further reducing the data storage burden of the computer. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical scheme in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0024] Figure 1 is a data storage method provided by an exemplary embodiment of the present application;
[0025] Figure 2 is an implementation environment provided by an exemplary embodiment of the present application;
[0026] Figure 3 is a data storage method flowchart provided by an exemplary embodiment of the present application;
[0027] Figure 4 is a data storage method flowchart provided by an exemplary embodiment of the present application;
[0028] Figure 5 is a serialization processing result acquisition process provided by another exemplary embodiment of the present application;
[0029] Figure 6 is a data storage method flowchart provided by an exemplary embodiment of the present application;
[0030] Figure 7 is a data transmission method flowchart provided by an exemplary embodiment of the present application;
[0031] Figure 8is a deserialization processing result diagram provided by another exemplary embodiment of the present application;
[0032] Figure 9 is a data storage method flowchart provided by an exemplary embodiment of the present application;
[0033] Figure 10 is a data display diagram provided by another exemplary embodiment of the present application;
[0034] Figure 11 is a data storage method product framework diagram provided by an exemplary embodiment of the present application;
[0035] Figure 12 is a serialization processing procedure flowchart provided by an exemplary embodiment of the present application;
[0036] Figure 13 is a deserialization processing procedure flowchart provided by another exemplary embodiment of the present application;
[0037] Figure 14 is a data storage device structure diagram provided by an exemplary embodiment of the present application;
[0038] Figure 15 is a data storage device structure diagram provided by another exemplary embodiment of the present application;
[0039] Figure 16 is a server structure diagram provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0041] First, the terms involved in the embodiments of the present application are briefly introduced.
[0042] Serialization: refers to a processing procedure of converting the state information of an object into a data form that can be stored or transmitted. In the serialization process, the current state of the object is written into a temporary or persistent storage area for storing the current state of the object. The deserialization process is a process of converting the data form corresponding to the object stored in the temporary or persistent storage area into the state information of the object.
[0043] Socket communication: a general network communication protocol, with a server end and a client end, the communication and data interaction between the two ends are through the Internet Protocol (IP) and port binding, and after the binding is completed, the data is transmitted between the server end and the client end in a bidirectional manner.
[0044] In the related art, in the manner of data storage, the data is usually stored in the data format of JS object notation (JSON). After obtaining a data set corresponding to a specified picture frame, the associated data in the data set corresponding to the specified picture frame is serialized, and the serialized result corresponding to the associated data is stored. The associated data obtained is in the JSON data format, so in the process of serialization, the associated data in the JSON data format is converted into a JSON string, which is taken as the serialized result.
[0045] The JSON string is usually implemented as a Key-Value pair data format, in which the cache value Value represents the JSON string value, and is used to distinguish different associated data. That is, in the process of storing the associated data in the Key-Value pair form, different associated data are only distinguished by different cache values (Value values), and different associated data may have the same cache key value (Key value) stored correspondingly, which results in low data storage efficiency. In the case of a large amount of data to be stored, the storage burden of the computer is too heavy.
[0046] Next, the data storage method provided by the present application will be introduced. As shown in Figure 1 , a data storage method provided by an example embodiment of the present application is shown, as shown in Figure 1 , a data set 100 corresponding to a specified picture frame is obtained, in which the data set includes a plurality of associated data (which can be implemented as associated data 1, associated data 2, …, associated data n) associated with the specified picture frame. The data format type 110 corresponding to the associated data in the data set 100 is determined. When the data set 100 includes a plurality of different associated data, the data format type 110 corresponding to the plurality of different associated data is also different. The plurality of data format types 110 can include at least one of the basic data types such as integer (e.g. byte, short, int, long, etc.), floating point (e.g. float, double, etc.), character (e.g. char), etc.
[0047] According to the data format type 110, the plurality of associated data is converted into byte code corresponding to a specified number of bytes. The byte code obtained by the plurality of associated data is serialized and sorted to obtain a serialized result 120. The serialized result 120 is stored as a storage result 130 of the data set 100 corresponding to the specified picture frame.
[0048] The data storage method provided in the embodiments of the present application can realize the serialization processing of different associated data in different data format types, avoid storing the same content corresponding to different associated data in the data storage process, improve the storage efficiency of data storage, reduce the data storage burden of the computer, and further improve the data storage performance.
[0049] In combination with the above-mentioned name introduction, the application scenarios of the embodiments of the present application are exemplified.
[0050] 1. Applied to data analysis scenarios For example, the associated data is realized as performance data, a performance data set is obtained, the associated data is converted into bytecode and serialized to obtain a serialization processing result by determining the data format types corresponding to the plurality of performance data in the performance data set, and the serialization processing result is sent to a background database for analyzing the performance data.
[0051] 2. Applied to data transmission scenarios For example, the associated data is realized as resource data, a first terminal obtains a data set corresponding to a current specified picture frame, determines a serialization processing result corresponding to the data set, sends the serialization processing result to a second terminal through a specified communication interface, the second terminal performs deserialization processing after receiving the serialization processing result, and displays a picture corresponding to the specified picture frame in the second terminal.
[0052] It should be noted that the above-mentioned application scenarios are only exemplary, and the scheme provided in the embodiments of the present application can also be applied to video analysis, audio analysis and other scenarios, and is not limited in this regard.
[0053] In view of the above-mentioned name introduction and application scenarios, the implementation environment involved in the embodiments of the present application is described, which includes a terminal, and the terminal is installed with an application program having a picture display function. The application program having a picture display function can be realized as a stand-alone application program or an online application program.
[0054] In some embodiments, when the application installed in the terminal is implemented as a stand-alone application, a data set corresponding to a specified frame displayed by the application during running is acquired, wherein the data set includes a plurality of associated data associated with the specified frame, the data format types corresponding to the plurality of associated data are determined, the plurality of associated data are converted into byte code corresponding to a specified byte number based on the data format types, the byte code is serialized and sorted to obtain a serialization processing result, and the terminal stores the serialization processing result as a storage result of the data set corresponding to the specified frame.
[0055] In some embodiments, the terminal can be implemented as a first terminal, and the implementation environment further includes a second terminal, a server and a communication network. For illustration, please refer to Figure 2 The implementation environment involves the first terminal 210, the server 220 and the second terminal 240, and the terminal 210 and the server 220 are connected through the communication network 230.
[0056] The first terminal 210 is installed with an application 211 having a frame display function, wherein the application 211 is implemented as an online application. The second terminal 240 is installed with an application 221 having a frame display function, wherein the application 221 is implemented as an online application. Optionally, the application 211 and the application 221 can be implemented as the same application, or the application 211 and the application 221 can be implemented as different applications.
[0057] During the running of the application 211 installed in the first terminal 210, the terminal 210 acquires a data set corresponding to a specified frame displayed by the application 211 during running, and the data set includes a plurality of associated data 2111 associated with the specified frame. The data format types corresponding to the plurality of associated data 2111 are determined, the plurality of associated data 2111 are converted into byte code 2112 corresponding to a specified byte number based on the data format types, and the byte code 2112 obtained by converting the plurality of associated data 2111 is serialized and sorted to obtain a serialization processing result 2113.
[0058] In one implementation, after the first terminal 210 determines the serialization processing result, the serialization processing result is stored as a storage result of the data set corresponding to the specified frame and stored in a local data file of the first terminal 210.
[0059] In a case where it is possible, the first terminal 210 sends the serialization processing result to the server 220 through the communication network 230, the server 220 sends the serialization processing result to the second terminal 240 through a specified port of the communication network 230, and the second terminal 240 receives the serialization processing result and performs deserialization processing on the serialization processing result, where the deserialization processing is implemented by reading byte code in the serialization processing result according to a specified byte amount, converting the byte code of the specified byte amount into associated data, and finally displaying a running picture corresponding to a specified picture frame according to the associated data in the second terminal 240.
[0060] The first terminal 210 and the second terminal 240 include at least one of a smart phone, a tablet computer, a portable laptop computer, a desktop computer, a smart speaker, a smart wearable device, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, and the like.
[0061] It is worth noting that the server 220 described above can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, and the like basic cloud computing services. Among them, cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or local area network to realize data calculation, storage, processing, and sharing.
[0062] In some embodiments, the server 220 described above can also be implemented as a node in a blockchain system.
[0063] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.), and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data need to comply with relevant laws, regulations, and standards of relevant countries and regions. For example, the target image involved in the present application is obtained under sufficient authorization.
[0064] Illustratively, the data storage method provided by the present application is described as follows Figure 3 which shows a data storage method flowchart provided by an exemplary embodiment of the present application, as shown in Figure 3 The method comprises the following steps:
[0065] At step 310, a data set corresponding to a specified frame of a display screen during running of the terminal is acquired.
[0066] The data set includes a plurality of associated data associated with the specified frame of the display screen.
[0067] Illustratively, a target application is running in the terminal, and a data set corresponding to a specified frame of a display screen displayed by the target application during running of the target application is acquired.
[0068] In some embodiments, the specified frame of the display screen refers to a data set generated by a running frame of the target application at a specified time during running of the target application, that is, the specified frame of the display screen is implemented as a corresponding logical frame during running of the target application.
[0069] Illustratively, the associated data refers to data interaction generated by the specified frame of the display screen during running of the target application, for example, the target application is implemented as a game program, and the specified frame of the display screen includes at least one of the following data: a current attribute state of a virtual object, a current position of the virtual object in a virtual scene, a current state of a virtual prop, a current memory usage of the game program, a frames per second (FPS) value of the game program, and the like; or the target application is implemented as a live broadcast application, and the specified frame of the display screen includes at least one of the following data: display screen data corresponding to a current anchor account, a real-time audience number in a live broadcast room, a live broadcast type, and a number of live broadcast gifts, without limitation.
[0070] Optionally, the data source required for running the specified frame of the display screen includes at least one of the following data: resource data, memory data, performance data, and the like.
[0071] The resource data refers to screen data used for displaying a running screen corresponding to the specified frame of the display screen, for example, at least one of the following data of a virtual scene screen corresponding to a game application during running of the virtual scene screen: texture data (e.g., texture name), mesh data (e.g., mesh name and vertex number), particle system data (e.g., particle system number), and the like.
[0072] The performance data is used to represent real-time information of the resource data used by the target application during running of the terminal, for example, at least one of the following data: frames per second, a current running time of a function used by the program, a memory usage corresponding to engine data and code data currently used by the program, and the like.
[0073] The memory data is used to represent the terminal memory occupied by the terminal in running the target application, such as the memory amount occupied by the program code and the name of the memory occupied by the program code.
[0074] Optionally, the data collection includes the same type of associated data, such as the data collection including only the memory data; or the data collection including different types of associated data, such as the data collection including the memory data and the performance data.
[0075] In step 320, the data format type corresponding to each of the plurality of associated data in the data collection is determined.
[0076] Illustratively, the data format type is used to determine the memory amount that needs to be allocated to the associated data during the running of the terminal.
[0077] Optionally, the data format type can be implemented as a basic data type, wherein the basic data type includes:
[0078] 1. Integer type, such as byte type (byte), short type (short), integer type (int), and long type (long);
[0079] 2. Floating point type, such as single precision type (float) and double precision type (double);
[0080] 3. Character type, such as character type (char);
[0081] 4. Boolean type (boolean), such as true (True) and false (False).
[0082] Optionally, the data format type can be implemented as a reference data type, wherein the reference data type includes at least one of the following types: class, interface type, array type, enumeration type, annotation type, and string type.
[0083] Optionally, the determination of the data format type includes at least one of the following methods:
[0084] 1. The plurality of associated data is pre-provided with a type identifier, when the plurality of associated data is obtained, the type identifier corresponding to the plurality of associated data is read, and the data format type corresponding to the associated data is determined according to the reading result, wherein the type identifier can be implemented as a pre-provided byte, different data format types are determined according to different enumeration values corresponding to the pre-provided byte, such as if the associated data is byte type, the type identifier corresponding to the pre-provided byte type is one byte "1", and if the associated data is long type, the type identifier corresponding to the pre-provided long type is one byte "2";
[0085] 2. The associated data corresponding to different data format types is implemented as different byte lengths, and the data format type corresponding to the associated data is determined by determining the byte length corresponding to the associated data;
[0086] 3. The data format type corresponding to each of the plurality of associated data is determined by determining the character arrangement manner of the plurality of associated data.
[0087] It should be noted that the above-mentioned determination manner of the data format type is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0088] Optionally, a single associated data corresponds to only one data format type; or a single associated data corresponds to multiple data format types, which are not limited.
[0089] Optionally, different associated data correspond to the same data format type; or different associated data correspond to different data format types.
[0090] Step 330, based on the data format type corresponding to each of the plurality of associated data, the plurality of associated data is converted into byte code corresponding to a specified number of bytes.
[0091] The specified number of bytes corresponds to the data format type.
[0092] Illustratively, the byte code can be implemented as a combination result of the binary data arranged in sequence, for example, the data format type corresponding to the associated data a is int type, since the int type data occupies 32 bits in the 32-bit compiler, and each 8 bits occupies one byte, therefore the specified number of bytes occupied by the int type data in the 32-bit compiler is 4 bytes (if in the 16-bit compiler, it occupies 2 bytes, which can be adjusted according to actual needs), then the associated data a is converted into 4 byte codes as the byte conversion result of the associated data a; or, the data format type corresponding to the associated data b is long type, since the long type data occupies 64 bits in the 32-bit compiler, and each 8 bits occupies one byte, therefore the specified number of bytes occupied by the long type data in the 32-bit compiler is 8 bytes, then the associated data b is converted into 8 byte codes as the byte conversion result of the associated data b.
[0093] It should be noted that the data format type corresponding to the associated data in the present embodiment is fixed, for example, the associated data a is int type data; the associated data A is float type data, therefore, the specified number of bytes of the associated data a is also fixed (i.e. occupying 4 bytes in the 32-bit compiler); the specified number of bytes of the associated data A is also fixed (i.e. occupying 2 bytes in the 32-bit compiler).
[0094] Optionally, the converting the plurality of associated data into the byte code corresponding to the specified byte amount includes at least one of the following converting manners:
[0095] 1. after determining the data format type corresponding to each associated data, the associated data is converted into the byte code of the specified byte amount according to the corresponding data format type;
[0096] 2. after confirming the data format type corresponding to each associated data in the data set, all the associated data are simultaneously converted into the byte code of the specified byte amount;
[0097] 3. after confirming the data format type corresponding to each associated data in the data set, all the associated data are sequentially converted into the byte code of the specified byte amount according to the arrangement order in the data set.
[0098] It is worth noting that the above-mentioned converting manners are only illustrative examples, and the embodiments of the present application are not limited thereto.
[0099] In step 340, the byte code obtained by converting the plurality of associated data is sequentially arranged to obtain a serialization processing result.
[0100] Illustratively, the sequential arrangement refers to arranging the byte code obtained by converting the plurality of associated data according to the specified order, and taking the arrangement result as the serialization processing result.
[0101] Optionally, the sequential arrangement manner includes at least one of the following arrangement manners:
[0102] 1. the sequential arrangement refers to arranging the byte code obtained by converting the plurality of associated data according to the arrangement position of the plurality of associated data in the data set, for example, the data set includes the associated data 1 (int type) and the associated data 2 (long type) arranged in sequence, the associated data 1 and the associated data 2 are respectively converted into 4 byte codes and 8 byte codes according to the int type and the long type, and then the 4 byte codes and the 8 byte codes are arranged according to the order, and the arrangement result is taken as the serialization processing result;
[0103] 2. According to different data format types, the data format types are arranged to obtain a specified arrangement order corresponding to the data format types, and after the associated data is converted based on the data format types to obtain byte codes of a specified byte quantity, the byte codes are arranged according to the data format types corresponding to the associated data, for example, the associated data 1 is of an int type, the associated data 2 is of a float type, and the associated data 3 corresponds to an int type, therefore, the associated data 1, the associated data 2 and the associated data 3 are respectively converted according to the respective corresponding data format types to obtain 4 byte codes, 2 byte codes and 4 byte codes, wherein, since the associated data 1 and the associated data 3 are both of an int type, the specified arrangement order of the current data format type is: an int type, a float type, and therefore the serialization arrangement manner is: 4 byte codes (the associated data 1), 4 byte codes (the associated data 3) and 2 byte codes (the associated data 2).
[0104] It is worth noting that the above serialization arrangement manner is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0105] In some embodiments, the serialization processing result refers to a byte data stream obtained after the byte codes are serialized and arranged.
[0106] Optionally, the serialization processing result includes byte codes of a specified byte quantity obtained by converting all associated data in the data set, or the serialization processing result includes byte codes of a specified byte quantity obtained by converting part of the associated data in the data set, and the present application is not limited thereto.
[0107] In a realizable case, the following shows program code content corresponding to the implementation in the serialization processing result obtaining process:
[0108]
[0109] As can be seen from the above program code content, the serialization arrangement process is essentially a process of generating byte codes of a specified byte quantity corresponding to the associated data according to the specified byte quantity corresponding to the data format type, and arranging the corresponding byte codes in a specified order to generate a byte data stream.
[0110] Step 350, storing the serialization processing result as a storage result of the data set corresponding to the specified picture frame.
[0111] The storage result is used to indicate that the byte codes are read according to the specified byte quantity in the deserialization processing process.
[0112] Illustratively, the storage result refers to a byte data stream generated after the serialization arrangement of the byte codes of a specified byte quantity obtained by converting the associated data.
[0113] Optionally, the storage manner of the serialization processing result comprises at least one of the following manners:
[0114] 1. A data file is preset, and the serialization processing result is stored into the data file, that is, the content corresponding to the current data file is the serialization processing result of the associated data associated with the specified picture frame in the data set.
[0115] 2. A database is preset, and the serialization processing result is stored into the database, that is, the database stores the byte data stream obtained by the serialization processing of the associated data.
[0116] It is worth noting that the above-mentioned storage manner of the serialization processing result is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0117] Optionally, the serialization processing result of the data set corresponding to each specified picture frame is stored separately, or when there are multiple specified picture frames, the serialization processing result of the data set corresponding to each specified picture frame is stored in sequence according to the picture playing order of the multiple specified picture frames, that is, the serialization processing results corresponding to the multiple specified picture frames are stored together, and the present application is not limited thereto.
[0118] In some embodiments, the deserialization processing process refers to converting the byte code corresponding to the specified byte number to obtain the corresponding associated data.
[0119] In the deserialization process, since the byte code of the specified byte number corresponding to the associated data in the serialization processing result is arranged in a specified order, in the deserialization processing process, the corresponding byte code is read according to the specified byte number, so as to convert the associated data according to the byte code of the specified byte number, and realize the data restoration process.
[0120] In summary, the data storage method provided by the embodiments of the present application obtains multiple associated data associated with a specified picture frame, determines the data format types corresponding to the multiple associated data respectively, and converts the multiple associated data into byte code corresponding to a specified byte number based on the data format types to arrange the byte code in a serialization manner to obtain a serialization processing result. The method replaces the manner of serializing the associated data based on the key-value pair to obtain the serialization processing result, can realize the serialization processing of different associated data by determining the data format types to convert the associated data into byte code, avoids storing the same content corresponding to different associated data in the data storage process, reduces the occupied space of data storage, saves the bandwidth occupied space in the data storage process, and further reduces the data storage burden of the computer.
[0121] In an optional embodiment, the serialization result is implemented as a combination of serialization sub-results; for illustration, please refer to [reference needed]. Figure 4 This illustrates a flowchart of a data storage method provided by an exemplary embodiment of this application. Specifically, step 340 includes steps 341 to 344, or step 340 includes steps 345 to 349, and step 340a is included after step 340. Step 350 includes step 351, as shown below. Figure 4 As shown, the method includes the following steps:
[0122] As an illustration, when serializing and arranging bytecode obtained from multiple viewing data, there are two different serialization and arrangement methods. The following is a detailed explanation of these two methods. It is worth noting that at least one of the two methods can be used during application.
[0123] First, the serialization processing sub-result corresponding to the data format type is stored.
[0124] Step 341: Based on the data format types corresponding to multiple associated data, the bytecode corresponding to the associated data belonging to the target data format type is serialized and arranged to obtain the serialization processing sub-result corresponding to the target data format type.
[0125] To illustrate, when multiple related data in a dataset correspond to different data format types, the bytecode corresponding to the related data with the same data format type is serialized and arranged. At this time, the same data format type corresponding to multiple related data is the target data format type.
[0126] In some embodiments, the serialization sub-result includes bytecode corresponding to multiple associated data types corresponding to the target data format type.
[0127] Optionally, the serialization arrangement can include at least one of the following arrangements:
[0128] 1. Determine the category of the data format type corresponding to multiple related data, pre-specify the sorting order of the data format types of different categories, and classify and sort the bytecode corresponding to the related data belonging to the same target data format type according to the specified sorting order of the data format types. Among them, when classifying and sorting the bytecode corresponding to the related data belonging to the same target data format type, the sorting order of the bytecode is consistent with the sorting order of the corresponding related data in the data set.
[0129] 2. The bytecodes corresponding to the associated data in the data set are arranged in sequence according to the arrangement order of the associated data in the data set. If the data format type corresponding to the associated data appears for the first time, the bytecodes corresponding to the associated data are arranged under the data format type. If the subsequent associated data also corresponds to the aforementioned data format type, the bytecodes corresponding to the associated data are also arranged under the data format type. If the data format type corresponding to the subsequent associated data is different from the aforementioned data format type and also appears for the first time, the aforementioned data format type is arranged after the data format type corresponding to the subsequent associated data, and the bytecodes corresponding to the associated data are arranged under the data format type. For example, the data set includes associated data a, associated data b, and associated data c. The associated data a corresponds to an int type, the associated data b corresponds to a long type, and the associated data c corresponds to an int type. In the serialization arrangement process, first, the associated data a is processed. The int type corresponding to the associated data a appears for the first time in the current data set, so the int type is arranged in the first position. The int type currently includes 4 bytecodes corresponding to the associated data a. Second, the associated data b is processed. The long type corresponding to the associated data b appears for the first time in the current data set, so the long type is arranged after the int type (i.e., in the second position). The long type currently includes 8 bytecodes corresponding to the associated data b. Finally, the associated data c is processed. The int type corresponding to the associated data c already exists, so the associated data c is arranged under the int type and after the 4 bytecodes corresponding to the associated data a. The associated data c also corresponds to 4 bytecodes. That is, the int type corresponds to a serialization processing sub-result, which includes 8 bytes (4 bytes + 4 bytes). The long type also corresponds to a serialization processing sub-result, which includes 8 bytes.
[0130] It is worth noting that the above-mentioned serialization arrangement manner is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0131] In step 342, the serialization processing sub-results corresponding to the data format types in the data set are combined to obtain a serialization processing result.
[0132] Illustratively, after the serialization processing sub-result corresponding to the data format type is determined, the serialization processing sub-results are combined in sequence, that is, the bytecodes corresponding to the associated data corresponding to the data format type are combined in sequence to obtain a byte data stream as the serialization processing result.
[0133] Optionally, the manner of combining the serialization processing sub-results includes at least one of the following combining manners:
[0134] 1. According to the specified arrangement order corresponding to the data format type and the data arrangement order corresponding to the associated data belonging to the same data format type, the byte codes corresponding to the specified number of bytes of the associated data are sequentially combined in order;
[0135] 2. Firstly, for a single serialization processing sub-result, the byte codes corresponding to the associated data in the single serialization processing sub-result are combined according to the arrangement order of the associated data in the serialization processing sub-result, to obtain a combined result corresponding to the serialization processing sub-result, and then the serialization processing sub-results corresponding to the data format types are sequentially combined according to the specified arrangement order of the data format types in the data set, to finally determine the serialization processing result.
[0136] It should be noted that the above manner of combining the serialization processing sub-results is only an illustrative example, and embodiments of the present application are not limited in this regard.
[0137] Step 343, obtaining a first byte code corresponding to the target data format type.
[0138] Illustratively, the first byte code corresponds to the target data format type, that is, different associated data correspond to different target data formats, wherein the first byte code is implemented as an enumeration value, and corresponds to occupying one byte. For example, if the target data format type is an integer type, the first byte code is set to "00000000", and if the target data format type is a long integer type, the first byte code is set to "00000001".
[0139] Optionally, the first byte code can be obtained in at least one of the following ways:
[0140] 1. Each target data format type is preconfigured with a first byte code, and when the target data format type corresponding to the associated data is obtained, the first byte code corresponding to the target data format type can be determined;
[0141] 2. A byte code library is preconfigured, the byte code library preconfigures different byte codes corresponding to different data format types, and after the target data format type corresponding to the associated data is obtained, the byte code corresponding to the associated data format type is determined from the byte code library as the first byte code.
[0142] It should be noted that the above manner of obtaining the first byte code is only an illustrative example, and embodiments of the present application are not limited in this regard.
[0143] In this embodiment, the first byte codes corresponding to the same type of data format type are the same.
[0144] Step 344, storing the first byte code and the serialization processing sub-result in the serialization processing result in association.
[0145] Illustratively, the associated storage refers to storing the serialized processing sub-result and the first bytecode corresponding to the data format type of the serialized processing sub-result together.
[0146] In some embodiments, in the process of storing the first bytecode in association with the serialized processing sub-result, the first bytecode is stored together with the serialized processing sub-result at a specified position, such as before each serialized processing sub-result, the first bytecode corresponding to the serialized processing sub-result is stored.
[0147] Second, the serialization sub-result corresponding to the data format type is stored.
[0148] Step 345, for the target data in the associated data, the target data format type corresponding to the target data is obtained.
[0149] Illustratively, when the data set includes multiple associated data, the process of determining the respective data format types of the multiple associated data is realized by determining the target data format type corresponding to the target data in the associated data.
[0150] Illustratively, as shown in Figure 5 , a serialized processing result obtaining process diagram provided by an exemplary embodiment of the present application is shown, as shown in Figure 5 , taking the current acquisition of three associated data as an example, a plurality of data sets corresponding to a plurality of specified picture frames are obtained, wherein the plurality of data sets include data set 510, and the data set 510 includes associated data 511 and associated data 512, wherein the associated data 511 is implemented as texture data, and the associated data 512 is implemented as mesh data. Among them, the texture data and the mesh data correspond to different data structures, so their respective data information is different.
[0151] Illustratively, taking the associated data 511 implemented as texture data as an example for specific description, the following data structure corresponding to the texture data (in this embodiment, the data structure is presented in the form of program code):
[0152]
[0153] According to the data structure of the texture data, the effective information contained in the texture data is width in resolution (DataWidth), height in resolution (DataHeight), map format (DataFormat) and memory size (Sizeof). The four data are taken as four target data in the texture data. The target data format type corresponding to the width and height in resolution is integer (int), the target data format type corresponding to the map format is enumeration type (implemented as an enumeration value), and the target data format type corresponding to the memory size is long integer (long). Therefore, the data format type corresponding to the texture data includes integer, enumeration type and long integer.
[0154] In step 346, the first bytecode corresponding to the target data format type is obtained.
[0155] Illustratively, the first bytecode corresponds to the target data format type, that is, different target data corresponds to different target data format. The first bytecode is implemented as an enumeration value and occupies one byte. For example, if the target data format type is integer, the first bytecode is set as "00000001", and if the target data format type is long integer, the first bytecode is set as "00000010".
[0156] Optionally, the first bytecode is obtained in at least one of the following ways:
[0157] 1. Each target data format type is preset with a first bytecode. When the target data format type corresponding to the target data is obtained, the first bytecode corresponding to the target data format type is determined.
[0158] 2. A bytecode library is preset. The bytecode library contains different bytecodes corresponding to different data format types. After the target data format type corresponding to the target data is obtained, the bytecode corresponding to the target data format type is determined from the bytecode library as the first bytecode.
[0159] It is worth noting that the above-mentioned way of obtaining the first bytecode is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0160] In step 347, the target data is converted into binary to obtain the second bytecode corresponding to the target data.
[0161] Illustratively, the binary conversion refers to converting the target data into a binary corresponding numerical result, wherein the binary corresponding numerical result is the second bytecode corresponding to the target data, for example, the target data is octal data "346", and the binary numerical result obtained by binary conversion of the target data is "11100110", which corresponds to eight bytecodes. That is, a single binary numerical value corresponds to a single bytecode.
[0162] Optionally, the target data is implemented as binary data, or the target data is implemented as data of other bases (such as hexadecimal, octal, hexadecimal, etc.).
[0163] Step 348, based on the first bytecode and the second bytecode, a serialized sub-result corresponding to the target data is constituted.
[0164] Illustratively, after the binary conversion of the target data obtains the second bytecode corresponding to the target data, the second bytecode corresponding to the target data and the first bytecode are arranged in a specified order to constitute a serialized sub-result corresponding to the target data, wherein the serialized sub-result is implemented as a bytecode corresponding to the target data. For example, when the target data is implemented as octal integer data "321", the target data format type corresponding to the target data is integer, the first bytecode corresponding to the integer is "5", the binary conversion of the target data obtains the second bytecode "11010001" (including eight bytecodes) corresponding to the target data, and the eight bytecodes are arranged in the conversion order, and the first bytecode is placed after the eight bytecodes to build the bytecode "110100015" corresponding to the target data as the serialized sub-result of the target data.
[0165] In some embodiments, after the binary conversion of each pair of target data obtains the second bytecode corresponding to the target data, the serialized sub-result corresponding to the target data is determined; or after the binary conversion of a specified number of target data obtains the second bytecode corresponding to the target data, the specified number of target data is uniformly obtained, and this is not limited.
[0166] Illustratively, as shown in Figure 5 , the binary conversion of the target data 511 and the target data 512 obtains the second bytecodes corresponding thereto respectively, and the serialized sub-result 521 corresponding to the target data 511 and the serialized sub-result 522 corresponding to the target data 512 are constituted according to the first bytecodes and the second bytecodes corresponding to the target data 511 and the target data 512 respectively.
[0167] Step 349, the serialized sub-results corresponding to the associated data in the data set are combined to obtain a serialization processing result.
[0168] Illustratively, after determining the serialization sub-results corresponding to the data format types, the serialization sub-results are combined, i.e., the bytecodes corresponding to the associated data corresponding to the data format types are combined in order to obtain a byte data stream as the serialization processing result.
[0169] Optionally, the manner of combining the serialization sub-results includes at least one of the following manners:
[0170] 1. The serialization sub-results are spliced in a specified order to obtain the serialization processing result corresponding to the data collection;
[0171] 2. The serialization sub-results are combined randomly to obtain the serialization processing result corresponding to the data collection.
[0172] It is worth noting that the above manner of combining the serialization sub-results is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0173] In some embodiments, the arrangement order of the associated data in the data collection is determined; based on the arrangement order, the serialization sub-results corresponding to the associated data are sequentially combined to obtain the serialization processing result.
[0174] Illustratively, the arrangement order refers to the storage location order of the associated data in the data collection when the data collection is obtained, for example, the data collection includes texture data, mesh data, and particle system data, and the arrangement order is the texture data, the mesh data, and the particle system data.
[0175] Illustratively, after obtaining the serialization sub-result corresponding to the target data in the associated data, the serialization sub-result corresponding to the target data is sequentially spliced according to the arrangement order to obtain a splicing result as the serialization processing result.
[0176] Illustratively, as shown in Figure 5 the data collection 510 includes the associated data 511 and the associated data 512, the serialization sub-result 521 corresponding to the associated data 511 and the serialization sub-result 522 corresponding to the associated data 512 are obtained, and the serialization sub-result 521 and the serialization sub-result 522 are sequentially combined according to the arrangement positions of the associated data 511 and the associated data 512 in the data collection 510 to obtain the serialization processing result 530 corresponding to the data collection 510.
[0177] In step 340a, based on the serialization processing result, the total amount of bytes corresponding to the bytecodes converted from the plurality of associated data is determined.
[0178] Illustratively, the total amount of bytes is used to represent the total amount of bytes occupied by the byte code obtained by converting a plurality of associated data, such as: the serialization processing result includes a sequence sub-result corresponding to the target data implemented as a 32-bit integer data (occupies 4+1=5 bytes, wherein one byte is used to represent the first byte code of the target data format type corresponding to the target data), and a sequence sub-result corresponding to the target data implemented as a 64-bit long integer (occupies 8+1=9 bytes, wherein one byte is used to represent the first byte code of the target data format type corresponding to the target data), then the total amount of bytes is implemented as 5+9=14 bytes.
[0179] Step 351, store the serialization processing result and the total amount of bytes as the storage result of the data set corresponding to the specified picture frame.
[0180] Illustratively, the serialization structure corresponding to the data set and the total amount of bytes are stored in the data file as the storage result of the data set corresponding to the specified picture frame.
[0181] Illustratively, the program code corresponding to the storage result is shown as follows:
[0182]
[0183] Among them, AssetFile is used to represent the data file storing the serialization processing result and the total amount of bytes, assetBuffer refers to the byte data stream corresponding to the associated data in the serialization processing result, and assetIndex refers to the total amount of bytes corresponding to the serialization processing result.
[0184] It is worth noting that the above-mentioned two serialization processing result obtaining methods are for the case where the data format type corresponding to the current associated data is not directly obtained, therefore the first byte code corresponding to the data format type needs to be determined, which is used to indicate the data format type corresponding to the associated data.
[0185] Illustratively, the program code used in the case where the data format type corresponding to the associated data cannot be directly determined is listed as follows:
[0186] Struct A{
[0187] size_t Value1;
[0188] size_t Value2;
[0189] }
[0190] The Struct A is implemented as an associated data, the associated data includes target data (Value1) and target data (Value2) of the size t data format type, since the size t is a self-defined data format type, it does not belong to the basic data format type or the reference data format type, in the process of storing the bytecode corresponding to the associated data, the first bytecode corresponding to the self-defined data format type needs to be determined, which is used for subsequent deserialization process according to the first bytecode to read the specified number of bytecodes.
[0191] Illustratively, if the associated data belongs to the conventional data, that is, when the associated data in the data set is obtained, the data format type corresponding to the associated data is the basic data format type or the reference data format type, after the associated data is converted into the bytecode corresponding to the specified number of bytes, the serialization arrangement is performed to obtain the serialization processing result, it is not necessary to determine the first bytecode corresponding to the data format type (because the specified number of bytes corresponding to the basic data type or the reference data type is fixed), for example, if the associated data is implemented as texture data, the texture data already includes resolution data (corresponding to the data format type of int) and map format data (corresponding to the data format type of enumeration type), therefore, in the process of obtaining the corresponding serialization sub-result for the texture data, it is not necessary to store the first bytecodes corresponding to the resolution data and the map format data in the texture data.
[0192] In summary, the data storage method provided by the embodiment of the present application, after obtaining a plurality of associated data associated with a specified picture frame, determines the data format types corresponding to the plurality of associated data respectively, and converts the plurality of associated data into bytecodes corresponding to a specified number of bytes based on the data format types, thereby performing serialization arrangement to obtain a serialization processing result, which replaces the method of performing serialization processing on the associated data based on the key-value pair to obtain a serialization processing result, and can realize serialization processing of different associated data by converting the associated data into bytecodes based on the determination of the data format types, thereby avoiding storing the same content corresponding to different associated data in the data storage process, reducing the occupied space of data storage, saving the bandwidth occupied in the data storage process, and further reducing the data storage burden of the computer.
[0193] In the embodiment, the first bytecode and the second bytecode corresponding to the target data constitute the serialization sub-result, which not only retains the data information corresponding to the target data, but also retains the target data format type corresponding to the target data by storing the first bytecode, thereby improving the storage accuracy of data storage.
[0194] In this embodiment, the sequence processing result is obtained by sequentially combining the serialized sub-results according to the arrangement order of the associated data, so that the associated data in the data set can be determined in sequence when the sequence processing result is read subsequently, thereby improving the storage accuracy of the data storage and the data reading convenience.
[0195] In this embodiment, the sequence processing result and the total number of bytes are stored, so that the corresponding byte data stream can be read directly according to the data stream length subsequently, thereby improving the accuracy of the data storage and the data reading convenience.
[0196] In an optional embodiment, the scheme provided by the present application further includes a deserialization processing process. For example, refer to Figure 6 which shows a data storage method flowchart provided by an example embodiment of the present application, as shown in Figure 6 The method includes the following steps:
[0197] Step 610, obtaining the storage result of the data set.
[0198] The storage result includes the sequence processing result corresponding to the associated data.
[0199] The storage result is stored in a data file. When the data file is obtained, the storage result of the data set can be obtained.
[0200] Optionally, the method of obtaining the storage result of the data set includes at least one of the following methods:
[0201] 1. Calling the data file stored in the terminal. That is, the terminal stores the storage result of the data set in a local data file. The terminal can obtain the storage result of the data set by calling the data file again, wherein the data set in the current case is the data set corresponding to the specified picture frame in the running process of the terminal itself.
[0202] 2. Receiving the storage result of the data set sent by other equipment, that is, receiving the storage result of the data set corresponding to the specified picture frame in the running process of other equipment through the communication interface, wherein the storage result is not necessarily the storage result of the data set corresponding to the specified picture frame in the current display process of the terminal itself.
[0203] It is worth noting that the above method of obtaining the storage result is only illustrative, and the embodiments of the present application are not limited in this regard.
[0204] In this embodiment, for the second acquisition method described above, the communication interface can be implemented as a Socket network interface, wherein the current terminal acts as the receiving device and other devices act as the sending devices. The address and port of the receiving device are bound through the Socket network, and the stored result is forwarded to the corresponding port of the receiving device through the network port.
[0205] The data storage transmission methods include at least one of the following two different transmission methods:
[0206] 1. If the receiving device and the sending device are connected via Universal Serial Bus (USB cable), then the specified communication method corresponding to the specified engine (Unity) platform (such as Android communication method) is used to bind the port of the receiving device, and the original data storage (Profile) interface of the specified engine (Unity) is called to send the storage result to the receiving device;
[0207] 2. If the receiving and transmitting devices are connected via Wi-Fi, then a specific sending logic is required to send the stored results of the data set from the transmitting device to the receiving device. For an illustrative example, please refer to [link / reference needed]. Figure 7 It illustrates a flowchart of a data transmission method provided in an exemplary embodiment of this application, such as... Figure 7 As shown, the method includes the following steps:
[0208] Step 710: Bind the address and port.
[0209] In this embodiment, the address (IP) and port corresponding to the receiving device (i.e., the current terminal) are bound via the Socket network interface. If the binding is successful, step 720 is executed; if the binding fails, the process returns to step 710.
[0210] Step 720: Read the stored results from the target cache.
[0211] In this embodiment, when the transmitting device serializes the data set of a specified frame and obtains the serialization result, it stores it in the target buffer as the storage result of the data set. Simultaneously, when the target buffer contains the serialization result, it reads the stored result in real time for transmission to the receiving device. The target buffer can be implemented as a transmission buffer for storing the serialization result.
[0212] Step 730: Send to the receiving device.
[0213] In this embodiment, when the stored result of the data set is read from the target cache, it is sent to the receiving device, and the corresponding stored result in the target cache is deleted.
[0214] When the serialized processing result does not exist in the target buffer area, it is considered that the serialized processing result in the current sending device has been sent, and thus the reading is ended / failure in sending. If the reading is not ended / failure in sending, it indicates that the serialized processing result to be sent still exists in the current target buffer area, and the step 720 is continuously executed. That is, the storage result stored in the target buffer area is received through the network interface.
[0215] The step 740 is ended and released.
[0216] In the embodiment, when the reading is ended / failure in sending in the target buffer area, the communication process of the Socket network interface is ended.
[0217] The step 620 is to determine the first bytecode of the data format type corresponding to the associated data in the data set based on the serialized processing result.
[0218] Illustratively, the serialized processing result includes the serialized sub-result corresponding to the associated data. In the process of reading the serialized processing result, the first bytecode of the data format type corresponding to the associated data in the serialized sub-result corresponding to the associated data is determined, so as to determine the data format type corresponding to the associated data. For example, the serialized processing result includes serialized sub-result 1 (corresponding to associated data 1) and serialized sub-result 2 (corresponding to associated data 2). The first bytecode “00000001” included in the serialized sub-result is read, and the first bytecode “00000010” included in the serialized sub-result is read. The first bytecode “00000001” corresponds to an integer, and the first bytecode “00000010” corresponds to a long integer. The data format type corresponding to the associated data 1 is an integer, and the data format type corresponding to the associated data 2 is a long integer.
[0219] In the embodiment, in the process of determining the first bytecode, the serialized sub-result in the serialized processing result is sequentially read according to the arrangement mode of the serialized sub-result.
[0220] In some embodiments, the serialized and arranged bytecodes in the serialized processing result are classified and identified according to the bytecode distribution rule, and the first bytecode of the data format type corresponding to the associated data in the data set is determined.
[0221] In a realizable case, in the process of performing the deserialization processing on the serialized processing result, the first bytecode corresponding to the data format type needs to be determined first. Therefore, the first bytecode of the data format type in the serialized and arranged bytecodes in the serialized processing result can be determined through the bytecode distribution rule.
[0222] The byte distribution rule is used to indicate the distribution of the byte code in the serialization processing result, that is, to indicate whether the byte code in the serialization processing result belongs to the first byte code or the second byte code corresponding to the associated data.
[0223] Optionally, the setting of the byte distribution rule includes at least one of the following setting modes:
[0224] 1. The first byte code corresponding to the data format type of the associated data in the data set is determined by reading the serialized byte code in the serialization processing result according to a specified byte position. The specified byte position can be implemented as a preset byte position in the serialization processing result storage process, which is used to represent the first byte code, so that the byte code read by the specified byte position can be used as the first byte code.
[0225] 2. The first byte code corresponding to the data format type of the associated data is read by taking the key indication bit as the starting bit in the serialization processing result. The key indication bit can be implemented as a specific byte position, which is used to indicate that the starting bit of the first byte code starts from the next bit of the current byte position. For example, the key indication bit can be implemented as an underscore. In the process of traversing the serialization processing result, if the key indication bit is read, the first byte code is read from the key indication bit as the starting bit.
[0226] 3. The character pointer in the serialization processing result is obtained, which is used to indicate the starting bit of the first byte code. The first byte code corresponding to the data format type of the associated data is read from the starting bit of the first byte code. In the serialization processing, the character pointer is stored, which is used to indicate the starting bit of the first byte code in the serialization processing result. By reading the character pointer, the starting bit of the first byte code is determined, and the first byte code is read from the starting bit.
[0227] It is worth noting that the above setting mode of the byte distribution rule is only an illustrative example, and the embodiments of the present application are not limited thereto.
[0228] Step 630, the associated data is deserialized based on the first byte code to obtain a deserialization processing result.
[0229] The deserialization processing result is the result of the associated data obtained by sequentially converting the byte code in the storage result according to the serialization processing result.
[0230] The deserialization result is the result of converting the serialization processing result into the corresponding associated data.
[0231] In some embodiments, based on the first bytecode, a specified number of bytes of the data format type corresponding to the associated data is determined; based on the specified number of bytes, the bytecode corresponding to the associated data is determined; and the associated data is obtained by converting the bytecode, as the deserialization processing result corresponding to the associated data.
[0232] Illustratively, after obtaining the first bytecode of the data format type corresponding to the associated data in the serialization processing result, the data format type corresponding to the associated data is determined, and the specified number of bytes of the associated data in the byte data stream is determined according to the data format type corresponding to the associated data, wherein the specified number of bytes is used to represent the number of bytes occupied by the associated data in the byte data stream. For example, when the associated data a is known to correspond to the data format type of integer through the first bytecode, the specified number of bytes of the associated data a is 4 bytes, and when the associated data b is known to correspond to the data format type of string through the first bytecode, the specified number of bytes of the associated data b is 1 byte.
[0233] Illustratively, the specified number of bytes of each associated data in the serialization processing result is determined, and then the bytecode in the byte data stream is read according to the target byte data corresponding to each associated data, that is, the byte data stream includes 32 second bytecodes arranged in order, each second bytecode corresponds to one byte of content. If the associated data A corresponds to an integer, 4 bytecodes are read in order according to the arrangement order, and the 4 bytecodes correspond to the bytecode of the associated data A.
[0234] Illustratively, after obtaining the bytecode corresponding to the associated data, the self-bytecode in the bytecode is converted in order according to the arrangement order, and the conversion result obtained is the associated data, that is, the deserialization processing result corresponding to the associated data. Illustratively, the program code corresponding to the implementation of the deserialization processing process is shown as follows:
[0235]
[0236]
[0237] According to the above program code, in the process of deserializing the serialization processing result, each bytecode in the byte data stream in the serialization processing result needs to be traversed to determine the first bytecode of the data format type corresponding to the associated data in the data set, and then the data format type corresponding to the associated data is determined. However, when the data format type is implemented as a reference data type, it needs to be judged and specially processed, then the specified number of bytes of the associated data is determined according to the first bytecode, the bytecode of the associated data is read according to the specified number of bytes, and finally the bytecode is converted into the associated data.
[0238] Illustratively, please refer to Figure 8It shows a deserialization processing result schematic diagram provided by an example embodiment of the present application, as shown in Figure 8 As shown, the current display deserialization processing result interface 800 includes a waveform polyline graph 810 and a data list 820, wherein the waveform polyline graph 810 is used to indicate the summary data of a plurality of data sets corresponding to a plurality of specified picture frames in the display process of the terminal, and the data list 820 is the data set corresponding to the expansion at the specified time in the selected waveform polyline graph 810, that is, the associated data corresponding to the picture frame data at the current specified time, wherein the associated data is obtained by deserializing the storage result.
[0239] In summary, the data storage method provided by the embodiments of the present application replaces the way of serializing the associated data based on the key-value pair to obtain the serialization processing result, and the process of determining the data format type corresponding to the plurality of associated data and converting the plurality of associated data into the byte code corresponding to the specified byte number based on the data format type to obtain the serialization processing result, which can realize the serialization processing of different associated data by determining the data format type and converting the associated data into the byte code, avoids storing the same content corresponding to different associated data in the data storage process, reduces the occupied space of data storage, saves the bandwidth occupied space in the data storage process, and further reduces the data storage burden of the computer.
[0240] In the embodiment, the process of deserializing the storage result can realize the deserialization processing of the stored serialization processing result, reacquire the associated data, realize the data recovery of the associated data, and improve the data use efficiency.
[0241] In the embodiment, the process of setting a target buffer area in the transmission process of the storage result can make the data transmission between the receiving device and the sending device exist a buffer process, which is convenient for improving the data transmission performance.
[0242] In the deserialization processing process, the method of obtaining the first byte code by identifying the serialization processing result through the byte code identification rule can improve the deserialization processing speed and improve the byte code identification efficiency.
[0243] In an optional embodiment, the method provided by the present application can be applied to a game scene. For example, please refer to Figure 9 It shows a data storage method flow chart provided by an example embodiment of the present application, as shown in Figure 9 The method includes the following steps:
[0244] At step 910, a game data set corresponding to a game picture frame displayed in a terminal running process is acquired.
[0245] The game data set includes a plurality of game associated data associated with the game picture frame.
[0246] Illustratively, a game application is running in the terminal, and a game data set corresponding to a game picture frame displayed by the game application in a running process of the game application is acquired.
[0247] Illustratively, a first-person shooting game (FPS) is taken as an example for description, and a game data set corresponding to a specified game picture frame in a running process of the first-person shooting game.
[0248] Illustratively, the game data set includes game associated data, and the game associated data refers to data interaction generated in a display process of the game picture frame, such as at least one of a current game situation of a virtual object, a current position of the virtual object, a pick-up situation of a virtual object, a current number of survivors in a game, a memory occupation amount corresponding to a current time of a game program, a frames per second (FPS) value of the game program, and the like.
[0249] Optionally, a source of the game data set required for running the game picture frame includes at least one of resource data, memory data, performance data, and the like.
[0250] The resource data refers to picture data used for displaying a running picture corresponding to the game picture frame, such as at least one of texture data (such as a texture name), mesh data (such as a mesh name and a vertex number), particle system data (such as a particle system number), and the like of a virtual scene picture corresponding to a game application in a running process of the virtual scene picture.
[0251] The performance data is used to represent real-time information of the resource data used by the game application in a running process of the terminal, such as at least one of a frames per second value, a current running time consumption of a function used by the game program in running, an engine data and a code data used by the game program in running, and a memory amount occupied by the engine data and the code data.
[0252] The memory data is used to represent a terminal memory condition occupied in a running process of the game application in the terminal, such as a memory amount occupied by program code and a name of the memory occupied by the program code.
[0253] In step 920, the data format types corresponding to the plurality of game-related data in the game data set are determined respectively.
[0254] Optionally, the data format types include basic data types and reference data types.
[0255] Optionally, each game-related data corresponds to one data format type, or each game-related data corresponds to multiple data format types, which are not limited.
[0256] Optionally, the data format types corresponding to the plurality of game-related data are directly determined, such as the resolution data in the texture data corresponding to the data format type int, and the data format type of the map format data corresponding to the enumeration type; or the data format types corresponding to the plurality of game-related data are customized, that is, the data format type corresponding to the current game-related data is not a conventional data type (such as a basic data type or a reference data type) stored in the server in advance, so that the specified byte amount corresponding to the customized data format type needs to be determined, which can be freely set by the user according to actual needs, which is not limited.
[0257] In step 930, the plurality of game-related data is converted into byte codes corresponding to the specified byte amount based on the data format types corresponding to the plurality of game-related data respectively.
[0258] The specified byte amount corresponds to the data format type.
[0259] Illustratively, the serialization processing refers to a data processing mode of converting the game-related data into byte codes corresponding to the specified byte amount according to the data format type. For example, the game data set includes texture data and mesh data arranged in sequence, taking the texture data as an example, the texture data includes resolution data and map format data, the data format type corresponding to the resolution data is int, the int data occupies 4 bytes, so the resolution data is converted into 4 byte codes, and the data format type corresponding to the map format data is an enumeration type, the enumeration type is implemented as an enumeration value, which occupies 1 byte, so the map format data is converted into 1 byte code.
[0260] Optionally, the conversion process of converting the plurality of game-related data into byte codes corresponding to the specified byte amount includes at least one of the following conversion modes:
[0261] 1. After determining the data format type corresponding to each game-related data, the game-related data is converted into byte codes of the specified byte amount according to the corresponding data format type;
[0262] 2. When all game-related data in the data set are confirmed to correspond to the respective data format types, all game-related data are simultaneously converted into byte codes corresponding to the respective specified byte amounts;
[0263] 3. When all game-related data in the data set are confirmed to correspond to the respective data format types, all game-related data are sequentially converted into byte codes corresponding to the respective specified byte amounts according to the arrangement order in the data set.
[0264] It is to be noted that the above-mentioned conversion manners are only illustrative examples, and the embodiments of the present application are not limited in this regard.
[0265] At step 940, the byte codes obtained by converting the plurality of game-related data are sequentially arranged to obtain a serialization processing result.
[0266] Illustratively, the sequential arrangement refers to arranging the byte codes obtained by converting the plurality of game-related data according to a specified order, and taking the arrangement result as the serialization processing result. For example, taking the texture data as an example, the texture data includes resolution data and map format data arranged in sequence. The resolution data is converted into four byte codes according to the data format type (int type and enumeration type) corresponding to the resolution data and the map format data, and the map format data is converted into one byte code. Since the arrangement order corresponding to the resolution data and the map format data is "resolution data, map format data", the arrangement order in the process of sequentially arranging the byte codes is "four byte codes, one byte code", and the byte data stream corresponding to the arrangement result is taken as the serialization processing result.
[0267] At step 950, the serialization processing result is stored as a storage result of the data set corresponding to the game picture frame.
[0268] The storage result is used to indicate that the byte codes are read according to the specified byte amount in the deserialization process.
[0269] Illustratively, the serialization result is stored in a data file as a storage result of the game data set corresponding to the game picture frame.
[0270] In a realizable case, the embodiments further include a deserialization process, that is, the storage result of the game data set is obtained, and deserialization processing is performed thereon to obtain a deserialization processing result corresponding to the storage result, wherein the deserialization processing result is implemented by reading the corresponding byte codes according to the specified byte amount and converting the byte codes to obtain the corresponding related data.
[0271] Illustratively, please refer to Figure 10 which shows a data display diagram provided by an example embodiment of the present application, as shown in Figure 10As shown, the current display association data display interface 1000 contains the association data processed by the deserialization and sent to the background database. The current association data display interface 1000 displays the data condition list 1010 corresponding to each association data in the data set at a specified time (i.e., a specified picture frame), which is used to describe the data content corresponding to the association data.
[0272] In summary, the data storage method provided by the embodiments of the present application replaces the method of serializing the association data based on the key-value pair to obtain the serialization processing result, and determines the data format type corresponding to the plurality of association data, and converts the plurality of association data into byte codes corresponding to the specified number of bytes based on the data format type to obtain the serialization processing result. The serialization processing of different association data can be realized by determining the data format type and converting the association data into byte codes, which avoids storing the same content corresponding to different association data in the data storage process, reduces the occupied space of data storage, saves the bandwidth occupied in the data storage process, and further reduces the data storage burden of the computer.
[0273] Next, the serialization processing method and the deserialization processing method involved in the present application will be described in detail, including the serialization processing process, the deserialization processing process, and the data transmission process.
[0274] First, refer to Figure 11 which shows the product framework diagram of the data storage method provided by an example embodiment of the present application, as Figure 11 shown, the product includes a sending device 1110 and a receiving device 1120.
[0275] Optionally, the sending device 1110 and the receiving device 1120 can be implemented as the same type of device, such as: the sending device 1110 and the receiving device 1120 are both implemented as a mobile terminal; or the sending device 1110 and the receiving device are implemented as different types of devices, which are not limited.
[0276] Among them, the sending device 1110 obtains the data set 1111 corresponding to the specified picture frame in the display process, determines the data format type corresponding to the association data in the data set 1111, and serializes the association data in the data set 1111 based on the data format type 1112 to obtain the serialization processing result 1113 corresponding to the association data, wherein the serialization processing result 1113 refers to the result of converting the association data into a byte data stream according to the data format type.
[0277] Next, the serialization processing process will be described in detail:
[0278] For illustration, please refer to Figure 12 which shows a sequence processing process flowchart provided by one exemplary embodiment of the present application, as shown in Figure 12 For example, in the game scene, the method includes the following steps:
[0279] Step 1210, obtaining a data set through an engine interface.
[0280] For illustration, in the running process of the game application in the terminal, the interface of the specified engine needs to be called for running the game application, therefore, the data set corresponding to the specified picture frame in the display process of the game application is obtained by calling the engine interface.
[0281] Step 1220, determining target data.
[0282] For illustration, after obtaining the data set, the associated data in the data set is classified to determine the target data in the associated data, wherein the type of the target data includes texture data, mesh data, particle system data, shading data, etc.
[0283] Step 1230, determining the target data format type.
[0284] For illustration, the data attribute information of the target data is determined, such as: the target data can be realized as resolution, memory size, texture name, map format, etc. According to the data attribute information of the target data, the target data format type corresponding to the target data is determined. The data attribute information is used to indicate that the target data belongs to the corresponding category in the data corresponding to the current specified picture frame.
[0285] Step 1240, sequence processing.
[0286] For illustration, the target data is converted into the byte code corresponding to the specified number of bytes according to the target data format type, and the byte code is sequenced and arranged, and the result obtained by the arrangement is taken as the sequence sub-result corresponding to the target data. The target data format type includes at least one of the basic data types such as unsigned integer, integer, long integer, string, and floating point.
[0287] Step 1250, ending collection.
[0288] For illustration, when the game application ends running, the data set is stopped for sequence processing. The sequence sub-results corresponding to the target data are combined to obtain the sequence processing result corresponding to the data set.
[0289] When the sending device 1110 determines the serialization processing result 1113 corresponding to the data set 1111, the serialization processing result 1113 can be stored in the data file 1114, or the serialization processing result 1113 is sent to the receiving device 1120 through the Socket communication interface. Wherein, when the serialization processing result 1113 is stored in the data file 1114, it can also be sent to the receiving device 1120, which is not limited.
[0290] If the receiving device 1120 receives the data file 1114, it first performs file reading 1121 to obtain the serialization processing result 1113 in the data file 1114. If the sending device 1110 transmits data through the Socket communication interface, the receiving device 1120 directly obtains the serialization processing result 1113.
[0291] After the receiving device 1120 obtains the serialization processing result 1113, the serialization processing result 1113 is deserialized 1122 to obtain the deserialization processing result 1123, wherein the deserialization processing result 1123 is realized as the corresponding associated data in the data set, and finally the specified picture frame corresponding to the associated data is displayed in the receiving device 1120.
[0292] Next, the deserialization processing process is described in detail.
[0293] For illustration, please refer to Figure 13 which shows the deserialization processing process flowchart provided by an example embodiment of the present application, as shown in Figure 13 the method comprises the following steps:
[0294] Step 1310, reading a file.
[0295] When the receiving device receives the data file sent by the sending device, the storage content in the data file is read, that is, the serialization processing result corresponding to the data set is read.
[0296] When the receiving device receives the data sent by the sending device through the Socket communication interface, the interface data corresponding to the network port is read, wherein the interface data is realized as the serialization processing result of the data set.
[0297] Step 1320, determining the data classification.
[0298] The serialization processing result includes a sequence sub-result, the sequence sub-result includes a first bytecode and a second bytecode corresponding to the associated data, the first bytecode is read, and the number of data corresponding to the associated data is determined according to the first bytecode. In addition, the serialization processing result includes data attribute information corresponding to the associated data, which is used to determine the data classification of the associated data.
[0299] In step 1330, the data format type is determined.
[0300] The data format type corresponding to the associated data is determined through the first bytecode in the sequence sub-result, wherein the first bytecode is implemented as a value preset according to the data format type.
[0301] In step 1340, the data is read according to the specified number of bytes.
[0302] After determining the data format type corresponding to the associated data, the specified number of bytes corresponding to the associated data is determined, the bytecode corresponding to the specified number of bytes in the serialization processing result is read according to the specified number of bytes, and the corresponding associated data is obtained by converting the bytecode.
[0303] In step 1350, the process is ended.
[0304] When the bytecode is completely read, the current reverse sequence processing process is completed, the reverse sequence processing process is ended, and the corresponding associated data is determined according to the reverse sequence processing result.
[0305] As described above, the data storage method provided by the embodiment of the application replaces the method of serializing the associated data based on the key-value pair to obtain the serialization processing result, and determines the data format type corresponding to the plurality of associated data and converts the plurality of associated data into the bytecode corresponding to the specified number of bytes based on the data format type to obtain the serialization processing result. The serialization processing of different associated data is realized by determining the data format type and converting the associated data into the bytecode, the same content corresponding to different associated data is avoided in the data storage process, the occupied space of the data storage is reduced, the bandwidth occupied in the data storage process is saved, and the data storage burden of the computer is reduced.
[0306] The scheme provided by the application has the following beneficial effects:
[0307] 1. The process of collecting and storing performance data generated in the game process in the game application scenario is realized, including the function time, memory occupation, resource attribute, etc. corresponding to each frame of picture frame, which greatly reduces the occupied amount of data storage and improves the data storage efficiency.
[0308] 2. The communication framework between the receiving device and the sending device is realized, the sending device can realize the serialization processing of the data set, and the byte data stream is transmitted to the receiving device through the Socket communication interface; the receiving device realizes the deserialization processing of the received byte data stream to obtain the associated data and the graphical display process;
[0309] 3. The scheme is suitable for the related platform developed by the designated engine, and has a wide range of application;
[0310] 4. The scheme can be applied to performance automatic testing, numerical automatic testing and other fields, and is used for collecting large amount of data.
[0311] Figure 14 is a structural block diagram of a data storage device provided by an exemplary embodiment of the present application, as shown in Figure 14 The device includes the following parts:
[0312] The acquisition module 1410 is configured to acquire a data set corresponding to a specified picture frame displayed in a terminal running process, wherein the data set includes a plurality of associated data associated with the specified picture frame.
[0313] The determination module 1420 is configured to determine data format types corresponding to the plurality of associated data in the data set.
[0314] The conversion module 1430 is configured to convert the plurality of associated data into byte codes corresponding to a specified byte amount based on the data format types corresponding to the plurality of associated data, wherein the specified byte amount corresponds to the data format type.
[0315] The arrangement module 1440 is configured to serialize and arrange the byte codes obtained by converting the plurality of associated data to obtain a serialization processing result.
[0316] The storage module 1450 is configured to store the serialization processing result as a storage result of the data set corresponding to the specified picture frame, and the storage result is used to instruct reading the byte codes according to the specified byte amount in a deserialization processing process.
[0317] In an optional embodiment, the conversion module 1430 is further configured to serialize and arrange the byte codes corresponding to the associated data belonging to a target data format type based on the data format types corresponding to the plurality of associated data to obtain a serialization processing sub-result corresponding to the target data format type; and combine the serialization processing sub-results corresponding to each data format type in the data set to obtain the serialization processing result.
[0318] In an optional embodiment, the conversion module 1430 is further configured to obtain a first bytecode corresponding to the target data format type of the target data; and store the first bytecode in association with the serialization processing sub-result into the serialization processing result.
[0319] In an optional embodiment, the conversion module 1430 is further configured to, for the target data in the associated data, obtain a target data format type corresponding to the target data; obtain a first bytecode corresponding to the target data format type; perform binary conversion on the target data to obtain a second bytecode corresponding to the target data; combine the serialization sub-results corresponding to the associated data in the data set based on the first bytecode and the second bytecode to obtain the serialization processing result.
[0320] In an optional embodiment, the conversion module 1430 is further configured to determine an arrangement order of the associated data in the data set; and combine the serialization sub-results corresponding to the associated data in sequence based on the arrangement order to obtain the serialization processing result.
[0321] In an optional embodiment,
[0322] The determination module 1420 is further configured to determine, based on the serialization processing result, a total amount of bytes corresponding to bytecodes obtained by conversion of the plurality of associated data.
[0323] The storage module 1450 is further configured to store the serialization processing result and the total amount of bytes as a storage result of the data set corresponding to the specified picture frame.
[0324] In an optional embodiment, the apparatus further includes:
[0325] The obtaining module 1410 is further configured to obtain a storage result of the data set, the storage result including the serialization processing result corresponding to the associated data.
[0326] The obtaining module 1410 is further configured to obtain, based on the serialization processing result, a first bytecode of a data format type corresponding to the associated data in the data set.
[0327] The processing module 1460 is configured to perform deserialization processing on the associated data based on the first bytecode to obtain a deserialization processing result, wherein the deserialization processing result is a result of sequentially converting bytecodes arranged in the serialization in the storage result to obtain the associated data.
[0328] In an optional embodiment, the processing module 1460 is further configured to determine, based on the first byte code, a specified number of bytes of a data format type corresponding to the associated data; determine the byte code corresponding to the associated data based on the specified number of bytes; and convert the byte code to obtain the associated data as the deserialization processing result corresponding to the associated data.
[0329] In an optional embodiment, the obtaining module 1410 is further configured to classify and identify the byte codes arranged in sequence in the serialization processing result according to a byte code distribution rule, and determine the first byte code of the data format type corresponding to the associated data in the data set.
[0330] In an optional embodiment, the obtaining module 1410 is further configured to obtain a game data set corresponding to a game frame displayed in a terminal running process, wherein the game data set includes a plurality of game associated data associated with the game frame.
[0331] The determining module 1420 is further configured to determine the data format types corresponding to the plurality of game associated data in the game data set, respectively.
[0332] The conversion module 1430 is further configured to convert the plurality of game associated data into byte codes corresponding to specified numbers of bytes based on the data format types corresponding to the plurality of game associated data, respectively, wherein the specified numbers of bytes correspond to the data format types.
[0333] The arrangement module 1440 is further configured to arrange the byte codes converted from the plurality of game associated data in sequence to obtain a serialization processing result.
[0334] The storage module 1450 is further configured to read the byte codes arranged in sequence in the serialization processing result according to specified byte positions, determine the first byte code of the data format type corresponding to the associated data in the data set, or traverse the serialization processing result, read a key indication bit in the serialization processing result in the traversal process, read the first byte code of the data format type corresponding to the associated data from the key indication bit as a starting position, or read the byte codes arranged in sequence in the serialization processing result according to specified byte positions, determine the first byte code of the data format type corresponding to the associated data in the data set.
[0335] Or,
[0336] traverse the serialization processing result, read a key indication bit in the serialization processing result in the traversal process, read the first byte code of the data format type corresponding to the associated data from the key indication bit as a starting position.
[0337] Or,
[0338] Obtaining the character pointer in the serialization processing result, the character pointer being used to indicate the starting bit of the first bytecode; reading the first bytecode of the data format type corresponding to the associated data from the starting bit of the first bytecode. Obtaining the character pointer in the serialization processing result, the character pointer being used to indicate the starting bit of the first bytecode; reading the first bytecode of the data format type corresponding to the associated data from the starting bit of the first bytecode.
[0339] In summary, the data storage device provided by the embodiments of the present application, after obtaining a plurality of associated data associated with a specified picture frame, determines the data format types corresponding to the plurality of associated data respectively, and converts the plurality of associated data into bytecodes corresponding to a specified number of bytes based on the data format types to obtain a serialization processing result, thereby replacing the mode of obtaining a serialization processing result by serializing the associated data based on key-value pairs. The serialization processing of different associated data can be realized by determining the data format types and converting the associated data into bytecodes, which avoids storing the same content corresponding to different associated data in the data storage process, reduces the occupied space of data storage, saves the bandwidth occupied space in the data storage process, and further reduces the data storage burden of the computer.
[0340] It should be noted that: the data storage device provided by the above embodiments is only exemplified by the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the data storage device and the data storage method provided by the above embodiments belong to the same concept, and the specific implementation process is described in detail in the method embodiment, which will not be repeated here.
[0341] Figure 16 The structure of the server provided by an example embodiment of the present application is shown. Specifically:
[0342] The server 1600 includes a central processing unit (CPU) 1601, a system memory 1604, including a random access memory (RAM) 1602 and a read-only memory (ROM) 1603, and a system bus 1605 that couples the system memory 1604 to the central processing unit 1601. The server 1600 also includes a mass storage device 1606 for storing an operating system 1613, application programs 1614, and other program modules 1615.
[0343] The mass storage device 1606 connects to the central processing unit 1601 through a mass storage controller (not shown) connected to the system bus 1605. The mass storage device 1606 and its associated computer-readable media provide non-volatile storage for the server 1600. That is, the mass storage device 1606 can include a computer- readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0344] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid state memory technology, CD-ROM, digital versatile discs (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices. Computer storage media would not, however, include communication media including wired or wireless signaling buses, plain old telephone service (POTS) and cellular networks, wireless data networks, and other networks that commonly carry computer readable instructions, data structures, program modules or other data. The system memory 1604 and mass storage device 1606 described above can collectively be referred to as memory.
[0345] According to various embodiments of the present application, the server 1600 can further operate connected to a remote computer on a network through a network, such as the Internet. That is, the server 1600 can be connected to a network 1612 through a network interface unit 1611 connected to the system bus 1605, or can be connected to other types of networks or remote computer systems (not shown) using the network interface unit 1611.
[0346] The above-described memory further includes one or more programs stored in the memory configured to be executed by the CPU.
[0347] Embodiments of the present application also provide a computer device including a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, at least one program, code set or instruction set being loaded and executed by the processor to implement the data storage method provided by any of the above method embodiments.
[0348] Embodiments of the present application also provide a computer readable storage medium storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, at least one program, code set or instruction set being loaded and executed by the processor to implement the data storage method provided by any of the above method embodiments.
[0349] Embodiments of the present application also provide a computer program product or computer program including computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to make the computer device execute the data storage method described in any of the above embodiments.
[0350] Optionally, the computer readable storage medium can include a read-only memory (ROM), a random access memory (RAM), a solid state disk (SSD), an optical disk, etc. Among them, the random access memory can include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The above-mentioned application embodiment serial number is only for description, not representing the pros and cons of the embodiments.
[0351] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or can be instructed by a program to complete the related hardware, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0352] The above only describes optional embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data storage method, characterized in that, The method is applied to a game scenario, and the method includes: Obtain a data set corresponding to a specified screen frame displayed during terminal operation. The data set includes multiple associated data related to the specified screen frame. The specified screen frame includes a game screen frame. The data set includes a game data set. The game data set includes multiple game-related data associated with the game screen frame. The associated data includes game-related data. Determine the data format type corresponding to the plurality of associated data in the data set; Based on the data format types corresponding to the multiple associated data, the multiple associated data are converted into bytecode corresponding to a specified number of bytes, wherein the specified number of bytes corresponds to the data format type; The bytecode obtained from the conversion of multiple related data is serialized and arranged to obtain the serialization result; The serialization result is stored as the storage result of the data set corresponding to the specified frame. The storage result is used to indicate that bytecode is read according to the specified number of bytes during the deserialization process. Obtain the storage result of the data set, wherein the storage result includes the serialization processing result corresponding to the associated data; Read the serialized bytecode in the serialization result according to specified byte positions to determine the first bytecode of the data format type corresponding to the associated data in the data set; or, traverse the serialization result, read the key indicator bits in the serialization result during the traversal, and read the first bytecode of the data format type corresponding to the associated data with the key indicator bits as the starting position; or, obtain the character pointer in the serialization result, the character pointer is used to indicate the starting position of the first bytecode; read the first bytecode of the data format type corresponding to the associated data from the starting position of the first bytecode; The associated data is deserialized based on the first bytecode to obtain a deserialization result, wherein the deserialization result is obtained by sequentially converting the bytecode arranged in serialization in the storage result to obtain the associated data.
2. The method according to claim 1, characterized in that, The step of serializing and arranging the bytecode obtained from the conversion of multiple associated data to obtain the serialization result includes: Based on the data format types corresponding to multiple associated data, the bytecode corresponding to the associated data belonging to the target data format type is serialized and arranged to obtain the serialization processing sub-result corresponding to the target data format type; The serialization sub-results corresponding to each data format type in the data set are combined to obtain the serialization result.
3. The method according to claim 2, characterized in that, The method further includes: Obtain the first bytecode corresponding to the target data format type; The first bytecode is associated with the serialization sub-result and stored in the serialization result.
4. The method according to claim 1, characterized in that, The step of serializing and arranging the bytecode obtained from the conversion of multiple associated data to obtain the serialization result includes: For the target data in the associated data, obtain the target data format type corresponding to the target data; Obtain the first bytecode corresponding to the target data format type; The target data is converted into binary to obtain the second bytecode corresponding to the target data; The serialization sub-result corresponding to the target data is constructed based on the first bytecode and the second bytecode; The serialization sub-results corresponding to the associated data in the dataset are combined to obtain the serialization processing result.
5. The method according to claim 4, characterized in that, The step of combining the serialization sub-results corresponding to the associated data in the dataset to obtain the serialization processing result includes: Determine the order in which the associated data is arranged in the dataset; Based on the arrangement order, the serialization sub-results corresponding to the associated data are combined sequentially to obtain the serialization processing result.
6. The method according to any one of claims 1 to 5, characterized in that, After serializing and arranging the bytecode obtained from the conversion of multiple associated data to obtain the serialization result, the process further includes: Based on the serialization process results, determine the total number of bytes corresponding to the bytecode obtained from the conversion of multiple associated data. The step of storing the serialization result as the storage result of the data set corresponding to the specified frame includes: The serialization result and the total number of bytes are stored as the storage result of the data set corresponding to the specified frame.
7. The method according to any one of claims 1 to 5, characterized in that, The step of deserializing the associated data based on the first bytecode to obtain the deserialization result includes: Based on the first bytecode, determine the specified number of bytes for the data format type corresponding to the associated data; The bytecode corresponding to the associated data is determined based on the specified number of bytes; The bytecode is converted to obtain the associated data, which is used as the deserialization result corresponding to the associated data.
8. A data storage device, characterized in that, The device includes: The acquisition module is used to acquire a data set corresponding to a specified screen frame displayed during terminal operation. The data set includes multiple associated data associated with the specified screen frame. The specified screen frame includes a game screen frame. The data set includes a game data set. The game data set includes multiple game associated data associated with the game screen frame. The associated data includes game associated data. The determining module is used to determine the data format type corresponding to the plurality of associated data in the data set; The conversion module is used to convert multiple associated data into bytecode corresponding to a specified number of bytes based on the data format types corresponding to the multiple associated data respectively, wherein the specified number of bytes corresponds to the data format type; The sorting module is used to serialize and sort the bytecode obtained from the conversion of multiple related data to obtain the serialization result; A storage module is used to store the serialization processing result as the storage result of the data set corresponding to the specified frame. The storage result is used to indicate that bytecode is read according to the specified number of bytes during the deserialization process. The acquisition module is further configured to acquire the storage result of the data set, wherein the storage result includes the serialization processing result corresponding to the associated data; The storage module is further configured to: read the serialized bytecode in the serialization result according to a specified byte position, and determine the first bytecode of the data format type corresponding to the associated data in the data set; or, traverse the serialization result, read the key indicator bit in the serialization result during the traversal, and read the first bytecode of the data format type corresponding to the associated data starting from the key indicator bit; or, obtain a character pointer in the serialization result, the character pointer being used to indicate the starting position of the first bytecode; and read the first bytecode of the data format type corresponding to the associated data from the starting position of the first bytecode. The processing module is used to deserialize the associated data based on the first bytecode to obtain a deserialization result, wherein the deserialization result is obtained by sequentially converting the bytecode arranged in serialization in the storage result to obtain the associated data.
9. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the data storage method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores at least one program segment, which is loaded and executed by a processor to implement the data storage method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the data storage method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data serialization method and device
CN106777292A
Serialization and deserialization method and device, equipment and medium
CN114153896A