Data processing method, server and terminal equipment
By creating a data string collection for the old file data of the target application and determining the retained and added data sets based on the data string length threshold, the patch files are generated, which solves the problem of too large patch files in differential restore technology, and reduces download traffic and upgrades are achieved. The effect of time.
Patent Information
- Application Number
- CN202411153163.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-08
AI Technical Summary
In software upgrade scenarios, differential restore technology results in a large amount of patch file data, which increases the client terminal download traffic and storage space usage, affecting the software upgrade efficiency.
By creating a data string collection for the old file data of the target application, and determining the retained data set and new data set based on the preset data string length threshold, generating patch files, reducing the size of retained data and new data, thereby compressing patch files. The size of the terminal device is reduced by reducing the download traffic and upgrade time of the terminal device.
It effectively reduces the size of the patch file, shortens the software upgrade time, and improves the upgrade efficiency of terminal devices to target applications.
Smart Images

Figure CN118916058A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent terminal technology, and in particular to a data processing method, a server and a terminal device. Background Art
[0002] Differential restoration technology is used in software upgrade scenarios of electronic devices. Differential restoration technology includes differential algorithms and restoration algorithms. The server can obtain the difference data between the non-upgraded and upgraded software through the differential algorithm, and the client terminal can upgrade the non-upgraded software through the restoration algorithm and the differential data.
[0003] When executing the differential algorithm, a large amount of differential data is usually obtained, resulting in a large amount of patch file data for software upgrades. This will increase the traffic of client terminals downloading differential data, increase download time and increase storage space usage, etc., which is not conducive to client terminals upgrading non-upgraded software.
[0004] Therefore, how to reduce the size of patch files as much as possible through differential algorithms is a problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a data processing method, a server and a terminal device. By setting a data string length threshold for the retained data length, the amount of retained data and the size of new data can be reduced to compress the size of the patch file, which can reduce the traffic of the terminal device downloading the patch file and shorten the upgrade time for the target application.
[0006] In a first aspect, the present application provides a data processing method, which is applied to a server, and the method includes: receiving a first file update request from a first device, the first file update request including first new file data of a first target application; obtaining first old file data corresponding to the first new file data, and a first data string set, the first data string set being data strings of different lengths created based on the first old file data and the first new file data; determining a retained data set and a newly added data set of the first new file data compared to the first old file data according to the first data string set and a preset data string length threshold, the retained data set including at least one retained data, the newly added data set including at least one newly added data, and the data length of each retained data being greater than the data string length threshold; generating a patch file for the first new file data according to the data length of at least one retained data, the position information of at least one newly added data in the first new file data, and the position information of at least one retained data in the first new file data and the first old file data respectively, the patch file being used to update data of the first target application.
[0007] In some embodiments of the first aspect, based on the first data string set and a preset data string length threshold, determining a retained data set and a newly added data set of the first new file data compared to the first old file data, including: starting from the first byte of the first new file data, searching the first data string set for the longest data string starting with the first byte; determining whether to take the longest data string as a retained data by comparing the length of the longest data string with the data string length threshold; obtaining a retained data set after traversing all bytes of the first new file data; and determining a newly added data set based on the position of the retained data in the retained data set in the first new file data.
[0008] In some embodiments of the first aspect, by comparing the length of the longest data string with a data string length threshold, determining whether to take the longest data string as a retained data, including: if the length of the longest data string is greater than the data string length threshold, determining to take the longest data string as a retained data, and starting from the target byte of the first new file data, searching in the first data string set whether there is a longest data string starting with the target byte, wherein the target byte is the byte determined by adding the length of the longest data string starting with the first byte to the first byte; if the length of the longest data string is less than or equal to the data string length threshold, starting from the byte next to the first byte, continuing to search in the first data string set whether there is a longest data string starting with the next byte.
[0009] In some embodiments of the first aspect, according to a preset data volume threshold, the first new file data and the first old file data are respectively segmented to obtain N pairs of new and old file data blocks, where N is a positive integer greater than 1 and less than or equal to M, and M is the maximum number of processing threads executed in parallel; N first processing threads are created, and the N first processing threads correspond one-to-one to the N pairs of new and old file data blocks; data comparison of the N pairs of new and old file data blocks is performed in parallel by the N first processing threads to obtain patch files of the N pairs of new and old file data blocks; based on the patch files of the N pairs of new and old file data blocks, a patch file of the first new file data is generated.
[0010] In some embodiments of the first aspect, the method also includes: calling a preset algorithm library through a first application thread of a first target application to initialize preset parameters, the preset parameters including a data volume threshold and M; creating a first management thread through the first application thread according to a first file update request; performing data segmentation on the first new file data and the first old file data according to the preset data volume threshold, respectively, to obtain N pairs of new and old file data blocks, including: executing the step of performing data segmentation on the first new file data and the first old file data according to the preset data volume threshold, respectively, to obtain N pairs of new and old file data blocks through the first management thread; creating N first processing threads, including: creating N first processing threads through the first management thread; generating a patch file for new file data according to patch files of N pairs of new and old file data blocks, including: executing the step of generating a patch file for the first new file data according to patch files of N pairs of new and old file data blocks through the first management thread.
[0011] In some embodiments of the first aspect, the first application thread is also used to write information of N first processing threads corresponding to the first file update request in the first storage space; the first management thread is also used to delete the information of N first processing threads after generating a patch file for the first new file data; when the first application thread writes data in the first storage space, the first management thread is prohibited from deleting data in the first storage space.
[0012] In some embodiments of the first aspect, the first processing thread is used to write the processing status and / or processing progress of the first processing thread in the second storage space, and the first management thread is used to read the processing status and / or processing progress of the first processing thread from the second storage space; when the first processing thread writes data in the second storage space, the first management thread is prohibited from reading data in the second storage space.
[0013] In some embodiments of the first aspect, if the first file update request includes first new file data and second new file data of a first target application, the first new file data and the second new file data both correspond to first old file data; creating a first management thread through a first application thread comprises: creating two first management threads through a first application program; when one of the two first management threads reads the first old file data, prohibiting the other first management thread of the two first management threads from reading the first old file data.
[0014] In some embodiments of the first aspect, while receiving a first file update request, a second file update request is received from the first device, the second file update request including third new file data of a second target application; based on the second file update request, a second application thread of the second target application is created, the second application thread being used to initialize preset parameters by calling a preset algorithm library; a second management thread is created through the second application thread; and when the first application thread calls the preset algorithm library, the second application thread is prohibited from calling the preset algorithm library.
[0015] In some embodiments of the first aspect, the method also includes: receiving an upgrade request from a second device, the upgrade request being used to request an upgrade of a first target application; obtaining a patch file of the first target application in response to the upgrade request; and sending an upgrade response to the second device, the upgrade response including the patch file of the first target application.
[0016] The second aspect of the present application also provides a data processing method, which is applied to a terminal device, and the method includes: receiving an upgrade response from a server, the upgrade response including a patch file of a first target application; reading at least one piece of retained data from the first old file data based on the position information of at least one piece of retained data in the patch file in the first old file data, and the data length of at least one piece of retained data; reading new data of the same length as the interval length and the position information of at least one piece of retained data in the first new file data from the patch file based on the interval length between adjacent retained data in the at least one piece of retained data; generating the first new file data of the first target application based on the new data, the position information of at least one piece of retained data in the first new file data, and at least one retained data block.
[0017] The third aspect of the present application also provides a server, including: a processor and a memory, the memory is coupled to the processor, the memory is used to store computer program code, and the processor calls the computer program code to enable the server to execute the method of the first aspect.
[0018] The fourth aspect of the present application also provides a terminal device, including: a processor and a memory, the memory is coupled to the processor, the memory is used to store computer program code, and the processor calls the computer program code to enable the terminal device to execute the method of the second aspect.
[0019] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method of the first aspect or the second aspect is implemented.
[0020] An embodiment of the present application also provides a chip system, which is applied to an electronic device or a vehicle. The chip system includes one or more processors, and the one or more processors are used to call computer instructions to implement the method of the first aspect or the second aspect.
[0021] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement the method of the first aspect or the second aspect when executed by a processor.
[0022] The present application provides a data processing method, server and terminal device, the method comprising: by creating a data string set for the old file data of the target application, according to the data string set and the preset data string length threshold, the retained data set and the newly added data set of the new file data of the target application compared with the old file data can be obtained; according to the relevant information of at least one retained data in the retained data set and the position information of at least one newly added data in the newly added data set in the new file data, a patch file of the target application is generated for updating the data of the target application. In the above method, by setting the data string length threshold for the retained data length, the amount of retained data and the size of newly added data can be reduced to compress the size of the patch file, which can reduce the traffic of the terminal device downloading the patch file and shorten the upgrade time of the target application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0024] Figure 1 A schematic diagram of an application scenario of a data processing method provided by an embodiment of the present application;
[0025] Figure 2 A schematic diagram of a flow chart of a data processing method provided by an embodiment of the present application;
[0026] Figure 3 A schematic diagram of another application scenario of the data processing method provided in one embodiment of the present application;
[0027] Figure 4 Another schematic diagram of a data processing method according to an embodiment of the present application;
[0028] Figure 5 A schematic diagram of another application scenario of the data processing method provided in one embodiment of the present application;
[0029] Figure 6 A further flowchart of a data processing method provided in one embodiment of the present application;
[0030] Figure 7 A schematic diagram of a multi-threaded scenario of a data processing method provided in an embodiment of the present application;
[0031] Figure 8 A schematic diagram of an application scenario of a data processing method provided in yet another embodiment of the present application;
[0032] Fig. 9 A flowchart of a data processing method provided by another embodiment of the present application;
[0033] Fig.10 A further flowchart of a data processing method provided in another embodiment of the present application;
[0034] Fig.11 A schematic diagram of another application scenario of a data processing method provided in yet another embodiment of the present application;
[0035] Fig.12 A schematic diagram of another application scenario of the data processing method provided in yet another embodiment of the present application;
[0036] Fig.13 A schematic diagram of the structure of a data processing device provided in one embodiment of the present application;
[0037] Fig.14 Another structural schematic diagram of a data processing device provided in one embodiment of the present application;
[0038] Fig.15 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0039] Fig.16 A schematic diagram of the structure of a terminal device provided in one embodiment of the present application.
[0040] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0041] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0042] The terms "first", "second", etc. used in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0043] Differential restoration technology is used in software upgrade scenarios of electronic devices. Differential restoration technology includes differential algorithms and restoration algorithms. The server can obtain the difference data between the non-upgraded and upgraded software through the differential algorithm, and the client terminal can upgrade the non-upgraded software through the restoration algorithm and the differential data.
[0044] When executing the differential algorithm, a large amount of differential data is usually obtained, resulting in a large amount of patch file data for software upgrades. This will increase the traffic of client terminals downloading differential data, increase download time and increase storage space usage, etc., which is not conducive to client terminals upgrading non-upgraded software.
[0045] Therefore, how to reduce the size of patch files as much as possible through differential algorithms is a problem that needs to be solved urgently.
[0046] In view of this, the present application provides a data processing method, a server, a terminal device, a storage medium, a chip system and a program product, by creating a data string set for the old file data of the target application, according to the data string set and the preset data string length threshold, the new file data of the target application can be obtained compared with the old file data. The retained data set and the newly added data set are obtained, and the patch file of the target application is generated according to the relevant information of at least one retained data in the retained data set and the position information of at least one newly added data in the newly added data set in the new file data, which is used to update the data of the target application. In the above method, by setting the data string length threshold for the retained data length, the amount of retained data and the size of the newly added data can be reduced to compress the size of the patch file, which can reduce the traffic of the terminal device downloading the patch file and shorten the upgrade time of the target application.
[0047] See also Figure 1 , Figure 1 The present invention is an application scenario diagram of the data processing method of the present application. The application scenario includes a server 10, a first device 20, and a second device 30. The server 10 receives a file update request from the first device 20, the file update request includes new file data of the target application (Application, APP) (the new file data is the upgraded target application data), obtains the old file data (the old file data is the non-upgraded target application data), and then generates a patch file according to the data processing method of the present application. The content of the patch file includes the newly added data in the newly added data set and the relevant information of the retained data in the retained data set. The relevant information includes the data length of the retained data and the location information of the retained data in the new file data and the old file data, respectively.
[0048] The server 10 receives the upgrade request of the second device 30 , and sends the patch file to the second device 30 . The second device 30 upgrades the target application deployed on the second device 30 according to the patch file.
[0049] In some embodiments, the first device is a device terminal for developing new file data and / or old file data of a target application. The first device includes a tablet computer and a desktop computer.
[0050] In some embodiments, the second device includes a user device such as a vehicle, a drone, a smart watch, a mobile phone, and a tablet computer.
[0051] It should be noted that Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 The actual form of the various devices included in the Figure 1 The interaction mode between devices is limited, and in the specific application of the solution, it can be set according to actual needs.
[0052] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0053] Figure 2 This is a flow chart of an embodiment of the data processing method provided by the present application. The execution subject of the embodiment of the present application may be a server. The method in this embodiment may be implemented by software, hardware, or a combination of software and hardware. Figure 2 As shown, the data processing method may include the following steps:
[0054] Step S110: receiving a first file update request from a first device.
[0055] The first file update request includes first new file data of a first target application. The first target application includes a navigation and map application, an entertainment application, a communication application, an intelligent driving assistance application, or a parking or charging application, etc. The first new file data is updated (update includes upgrade) data of the first target application.
[0056] It is understandable that in order to upgrade the first target application, after the R&D personnel develop the first new file data of the first target application, they generate a first file update request through the first device to send the first new file data to the server.
[0057] Step S120: Acquire the first old file data corresponding to the first new file data and the first data string set.
[0058] The first old file data and the first data string set can be obtained from the storage device of the server. The first old file data can be the first target application data before the update. The first data string set is a data string of different lengths created based on the first old file data and the first new file data. The data strings of different lengths are sorted in order of the length of the data string from small to large, and then stored in the first data string set for determining the retained data in the subsequent steps. In some embodiments, the first data string set can also be described as a suffix array, and the data string can also be described as a byte string.
[0059] For example, Figure 5 As shown, the first new file data includes "abcde". Based on the differential algorithm, data strings of different lengths starting with a can be found in the first old file data, such as Figure 5 Similarly, you can also search for data strings of different lengths starting with b, or data strings of different lengths starting with c, or data strings of different lengths starting with d, or data strings of different lengths starting with e in the first old file data.
[0060] Step S130: Determine a retained data set and a newly added data set of the first new file data compared to the first old file data according to the first data string set and a preset data string length threshold.
[0061] Specifically, a certain byte in the first new file data is selected, and in the first data string set, a data string starting with the byte is read, and the data string is compared with a preset data string length threshold, and a data string greater than the data string length threshold is taken as a reserved data. Figure 5 As shown, the reserved data is data in both the first new file data and the first old file data. In the first new file data, the same reserved data as the first old file data or a subset of the reserved data of the first old file data can be found. Usually, the reserved data set includes at least one piece of reserved data.
[0062] For example, Figure 3 As shown, the first new file data includes 4 pieces of reserved data 1, 2, 3 and 4. The first old file data includes 3 pieces of reserved data 1, 2 and 3, wherein reserved data 3 includes reserved data 4, that is, reserved data 4 is a subset of reserved data 3, wherein the data length of each piece of reserved data is greater than the data string length threshold.
[0063] After determining multiple pieces of retained data, the newly added data between two adjacent pieces of retained data can be read. Since there are multiple pieces of retained data, a newly added data set including at least one piece of newly added data can be obtained. Figure 3 As shown, the newly added data set includes five newly added data A, B, C, D and E of the first new file data.
[0064] It should be understood that for new file data of the same size, if the data length of each retained data is greater than the data string length threshold, the amount of retained data will be less (for example, part of the retained data can be reused, such as Figure 3 The more retained data 3 and retained data 4 are, the smaller the amount of new data will be.
[0065] Step S140: Generate a patch file for the first new file data according to the data length of at least one piece of retained data, the position information of at least one piece of newly added data in the first new file data, and the position information of at least one piece of retained data in the first new file data and the first old file data respectively.
[0066] The patch file is used to update the data of the first target application. For example, the first target application can be upgraded according to the patch file. The patch file includes relevant information of the newly added data set and the reserved data set. The relevant information of the reserved data set includes the data length of the reserved data and the location information of the reserved data in the first new file data and the first old file data respectively. The location information includes the starting location. Figure 3 As shown, the patch file includes relevant information of 3 pieces of reserved data and 5 pieces of newly added data A, B, C, D and E of the first new file data. For example, the relevant information of reserved data 2 includes the starting position of reserved data 2 in the first new file data, the starting position of reserved data 2 in the first old file data and the data length of reserved data 2.
[0067] It can be understood that the longer each retained data is, the smaller the overall amount of retained data is, the smaller the new data determined between adjacent retained data blocks is, and the smaller the patch file is. Therefore, by setting the data string length threshold, the longest retained data can be found in the old file data as much as possible, ultimately achieving the purpose of compressing the patch file.
[0068] Please refer to Figure 1 In an application scenario, the server 10 receives a file update request from the first device 20, the file update request includes new file data of the intelligent driving assistance application, obtains old file data of the intelligent driving assistance application, and a data string set. Then, according to the data string set and the preset data string length threshold, the reserved data set and the newly added data set of the new file data compared with the old file data are determined. Finally, according to the data length of at least one reserved data, the location information of at least one newly added data in the new file data, and the location information of at least one reserved data in the new file data and the old file data of the intelligent driving assistance application, a patch file for the new file data is generated.
[0069] The server 10 receives the upgrade request of the vehicle 30 and sends the patch file to the vehicle 30 . The vehicle 30 upgrades the intelligent driving assistance application deployed in the vehicle 30 according to the patch file.
[0070] In the above technical solution, the server receives a first file update request from the first device, and can obtain the first old file data corresponding to the first new file data, as well as the first data string set. Then, based on the first data string set and the preset data string length threshold, the retained data set and the newly added data set of the first new file data compared to the first old file data can be determined. Among them, the retained data length of the retained data set is greater than the data string length threshold, which can reduce the size of the newly added data in the newly added data set and the number of retained data in the retained data set. Finally, based on the data length of at least one retained data, the location information of at least one newly added data in the first new file data, and the location information of at least one retained data in the first new file data and the first old file data, respectively, a patch file for the first new file data is generated. By setting a data string length threshold for the retained data length, the number of retained data and the size of newly added data can be reduced to compress the size of the patch file, which can reduce the traffic of the terminal device downloading the patch file and shorten the upgrade time for the target application.
[0071] In some embodiments, see Figure 4 , the data processing method further comprises the following steps:
[0072] Step S210: receiving an upgrade request from a second device.
[0073] The upgrade request is used to request an upgrade of the first target application. When the second device detects that the first target application needs to be upgraded, it generates an upgrade request and sends it to the server.
[0074] Step S220: In response to the upgrade request, obtain a patch file of the first target application.
[0075] In response to the upgrade request, the server obtains a patch file of the first target application obtained according to the first new file data and the first old file data from the storage device.
[0076] Step S230: Send an upgrade response to the second device.
[0077] The server sends an upgrade response including the patch file of the first target application to the second device.
[0078] In some embodiments, determining the retained data set and the newly added data set of the first new file data compared with the first old file data according to the first data string set and a preset data string length threshold includes the following steps:
[0079] Step S310: Starting from the first byte of the first new file data, search the first data string set for the longest data string starting with the first byte.
[0080] Step S320: Determine whether to treat the longest data string as a reserved data by comparing the length of the longest data string with the data string length threshold.
[0081] Specifically, if the length of the longest data string is greater than the data string length threshold, the longest data string is determined to be a reserved data. If the length of the longest data string is less than or equal to the data string length threshold, starting from the next byte of the first byte, continue to search in the first data string set whether there is a longest data string starting with the next byte.
[0082] Step S330: After traversing all bytes of the first new file data, a reserved data set is obtained.
[0083] Steps S310 to S330 are further explained through steps a1 to a3 of the following examples.
[0084] Exemplarily, the data string length threshold is 12 bytes. The server performs the following steps:
[0085] Step a1: Starting from the first byte of the first new file data, search for the longest data string starting with the first byte in the first data string set.
[0086] Step a2: If the length Len of the longest data string is greater than 12 bytes, the longest data string is used as the reserved data, and the relevant information of the reserved data is recorded. Starting from the Len+1th byte of the first new file data, continue to search for the longest data string starting with the Len+1th byte in the first data string set until all bytes of the first new file data are traversed.
[0087] Step a3: If the length Len of the longest data string is less than or equal to 12 bytes, starting from the second byte of the first new file data, continue to search for the longest data string starting with the second byte in the first data string set until all bytes of the first new file data are traversed.
[0088] Combine the following Figure 5 The example illustrates step S310 and step S320.
[0089] For example, Figure 5As shown, the first new file data includes "abcde...", and the first byte of the first new file data is "a". In an example, it is assumed that the first data string set includes 3 data strings starting with "a", namely "a", "abc", and "abcde". Starting from "a" of the first new file data, the longest data string starting with "a" can be found in the aforementioned first data string set as "abcde". If the data string length threshold is 4, and the length of the longest data string "abcde" is greater than the data string length threshold 4, then the longest data string "abcde" is used as reserved data. In another example, assume that the first data string set includes three data strings starting with "a", namely "a", "ab" and "abc". Starting from "a" of the first new file data, the longest data string starting with "a" can be found in the aforementioned first data string set as "abc". If the data string length threshold is 4, and the length of the longest data string "abc" is less than the data string length threshold 4, then "abc" is not used as retained data. Starting from the second byte "b" of the first new file data, the longest data string starting with the second byte is searched in the first data string set (which may include a data string starting with "b"), and by comparing the length of the longest data string with the data string length threshold, it is determined whether to use the longest data string as a retained data.
[0090] Step S340: determining a newly added data set according to the position of the reserved data in the first new file data in the reserved data set.
[0091] In one implementation, according to the position of the reserved data in the first new file data, the newly added data between two adjacent reserved data in the reserved data set is read to obtain the newly added data set.
[0092] It can be understood that starting from the first byte of the first new file data, the longest data string starting with the first byte is searched in the first data string set, and by comparing the length of the longest data string with the data string length threshold, it is determined whether to use the longest data string as a reserved data. According to the first byte search method, after traversing all bytes of the first new file data, a reserved data set and related information of the reserved data set are obtained. According to the position of the reserved data in the reserved data set in the first new file data, the newly added data set can be determined. In this way, the differential processing of a pair of the first new file data and the first old file data is completed, and a patch file can be generated according to the related information of the reserved data set and the newly added data set.
[0093] In some embodiments, when the server performs differential processing on a pair of new file data and old file data to generate a patch file, the server can process multiple new and old file data blocks generated by a pair of new file data and old file data in parallel through multi-threading to improve the differential processing speed. Take the processing of the first new file data and the first old file data as an example for explanation. For details, please refer to Figure 6 and Figure 7 , the data processing method further comprises the following steps:
[0094] Step S410: Initializing preset parameters by calling a preset algorithm library through a first application thread of a first target application.
[0095] The preset algorithm library stores the differential algorithm, and an operating system-independent interface can be defined for the differential algorithm, so that the differential algorithm can be adapted to different operating systems through the independent interface. The first application thread calls the differential algorithm through the independent interface to initialize the preset parameters. The preset parameters include a data volume threshold and a maximum value M of parallel processing threads. The data volume threshold refers to the size threshold of the new and old file data blocks.
[0096] It can be understood that after obtaining the size of a pair of new file data and old file data, by presetting the size threshold of the new and old file data blocks and the maximum value M of the processing threads executed in parallel, the index parameters such as the size of the new and old file data blocks and the number of the first processing threads can be controlled. The staff can control the index parameters by modifying the preset parameters.
[0097] Step S420: creating a first management thread through a first application thread according to the first file update request.
[0098] After receiving the first file update request, the server creates a first management thread through the first application thread. The first management thread is used to split the first new file data and the first old file data according to a preset data volume threshold, and obtain N pairs of new and old file data blocks. N is a positive integer greater than 1 and less than or equal to M. Figure 8 As shown, the first file data and the first old file data can be divided into at least three pairs of new and old file data blocks. Each pair of new and old file data blocks includes a new file data block and an old file data block.
[0099] Step S430: Create N first processing threads through the first management thread. The N first processing threads correspond one-to-one to N pairs of new and old file data blocks.
[0100] It can be understood that the first management thread divides a pair of new file data and old file data according to a preset data volume threshold to obtain N pairs of new and old file data blocks, and creates N first processing threads for the N pairs of new and old file data blocks. The N first processing threads simultaneously process the N pairs of new and old file data blocks, thereby realizing parallel processing of the N pairs of new and old file data blocks and shortening the differential time for processing a pair of new file data and old file data. At the same time, by adjusting the maximum value M of the processing threads executed in parallel, the number of threads for parallel processing can be adjusted, and the length of the differential time can be effectively adjusted.
[0101] Step S440: using N first processing threads to perform data comparison on N pairs of new and old file data blocks in parallel, to obtain patch files of the N pairs of new and old file data blocks.
[0102] Each first processing thread reads a new and old file data block into the memory separately, performs data comparison, and obtains a patch information corresponding to each new and old file data block. The specific method is consistent with the technical principle of the above steps S120 to S130, except that the differential processing object of the embodiment of the present application is the new and old file data block, and the differential processing generates the patch information. Specifically, the specific method steps include:
[0103] Step b1: the first processing thread creates multiple suffixes for the old file data blocks of the new and old file data blocks.
[0104] Step b2: Arrange multiple suffixes in ascending order to obtain a suffix array.
[0105] Step b3: Starting from the first byte of the new file data block of the new and old file data blocks, search the suffix array for the longest data string starting with the first byte.
[0106] Step b4: If the length Len of the longest data string is greater than 12 bytes, the longest data string is used as the reserved data, and the relevant information of the reserved data is recorded. Starting from the Len+1th byte of the new file data block, continue to search for the longest data string starting with the Len+1th byte in the suffix array until all bytes of the new file data block are traversed.
[0107] Step b5: If the length Len of the longest data string is less than or equal to 12 bytes, start from the second byte of the new file data block and continue to search the suffix array for the longest data string starting with the second byte until all bytes of the new file data block are traversed.
[0108] Step b6: Generate patch information according to the relevant information of the reserved data and the newly added data between adjacent reserved data.
[0109] For the technical features in steps b1 to b6 that are not elaborated in detail, please refer to steps S120 to S130 and their detailed steps.
[0110] Step S450: Generate a patch file for the first new file data according to N pairs of patch files of new and old file data blocks through the first management thread.
[0111] A patch file can be obtained according to the N patch information corresponding to the N pairs of new and old file data blocks, thus completing the difference process of a pair of new file data and old file data.
[0112] In one embodiment, a pair of new file data and old file data are divided into multiple new and old file data blocks through a first management thread, and multiple first processing threads are created several times. Each time, the multiple first processing threads read several new and old file data blocks from the multiple new and old file data blocks into the memory for differential processing. After the patch information is generated, the new and old file data blocks are deleted, thereby effectively reducing memory occupancy.
[0113] In some embodiments, multiple pairs of new file data and old file data can be processed in parallel to obtain multiple patch files corresponding to the multiple pairs of new file data and old file data. Figure 7 , and the method is described by processing two pairs of new file data and old file data at the same time. The data processing method also includes:
[0114] Step S510: while receiving the first file update request, receiving a second file update request from the first device, the second file update request including third new file data of the second target application.
[0115] The function of the second target application is different from that of the first target application, and the second target application may also include a navigation and map application, an entertainment application, a communication application, an intelligent driving assistance application, or a parking or charging application, etc. Exemplarily, the first target application is an intelligent driving assistance application, and the second target application is a communication application.
[0116] Step S520: creating a second application thread of a second target application according to the second file update request.
[0117] The second application thread is used to initialize preset parameters by calling a preset algorithm library.
[0118] Step S530: Create a second management thread through the second application thread.
[0119] Step S540: Create N second processing threads through the second management thread. The N second processing threads correspond one-to-one to the N pairs of new and old file data blocks.
[0120] Step S550: using N second processing threads to perform data comparison on N pairs of new and old file data blocks in parallel, to obtain patch files of the N pairs of new and old file data blocks.
[0121] In some embodiments, during the differential processing, if multiple application threads, multiple management threads, application threads and management threads, or management threads and processing threads simultaneously operate on the same data, the thread that operates first acquires a mutex lock to prevent the threads from reading data in a disorderly manner. Fig. 9 , the data processing method further comprises the following steps:
[0122] Step S610: When the first application thread writes data in the first storage space, the first management thread is prohibited from deleting data in the first storage space.
[0123] Specifically, the first storage space is used to store information of the differential processing process, including information of N first processing threads generated based on the first file update request. During the differential processing process, according to the first file update request, the first application thread writes the information of the N first processing threads corresponding to the first file update request in the first storage space. The first management thread reads the information of the N first processing threads corresponding to the first file update request from the first storage space and creates N first processing threads. After the differential processing is completed, the first management thread is also used to delete the information corresponding to the N first processing threads after generating the patch file of the first new file data. Therefore, during the entire differential processing process, the first application thread and the first management thread may operate on the data in the first storage space at the same time. When the first application thread writes data (such as information of N first processing threads) in the first storage space, the first management thread is prohibited from deleting data (such as information of N first processing threads) in the first storage space, that is, the first application thread obtains a mutex lock to prevent the function of reading data between the first application thread and the first management thread from being disordered.
[0124] Step S620: When the first processing thread writes data in the second storage space, the first management thread is prohibited from reading data in the second storage space.
[0125] Specifically, the second storage space is used to store the processing status and / or processing progress of the first processing thread. The processing status refers to whether the patch information is successfully generated, or whether a pair of new and old file data blocks are successfully differentiated. The processing progress refers to the differential progress of a pair of new and old file data blocks, for example, the differential progress is 5% and 10%, etc.
[0126] During the differential processing, the first processing thread is used to write the processing status and / or processing progress of the first processing thread into the second storage space. The first management thread is used to read the processing status and / or processing progress of the first processing thread from the second storage space. Thus, the first management thread can manage the first processing thread according to the processing status and / or processing progress. Therefore, the first management thread and the first processing thread may also operate on the data in the second storage space at the same time. When the first processing thread writes data in the second storage space, the first management thread is prohibited from reading data in the second storage space, that is, the first processing thread obtains a mutex lock to prevent the function of reading data between the first management thread and the first processing thread from being disordered.
[0127] Step S630: when one of the two first management threads reads the first old file data, the other first management thread of the two first management threads is prohibited from reading the first old file data.
[0128] Specifically, if the first file update request includes first new file data and second new file data of the first target application, wherein the first new file data and the second new file data both correspond to first old file data, two first management threads are created through the first application program.
[0129] That is, please refer to Figure 7 The data processing method of the present application can also upgrade the first target application to different versions at the same time, and the first new file data and the second new file data are different versions of the first target application data respectively. Two first management threads are created through the first application. Among them, one first management thread 1 obtains a patch file of a version of the target application according to the first old file data and the first new file data. Another first management thread 2 obtains a patch file of another version of the target application according to the first old file data and the second new file data. Therefore, the two first management threads may read the first old file data at the same time. When the first management thread 1 reads the first old file data, the first management thread 2 is prohibited from reading the first old file data, that is, the first management thread that reads the first old file data first obtains a mutex lock to prevent functional disorder of reading data between the two management threads.
[0130] Step S640: When the first application thread calls the preset algorithm library, the second application thread is prohibited from calling the preset algorithm library.
[0131] It can be understood that when the first application thread and the second application thread call the preset algorithm library at the same time to initialize the preset parameters, and the preset parameters initialized by the first application thread and the second application thread are different, the first application thread that calls the preset algorithm library first is allowed to call, and the second application thread is prohibited from calling. That is, the first application thread obtains a mutex lock to prevent the function of reading data between the two application threads from being disordered.
[0132] It is understandable that the order between step S610 to step S640 is not limited.
[0133] It should be noted that some open source implementations of various differential algorithms in related technologies focus on the size of patch files, some focus on the length of time for differential restoration, some focus on the amount of memory or CPU occupied, and some are for files in specific formats. They focus on a single feature and cannot adapt to complex and changing application scenarios.
[0134] Compared with the open source implementation scheme of the related technology, in the above-mentioned embodiments, the design of the application thread, the processing thread and the management thread can adapt to different operating systems through an irrelevant interface, and by initializing preset parameters, the size of the new and old file data blocks and the number of processing threads and other index parameters can be controlled. N first processing threads simultaneously process N pairs of new and old file data blocks, realizing parallel processing of N pairs of new and old file data blocks, shortening the differential time for processing a pair of new file data and old file data, and effectively reducing memory usage. Mutex locks are used to prevent the disorder of data reading functions between threads, and multiple characteristics can be taken into account.
[0135] This application also provides a data processing method, which is applied to a terminal device. Fig.10 and Fig.11 , the data processing method comprises the following steps:
[0136] S710: Receive an upgrade response from the server.
[0137] S720: Read at least one piece of reserved data from the first old file data according to the location information of the at least one piece of reserved data of the patch file in the first old file data and the data length of the at least one piece of reserved data.
[0138] S730: Reading, from the patch file, new data having the same length as the interval length between adjacent reserved data in the at least one piece of reserved data, and position information of the at least one piece of reserved data in the first new file data.
[0139] S740: Generate first new file data of a first target application according to the newly added data, the location information of the at least one reserved data in the first new file data, and the at least one reserved data block.
[0140] Specifically, an operating system-independent interface is defined for the restoration algorithm, and the restoration algorithm is adapted to different operating systems through the independent interface. Fig.11 The terminal device receives an upgrade response including a patch file of the first target application, calls a restoration algorithm through an irrelevant interface to initialize preset parameters, and executes the following steps:
[0141] Step c1: Load the patch file into the memory, and read the patch information of a new and old file data block from the patch file.
[0142] Step c2: Retrieve relevant information of the reserved data from the patch information, and then read the reserved data from the old file in the disk according to the starting position of the old file recorded in the relevant information and the data length of the reserved data.
[0143] Step c3: According to the interval length between adjacent retained data, read the newly added data with the same length as the interval length from the patch information.
[0144] Step c4: Process all the reserved data in sequence to restore all the new data, and generate a new file data block according to the new data, the position information of the at least one reserved data in the first new file data, and the at least one reserved data.
[0145] Step c5: Repeat steps c1-c4 until the entire first new file data is restored based on the new file data block.
[0146] It can be understood that the restoration algorithm involves a large number of input / output (I / O) operations, so the retained data and patch files of the first old file data can be read into the memory at one time, and the restored first new file data can be temporarily stored in the memory until it is written to the disk again after the restoration is completed.
[0147] It is understandable that, considering that the restoration algorithm often runs in an environment with less memory, during differential processing, the first management thread divides the new and old file data blocks into specified sizes to meet the memory requirements during restoration.
[0148] Please combine Fig.12 and Figure 1 In another application scenario of the present application, the server 10 receives a file update request from the first device 20, the file update request includes new file data of the intelligent driving assistance application, obtains old file data of the intelligent driving assistance application, and a data string set. Then, based on the data string set and the preset data string length threshold, the retained data set and the newly added data set of the new file data are determined compared to the old file data. Finally, based on the data length of at least one retained data, the location information of at least one newly added data in the new file data, and the location information of at least one retained data in the new file data and the old file data of the intelligent driving assistance application, a patch file for the new file data is generated.
[0149] The server 10 receives the upgrade request of the vehicle 30 and sends an upgrade response to the vehicle 30. The vehicle 30 reads at least one piece of reserved data from the old file data according to the location information of at least one piece of reserved data in the old file data of the intelligent driving assistance application in the patch file of the upgrade response and the data length of at least one piece of reserved data. Then, according to the interval length between adjacent reserved data in the at least one piece of reserved data, the vehicle 30 reads the newly added data with the same length as the interval length and the location information of at least one piece of reserved data in the new file data of the intelligent driving assistance application from the patch file.
[0150] New file data of the intelligent driving assistance application is generated according to the newly added data, the location information of at least one retained data in the new file data, and at least one retained data block, thereby completing the upgrade of the intelligent driving assistance application deployed in the vehicle 30.
[0151] Fig.13 This is a schematic diagram of the structure of an embodiment of a data processing device of the data processing method provided by the present application. The device 40 can be integrated into the server in the above method embodiment, or can be implemented by the server in the above method embodiment. Fig.13 As shown, the data processing device 40 includes a first receiving module 41 , an acquiring module 42 , a determining module 43 and a patch file generating module 44 .
[0152] The first receiving module 41 is used to receive a first file update request from a first device, where the first file update request includes first new file data of a first target application.
[0153] The acquisition module 42 is used to acquire the first old file data corresponding to the first new file data and a first data string set, where the first data string set is data strings of different lengths created based on the first old file data.
[0154] The determination module 43 is used to determine, based on the first data string set and a preset data string length threshold, a retained data set and a newly added data set of the first new file data compared to the first old file data, the retained data set includes at least one retained data, the newly added data set includes at least one newly added data, and the data length of each retained data is greater than the data string length threshold.
[0155] The patch file generation module 44 is used to generate a patch file for the first new file data based on the data length of at least one retained data, the position information of at least one newly added data in the first new file data, and the position information of at least one retained data in the first new file data and the first old file data respectively. The patch file is used to update the data of the first target application.
[0156] In some embodiments, the determination module 43 is further used to search the first data string set for the longest data string starting with the first byte starting from the first byte of the first new file data. By comparing the length of the longest data string with the data string length threshold, it is determined whether to use the longest data string as a reserved data. After traversing all bytes of the first new file data, a reserved data set is obtained. According to the position of the reserved data in the reserved data set in the first new file data, a newly added data set is determined.
[0157] In some embodiments, the determination module 43 is also used to, if the length of the longest data string is greater than a data string length threshold, determine that the longest data string is to be retained as a piece of data, and start from the target byte of the first new file data, search in the first data string set whether there is a longest data string starting with the target byte, wherein the target byte is the byte determined by adding the length of the longest data string starting with the first byte to the first byte; if the length of the longest data string is less than or equal to the data string length threshold, start from the byte after the first byte, and continue to search in the first data string set whether there is a longest data string starting with the next byte.
[0158] In some embodiments, the data processing device 40 also includes a thread processing module 45, which is used to perform data segmentation on the first new file data and the first old file data according to a preset data volume threshold, respectively, to obtain N pairs of new and old file data blocks, where N is a positive integer greater than 1 and less than or equal to M, and M is the maximum value of processing threads executed in parallel; create N first processing threads, and the N first processing threads correspond one-to-one to the N pairs of new and old file data blocks; obtain patch files of N pairs of new and old file data blocks by performing data comparison on N pairs of new and old file data blocks in parallel through the N first processing threads; and generate a patch file of the first new file data based on the patch files of the N pairs of new and old file data blocks.
[0159] In some embodiments, the thread processing module 45 is further used to call the preset algorithm library through the first application thread of the first target application to initialize the preset parameters, the preset parameters including the data volume threshold and M; create the first management thread through the first application thread according to the first file update request. And execute the step of splitting the first new file data and the first old file data according to the preset data volume threshold respectively through the first management thread to obtain N pairs of new and old file data blocks; and execute the step of generating the patch file of the first new file data according to the patch files of the N pairs of new and old file data blocks through the first management thread.
[0160] In some embodiments, the thread processing module 45 is also used for the first application thread to write information of N first processing threads corresponding to the first file update request in the first storage space; the first management thread is also used to delete the information of N first processing threads after generating a patch file for the first new file data; when the first application thread writes data in the first storage space, the first management thread is prohibited from deleting data in the first storage space.
[0161] In some embodiments, the thread processing module 45 is also used for the first processing thread to write the processing status and / or processing progress of the first processing thread in the second storage space, and the first management thread to read the processing status and / or processing progress of the first processing thread from the second storage space; when the first processing thread writes data in the second storage space, the first management thread is prohibited from reading data in the second storage space.
[0162] In some embodiments, the thread processing module 45 is further used to create two first management threads through the first application; when one of the two first management threads reads the first old file data, the other first management thread of the two first management threads is prohibited from reading the first old file data.
[0163] In some embodiments, the thread processing module 45 is also used to receive a second file update request from the first device while receiving the first file update request, the second file update request including third new file data of the second target application; create a second application thread of the second target application according to the second file update request, the second application thread being used to initialize preset parameters by calling a preset algorithm library; create a second management thread through the second application thread; and prohibit the second application thread from calling the preset algorithm library when the first application thread calls the preset algorithm library.
[0164] In some embodiments, the first receiving module 41 is also used to receive an upgrade request from the second device, the upgrade request is used to request an upgrade of the first target application; in response to the upgrade request, obtain a patch file of the first target application; and send an upgrade response to the second device, the upgrade response including the patch file of the first target application.
[0165] The data processing device 40 provided in this embodiment is used to execute the technical solution in the embodiment of the method executed by the aforementioned server. Its implementation principle and technical effect are similar and will not be repeated here.
[0166] Fig.14 This is a schematic diagram of the structure of another embodiment of the data processing device of the data processing method provided by the present application. The device 50 can be integrated into the terminal device in the above method embodiment, and can also be implemented by the terminal device in the above method embodiment. Fig.14As shown, the data processing device 50 includes a second receiving module 51 , a first reading module 52 , a second reading module 53 and a new file data generating module 54 .
[0167] The second receiving module 51 is used to receive an upgrade response from the server, where the upgrade response includes a patch file of the first target application.
[0168] The first reading module 52 is used for reading at least one piece of reserved data from the first old file data according to the position information of the at least one piece of reserved data of the patch file in the first old file data and the data length of the at least one piece of reserved data.
[0169] The second reading module 53 is used to read, according to the interval length between adjacent reserved data in at least one piece of reserved data, new data having the same length as the interval length and position information of at least one piece of reserved data in the first new file data from the patch file.
[0170] The new file data generating module 54 is used to generate first new file data of a first target application according to the newly added data, the position information of at least one reserved data in the first new file data, and at least one reserved data block.
[0171] Fig.15 A schematic diagram of the structure of a server provided in this application. Fig.15 As shown, the server 60 includes: a processor 61, a memory 62 and a bus 63;
[0172] The memory 62 is used to store the computer program code of the processor 61;
[0173] The processor 61 is configured to execute the technical solution of the server in any of the aforementioned method embodiments by executing the computer program code.
[0174] Optionally, the memory 62 may be independent or integrated with the processor 61 .
[0175] The memory 62 is connected to the processor 61 via a bus 63 and completes communication with each other.
[0176] Optionally, the memory 62 may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0177] The bus 63 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0178] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0179] The server is used to execute the technical solution of the server in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0180] Fig.16 This is a schematic diagram of the structure of a terminal device provided by this application. Fig.16 As shown, the terminal device 70 includes: a processor 71, a memory 72 and a bus 73;
[0181] The memory 72 is used to store the computer program code of the processor 71;
[0182] The processor 71 is configured to execute the technical solution of the server in any of the aforementioned method embodiments by executing the computer program code.
[0183] Optionally, the memory 72 can be independent or integrated with the processor 71.
[0184] The memory 72 is connected to the processor 71 via a bus 73 and completes communication with each other.
[0185] Optionally, the memory 72 may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0186] The bus 73 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0187] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0188] The terminal device is used to execute the technical solution of the terminal device in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0189] An embodiment of the present application also provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the technical solution provided in any of the aforementioned embodiments is implemented.
[0190] An embodiment of the present application also provides a chip system, which is applied to a server or a terminal device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the server or the terminal device implements the technical solution provided by any of the aforementioned embodiments.
[0191] An embodiment of the present application also provides a computer program product, including a computer program, which is used to implement the technical solution provided by any of the aforementioned method embodiments when executed by a processor.
[0192] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0193] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: Applied to a server, the method comprises: receiving a first file update request from a first device, wherein the first file update request includes first new file data of a first target application; Acquire first old file data corresponding to the first new file data, and a first data string set, where the first data string set is data strings of different lengths created based on the first old file data and the first new file data; Determine, according to the first data string set and a preset data string length threshold, a retained data set and a newly added data set of the first new file data compared with the first old file data, the retained data set including at least one retained data, the newly added data set including at least one newly added data, and the data length of each retained data being greater than the data string length threshold; A patch file for the first new file data is generated based on the data length of the at least one retained data, the location information of the at least one newly added data in the first new file data, and the location information of the at least one retained data in the first new file data and the first old file data respectively, and the patch file is used to update data of the first target application.
2. The method according to claim 1, characterized in that The determining, according to the first data string set and a preset data string length threshold, a retained data set and a newly added data set of the first new file data compared with the first old file data includes: Starting from the first byte of the first new file data, searching the first data string set for the longest data string starting with the first byte; By comparing the length of the longest data string with the data string length threshold, determining whether to use the longest data string as a reserved data; After traversing all bytes of the first new file data, obtaining the reserved data set; The newly added data set is determined according to the position of the reserved data in the reserved data set in the first new file data.
3. The method according to claim 2, characterized in that The determining whether to use the longest data string as a piece of reserved data by comparing the length of the longest data string with the data string length threshold comprises: If the length of the longest data string is greater than the data string length threshold, determine to use the longest data string as a piece of reserved data, and start from a target byte of the first new file data, search in the first data string set whether there is a longest data string starting with the target byte, wherein the target byte is a byte determined by adding the length of the longest data string starting with the first byte to the first byte; If the length of the longest data string is less than or equal to the data string length threshold, starting from the next byte of the first byte, continue searching in the first data string set to see whether there is a longest data string starting with the next byte.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: According to a preset data volume threshold, data segmentation is performed on the first new file data and the first old file data respectively to obtain N pairs of new and old file data blocks, where N is a positive integer greater than 1 and less than or equal to M, and M is a maximum value of processing threads executed in parallel; Creating N first processing threads, wherein the N first processing threads correspond one-to-one to the N pairs of new and old file data blocks; By performing data comparison on the N pairs of new and old file data blocks in parallel by the N first processing threads, patch files of the N pairs of new and old file data blocks are obtained; A patch file for the first new file data is generated according to the patch files of the N pairs of new and old file data blocks.
5. The method according to claim 4, characterized in that The method further comprises: Initialize preset parameters by calling a preset algorithm library through a first application thread of the first target application, wherein the preset parameters include the data volume threshold and M; Creating a first management thread through the first application thread according to the first file update request; The step of dividing the first new file data and the first old file data according to a preset data volume threshold to obtain N pairs of new and old file data blocks includes: The step of performing data segmentation on the first new file data and the first old file data according to a preset data volume threshold to obtain N pairs of new and old file data blocks is performed by the first management thread; The step of creating N first processing threads includes: Creating the N first processing threads through the first management thread; The step of generating the patch file for the new file data based on the patch files of the N pairs of new and old file data blocks comprises: executing the step of generating the patch file for the first new file data based on the patch files of the N pairs of new and old file data blocks through the first management thread.
6. The method according to claim 5, characterized in that The first application thread is further used to write information of the N first processing threads corresponding to the first file update request in the first storage space; the first management thread is further used to delete the information of the N first processing threads after generating a patch file of the first new file data; When the first application thread writes data in the first storage space, the first management thread is prohibited from deleting data in the first storage space.
7. The method according to claim 5, characterized in that The first processing thread is used to write the processing status and / or processing progress of the first processing thread into the second storage space, and the first management thread is used to read the processing status and / or processing progress of the first processing thread from the second storage space; When the first processing thread writes data in the second storage space, the first management thread is prohibited from reading data in the second storage space.
8. The method according to claim 5, characterized in that If the first file update request includes first new file data and second new file data of the first target application, the first new file data and the second new file data both correspond to the first old file data; The creating a first management thread through the first application thread includes: Creating two first management threads through the first application program; When one of the two first management threads reads the first old file data, the other first management thread of the two first management threads is prohibited from reading the first old file data.
9. The method according to claim 5, characterized in that The method further comprises: While receiving the first file update request, receiving a second file update request from the first device, wherein the second file update request includes third new file data of the second target application; Creating a second application thread of the second target application according to the second file update request, wherein the second application thread is used to initialize preset parameters by calling the preset algorithm library; Creating a second management thread through the second application thread; When the first application thread calls the preset algorithm library, the second application thread is prohibited from calling the preset algorithm library.
10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: receiving an upgrade request from a second device, wherein the upgrade request is used to request an upgrade of the first target application; In response to the upgrade request, obtaining a patch file of the first target application; An upgrade response is sent to the second device, where the upgrade response includes a patch file of the first target application.
11. A data processing method, characterized in that: Applied to a terminal device, the method comprises: receiving an upgrade response from a server, wherein the upgrade response includes a patch file of a first target application; Reading at least one piece of reserved data from the first old file data according to the position information of the at least one piece of reserved data of the patch file in the first old file data and the data length of the at least one piece of reserved data; According to the interval length between adjacent reserved data in the at least one piece of reserved data, read new data having the same length as the interval length from the patch file, as well as position information of the at least one piece of reserved data in the first new file data; The first new file data of the first target application is generated according to the newly added data, the location information of the at least one reserved data in the first new file data, and the at least one reserved data block.
12. A server, characterized in that: include: Processor and memory; The memory is coupled to the processor, and the memory is used to store a computer program code. The processor calls the computer program code to enable the server to execute the method according to any one of claims 1 to 10.
13. A terminal device, characterized in that: include: Processor and memory; The memory is coupled to the processor, and the memory is used to store computer program codes. The processor calls the computer program codes to enable the terminal device to execute the method according to claim 11.
Citation Information
Patent Citations
Software upgrading method, device, system and medium
CN112416386A
Differential file generation method, reduction method and electronic equipment
CN116028095A
Data update system, differential data creating device and program for data update system, updated file restoring device and program
CN1726476A
Apparatus for updating software as an agent and patch method thereof
KR102088167B1
Cited By
Data processing method, server, and terminal device
EP4841959A1
Data processing method, server, and terminal device
WO2025148943A1
