Program update method and apparatus, device, storage medium, and computer program

By using matching sequences, operation sequences and non-matching data streams to generate differential packets on smart terminals, and using directed graph deloop processing technology, the problem of hard disk space occupation and low efficiency during program updates is solved, achieving faster and more efficient Streamlined update process.

WO2024212682A1PCT designated stage expired Publication Date: 2024-10-17HUAWEI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/075048
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-13
Filing Date
2024-01-31
Publication Date
2024-10-17

AI Technical Summary

Technical Problem

In the existing technology, when programs are updated on smart terminals, the size of the differential packet affects traffic costs and development cycles, and cannot effectively reduce hard disk space occupation, resulting in low update efficiency.

Method used

By determining the matching sequence, operation sequence and non-matching data flow between program files, differential packets are generated, and directed graph deloop processing technology is used to optimize differential packet generation, and string movement and filling are directly performed on the old version files to achieve newer changes. Faster, more cost-effective updates.

Benefits of technology

It reduces the hard disk space occupied by smart terminals, improves the efficiency and speed of program updates, reduces the size of differential packets, and optimizes the update process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024075048_17102024_PF_FP_ABST
    Figure CN2024075048_17102024_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of intelligent terminals, and discloses a program update method and apparatus, a device, a storage medium, and a computer program. The method comprises: determining a matching sequence on the basis of a first program file and a second program file, the matching sequence comprising multiple mutual matching fields, multiple self-matching fields, and multiple non-matching fields; determining an operation sequence on the basis of the multiple mutual matching fields; and generating a differential package on the basis of the matching sequence, the operation sequence, and a non-matching data stream. By means of different versions of program files of a same program, the same character string in the different versions of program files is determined, so as to obtain a matching sequence comprising multiple mutual matching fields, multiple self-matching fields and multiple non-matching fields and an operation sequence indicating an execution order of the mutual matching fields. The matching sequence, the operation sequence and the non-matching data steam are coded, so that a differential package can be generated more quickly, and fast and stream-saving program update can be implemented.
Need to check novelty before this filing date? Find Prior Art

Description

Program updating method, device, equipment, storage medium and computer program

[0001] This application claims priority to Chinese patent application number 202310430410.9, filed on April 13, 2023, entitled “Program updating method, device, equipment, storage medium and computer program”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of smart terminals, and in particular to a program updating method, apparatus, device, storage medium and computer program. Background Art

[0003] There are various programs running on smart terminals, and these programs often need to be updated and upgraded. In related technologies, the server generates a differential package based on the old version of the program file and the new version of the program file through a packaging tool, and sends the differential package to the smart terminal. The differential package indicates the difference between the old version of the program file and the new version of the program file. The smart terminal receives the differential package sent by the server, and uses a restore tool to generate a new version of the program file based on the currently running old version of the program file and the differential package. The new version of the program file is stored on the hard disk and the old version of the program file and the differential package stored on the hard disk are deleted, thereby realizing the update and upgrade of the program. However, the size of the differential package directly affects the traffic cost, development cycle, etc. required for the smart terminal to update the program.

[0004] Summary of the Invention

[0005] This application provides a program update method, apparatus, device, storage medium, and computer program that can achieve faster and more efficient program updates. The technical solution is as follows:

[0006] In a first aspect, a program update method is provided, which is applied to a server. In this method, a matching sequence is determined based on a first program file and a second program file, and the matching sequence includes multiple mutually matching fields, multiple self-matching fields, and multiple non-matching fields. An operation sequence is determined based on the multiple mutually matching fields, and the operation sequence indicates the order of some or all of the multiple mutually matching fields when restoring the second program file, and when the second program file is restored in the order indicated by the operation sequence, the character strings indicated by the multiple mutually matching fields will not overlap. A differential packet is generated based on the matching sequence, the operation sequence, and the non-matching data stream, and the differential packet indicates the difference between the first program file and the second program file.

[0007] Among them, the mutual match field indicates that a string in the second program file is the same as a string in the first program file, the self-match field indicates that a string in the second program file is the same as another string in the second program file, the non-match field indicates that a string in the second program file is the same as a string in the non-matching data stream, the first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than the version of the first program file.

[0008] By identifying identical strings within different versions of the same program file, the system generates a matching sequence consisting of multiple mutually matching fields, multiple self-matching fields, and multiple non-matching fields, along with an operation sequence indicating the order in which the mutually matching fields are executed. By encoding the matching sequence, operation sequence, and non-matching data stream, differential packets can be generated more quickly, enabling faster and more efficient program updates.

[0009] For example, an operation sequence is determined based on the multiple mutually matching fields according to the following steps (1)-(2).

[0010] (1) Determine a directed graph based on the multiple mutually matching fields, where the directed graph indicates a topological order of the multiple mutually matching fields.

[0011] A plurality of vertices of a directed graph are determined according to the order of the plurality of mutually matching fields in the matching sequence, wherein the plurality of vertices correspond one-to-one to the plurality of mutually matching fields. Two vertices are selected from the plurality of vertices, and it is determined whether the mutually matching fields corresponding to the two selected vertices intersect. If the mutually matching fields corresponding to the two selected vertices intersect, a directed edge is drawn between the two selected vertices. Every two vertices in the plurality of vertices are traversed in the same manner, thereby obtaining a directed graph.

[0012] (2) When the directed graph includes a directed closed loop, the directed graph is de-looped to obtain an operation sequence.

[0013] If a directed graph includes a directed closed loop, the topological order of the multiple mutually matching fields will change depending on the selected starting point. That is, if a vertex is arbitrarily selected from the directed closed loop as the starting point for the topological order of the multiple mutually matching fields, the topological order of the multiple mutually matching fields will be dependent on the selected starting point and will not be unique. Therefore, de-looping the directed graph is necessary.

[0014] For example, de-looping is performed on a directed graph in different ways to obtain an operation sequence, and three of these ways are described below.

[0015] In a first approach, a directed graph includes at least one directed closed loop. For each of the at least one directed closed loop, a target vertex in the directed closed loop is cut off to obtain a post-cut directed graph, where the target vertex is a vertex in the directed closed loop. An operation sequence is determined based on the topological order of the vertices in the post-cut directed graph. The operation sequence indicates the order in which the mutual matching fields, excluding the target mutual matching field, among the multiple mutual matching fields are to be restored when the second program file is restored. The target mutual matching field is the mutual matching field corresponding to the target vertex.

[0016] In a second method, a directed graph includes at least one directed closed loop. For each directed closed loop in the at least one directed closed loop, a target vertex in the directed closed loop is cut off to obtain a directed graph after the cut point, where the target vertex is a vertex in the directed closed loop. The target vertex is placed at the end of the directed graph after the cut point to obtain a revised topological order of the multiple vertices. An operation sequence is determined based on the revised topological order of the multiple vertices, and the operation sequence indicates the order of the multiple mutually matching fields when restoring the second program file.

[0017] In a third approach, a directed graph includes at least one directed closed loop. For each of the at least one directed closed loop, a target edge in the directed closed loop is cut off to obtain a directed graph after edge cutting, where the target edge is an outgoing edge of a vertex corresponding to a first mutual matching field and an incoming edge of a vertex corresponding to a second mutual matching field, and the first mutual matching field and the second mutual matching field are two mutual matching fields among the multiple mutual matching fields. An operation sequence is determined based on the topological order of each vertex in the directed graph after edge cutting, and the operation sequence indicates the order of the multiple mutual matching fields when restoring the second program file.

[0018] De-looping a directed graph in different ways to obtain an operation sequence will result in different operation sequences. Consequently, the process of generating differential packets based on matching sequences, operation sequences, and non-matching data streams also differs. Therefore, the following three cases will be explained separately.

[0019] In the first case, the directed graph is delooped according to the first method described above to obtain an operation sequence. In this case, the string indicated by the target mutual match field in the first program file is added to the non-matching data stream to obtain an updated non-matching data stream. The target mutual match field in the matching sequence is converted to a non-matching field to obtain an updated matching sequence. A differential packet is generated based on the updated matching sequence, the operation sequence, and the updated non-matching data stream.

[0020] That is, when the directed graph includes at least one directed closed loop, the target mutual matching field corresponding to the target vertex in each directed closed loop is converted into a non-matching field to obtain an updated matching sequence. Then, the string indicated by the target mutual matching field in the first program file is added to the non-matching data stream to obtain an updated non-matching data stream. The updated matching sequence, the operation sequence, and the updated non-matching data stream are then encoded according to the relevant algorithm to obtain a differential packet.

[0021] In the second case, the directed graph is delooped using the second method described above to obtain an operation sequence. In this case, a first identifier is added to the target mutual match field in the match sequence to obtain an updated match sequence. The first identifier indicates that the operation corresponding to the target mutual match field is a first-class hold operation. A differential packet is generated based on the updated match sequence, the operation sequence, and the non-matching data stream.

[0022] In other words, during the delooping process of the directed graph according to the second method described above, the target vertex in each directed closed loop is placed at the end of the other vertices in each directed closed loop, thereby changing the order of the multiple mutually matching fields when restoring the second program file, without removing the target mutually matching fields in the matching sequence. The updated matching sequence, operation sequence, and non-matching data stream are then encoded according to the relevant algorithm to obtain a differential packet.

[0023] The first type of suspension operation involves temporarily not moving the string indicated by the target mutual-matching field in the first program file. Instead, the strings indicated by the other mutual-matching fields in the first program file are first moved according to the order of the other mutual-matching fields indicated by the operation sequence. Then, the string indicated by the target mutual-matching field in the first program file is moved. The other mutual-matching fields and the target mutual-matching field belong to the same operation sequence, meaning that the vertices corresponding to the other mutual-matching fields and the vertices corresponding to the target mutual-matching field belong to the same directed subgraph.

[0024] In the third case, the directed graph is delooped according to the third method described above to obtain an operation sequence. In this case, a second flag is added to the first mutual match field in the match sequence to obtain an updated match sequence. The second flag indicates that the operation corresponding to the first mutual match field is a second-type hold operation. A differential packet is generated based on the updated match sequence, the operation sequence, and the non-matching data stream.

[0025] In other words, during the delooping process of the directed graph using the third method described above, only the execution order of the first mutually matching fields when restoring the second program file is changed; the first mutually matching fields in the matching sequence are not removed. The updated matching sequence, operation sequence, and non-matching data stream are then encoded using the relevant algorithm to generate a differential packet.

[0026] The second type of hold operation means temporarily not moving the overlapping strings between the string indicated by the first mutual match field in the first program file and the string indicated by the second mutual match field in the second program file connected by the target edge. Instead, the remaining strings indicated by the mutual match fields in the first program file are moved according to the order of the mutual match fields indicated by the same operation sequence. Then, the overlapping strings in the first program file are moved.

[0027] It should be noted that when de-looping a directed graph according to the above three methods, there is no need to consider how many directed subgraphs with directed closed loops the directed graph includes. That is, there is no need to consider whether the directed graph includes multiple regions connected by edges, and each region has a directed closed loop. Instead, after determining the directed graph based on the multiple mutually matching fields, if the directed graph includes a directed closed loop, the directed graph is directly de-looped according to any of the above three methods. In practical applications, if a directed graph includes multiple directed subgraphs with directed closed loops, if the directed graph is directly de-looped according to any of the above three methods, the efficiency of the directed graph de-looping will be affected. Therefore, in order to improve the efficiency of the directed graph de-looping, the directed graph is first divided into multiple directed subgraphs, and then each directed subgraph is de-looped. That is, if the directed graph includes a directed subgraph with a directed closed loop, the directed subgraph is de-looped according to any of the above three methods to obtain an operation sequence. In the case where a directed graph includes multiple directed subgraphs with directed closed loops, the edges between the multiple directed subgraphs are first cut off, and then each directed subgraph in the multiple directed subgraphs is de-looped according to any one of the three methods mentioned above to obtain multiple operation sequences, which correspond one-to-one to the multiple directed subgraphs.

[0028] In a second aspect, a program update method is provided, which is applied to a smart terminal. In this method, a differential package is obtained, which indicates the difference between a first program file and a second program file. The first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than the version of the first program file. The differential package is parsed to obtain a matching sequence, an operation sequence, and a non-matching data stream. The matching sequence includes multiple mutual matching fields, multiple self-matching fields, and multiple non-matching fields. The operation sequence indicates the order of the multiple mutual matching fields when restoring the second program file. The mutual matching field indicates that a string in the second program file is the same as a string in the first program file. The self-matching field indicates that a string in the second program file is the same as another string in the second program file. The non-matching field indicates that a string in the second program file is the same as a string in the non-matching data stream. According to the order indicated by the operation sequence, the strings indicated by the multiple mutual matching fields in the first program file are moved. According to the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, the strings indicated by the multiple self-matching fields in the first program file are moved. The strings indicated by the multiple non-matching fields in the non-matching data stream are moved to the first program file to obtain the second program file.

[0029] By improving the restoration tool on the smart terminal, the character strings indicated by the multiple mutually matching fields in the first program file are first moved in the order indicated by the operation sequence, and then the character strings indicated by the multiple self-matching fields and the multiple non-matching fields in the first program file are moved in the order indicated by the matching sequence. In this way, through the multiple mutually matching fields, the multiple self-matching fields and the multiple non-matching fields, the second program file can be restored completely and without overlap directly on the basis of the first program file. Compared with the related art of first generating a complete second program file and then replacing the first program file with the second program file, the embodiment of the present application can directly move and modify the character string on the first program file to obtain the second program file. That is, the second program file is obtained by moving the internal character string of the first program file and filling the non-matching data stream, thereby reducing the occupation of the hard disk space of the smart terminal and improving the efficiency of program updates.

[0030] After the smart terminal obtains the differential packet, it parses the differential packet according to the relevant algorithm to obtain a matching sequence, an operation sequence, and a non-matching data stream. Among them, the matching sequence obtained by the smart terminal from the differential packet parsing is not the matching sequence determined by the server based on the first program file and the second program file according to the above steps, but the updated matching sequence obtained after the server performs de-looping on the directed graph. That is, the server first determines the initial matching sequence based on the first program file and the second program file, and in the process of the server performing de-looping on the directed graph, the initial matching sequence is updated to obtain an updated matching sequence. The updated matching sequence includes multiple mutual matching fields, and the multiple mutual matching fields are part or all of the mutual matching fields in the multiple mutual matching fields included in the initial matching sequence.

[0031] Based on the above description, during the delooping process of the directed graph, the operation corresponding to the target mutual matching field corresponding to the target vertex is converted to a first-type hold operation, or the operation corresponding to the first mutual matching field corresponding to the target edge is converted to a second-type hold operation. In different cases, the strings indicated by the multiple mutual matching fields in the first program file are moved differently according to the order indicated by the operation sequence. Therefore, the following two cases are divided into the following two cases for explanation.

[0032] In the first case, the operation mode corresponding to the target mutual-match field corresponding to the target vertex is converted to a first-class hold operation. A mutual-match field is selected from the multiple mutual-match fields in the order indicated by the operation sequence. If the selected mutual-match field does not include the first identifier, the string indicated by the selected mutual-match field in the first program file is moved. If the selected mutual-match field includes the first identifier, the string indicated by the selected mutual-match field is retrieved from the target location and moved to the first program file. The first identifier indicates that the operation mode corresponding to the selected mutual-match field is a first-class hold operation.

[0033] Among them, the target location may be an idle area of ​​the hard disk of the intelligent terminal, or other external storage devices. That is, before the intelligent terminal moves the strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, it is also necessary to move the strings indicated by the mutually matching fields in the first program file whose operation mode is the first type of shelving operation and the second type of shelving operation to an idle area of ​​the hard disk or other external storage devices. In this way, it is possible to avoid the strings indicated by each mutually matching field from being overwritten, resulting in string movement conflicts. For example, when the first mutually matching field includes a first identifier, the string indicated by the first mutually matching field in the first program file is obtained, and the string indicated by the first mutually matching field is stored in the target location, and the first mutually matching field is any one of the multiple mutually matching fields. When the first mutually matching field includes a second identifier, the overlapping string of the string indicated by the first mutually matching field in the first program file and the string indicated by the second mutually matching field in the second program file is obtained, and the overlapping string is stored in the target location. When restoring the second program file, the order of the first mutually matching field is earlier than the order of the second mutually matching field.

[0034] It should be noted that, to avoid conflicts in the movement of the character strings indicated by the mutually matching fields, before the smart terminal moves the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, moving the character strings indicated by the mutually matching fields for the first type of suspension operation and the second type of suspension operation to a free area of ​​the hard disk or other external storage device is merely an example. Optionally, the smart terminal can also parse the character strings indicated by the mutually matching fields for the first type of suspension operation and the second type of suspension operation from the differential packet in real time during the process of moving the character strings indicated by the multiple mutually matching fields in the first program file. That is, after the server determines the operation mode corresponding to each mutually matching field in step 503, it incorporates the character strings indicated by the mutually matching fields for the first type of suspension operation and the second type of suspension operation into the differential packet. In this way, after receiving the differential packet sent by the server, the smart terminal can directly parse the character strings indicated by the mutually matching fields for the first type of suspension operation and the second type of suspension operation from the differential packet.

[0035] In the second case, the operation mode corresponding to the first mutual matching field corresponding to the target edge is converted into a second type of shelving operation. In the order indicated by the operation sequence, a mutual matching field is selected from the multiple mutual matching fields. When the selected mutual matching field does not include the second identifier, the character string indicated by the mutual matching field selected in the first program file is moved. When the selected mutual matching field includes the second identifier, the movable character string is determined based on the character string indicated by the mutual matching field selected in the first program file and the overlapping character string corresponding to the selected mutual matching field stored in the target position, and the movable character string in the first program file is moved, and the second identifier indicates that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation. When the selected mutual matching field is the last mutual matching field among the multiple mutual matching fields, after the movable character string is moved, the overlapping character string is moved to the first program file to be spliced ​​with the movable character string.

[0036] In a third aspect, a program updating device is provided, wherein the program updating device has the function of implementing the program updating method in the first aspect. The program updating device includes at least one module, wherein the at least one module is used to implement the program updating method provided in the first aspect.

[0037] In a fourth aspect, a program updating device is provided, wherein the program updating device has the function of implementing the program updating method in the second aspect. The program updating device includes at least one module, wherein the at least one module is used to implement the program updating method provided in the second aspect.

[0038] In a fifth aspect, a computer device is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program for executing the program update method provided in the first or second aspect. The processor is configured to execute the computer program stored in the memory to implement the program update method described in the first or second aspect.

[0039] Optionally, the computer device may further include a communication bus, which is used to establish a connection between the processor and the memory.

[0040] In a sixth aspect, a computer-readable storage medium is provided, wherein the storage medium stores instructions. When the instructions are executed on a computer, the computer executes the steps of the program updating method described in the first or second aspect above.

[0041] In a seventh aspect, a computer program product comprising instructions is provided. When the instructions are executed on a computer, the computer is caused to perform the steps of the program update method described in the first or second aspect. Alternatively, a computer program is provided. When the computer program is executed on a computer, the computer is caused to perform the steps of the program update method described in the first or second aspect.

[0042] The technical effects obtained in the above-mentioned second to seventh aspects are similar to the technical effects obtained by the corresponding technical means in the first or second aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] FIG1 is a schematic diagram illustrating a program updating method according to an embodiment of the related art;

[0044] FIG2 is a schematic diagram of a program update method provided in an embodiment of the present application;

[0045] FIG3 is a schematic diagram of the architecture of a program update system provided in an embodiment of the present application;

[0046] FIG4 is a schematic diagram of a program update method provided in an embodiment of the present application;

[0047] FIG5 is a flowchart of a program updating method provided in an embodiment of the present application;

[0048] FIG6 is a schematic diagram of determining a directed graph provided by an embodiment of the present application;

[0049] FIG7 is a schematic diagram of a method for performing de-looping on a directed graph according to an embodiment of the present application;

[0050] FIG8 is a schematic diagram of another method for performing de-looping on a directed graph according to an embodiment of the present application;

[0051] FIG9 is a schematic diagram of another method for performing de-looping on a directed graph provided in an embodiment of the present application;

[0052] FIG10 is a schematic diagram of another method for performing de-looping on a directed graph according to an embodiment of the present application;

[0053] FIG11 is a flow chart of a differential process provided in an embodiment of the present application;

[0054] FIG12 is a flowchart of another program updating method provided in an embodiment of the present application;

[0055] FIG13 is a flowchart of a restoration process provided by an embodiment of the present application;

[0056] FIG14 is a schematic structural diagram of a program updating device provided in an embodiment of the present application;

[0057] FIG15 is a schematic structural diagram of a program updating device provided in an embodiment of the present application;

[0058] FIG16 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0060] Before explaining in detail the program update method provided in the embodiment of the present application, the business scenarios and system architecture involved in the embodiment of the present application are first introduced.

[0061] First, the business scenarios involved in the embodiments of this application are introduced.

[0062] In order to update and upgrade the application or operating system running on the smart terminal, the relevant technology provides a variety of methods. After the development department formulates, develops, and generates the second program file, it uses a packaging tool to generate a differential package based on the first program file and the second program file. When the program needs to be updated or upgraded, the smart terminal downloads the differential package from the server, uses a restore tool to generate the second program file based on the first program file and the differential package, stores the second program file on the hard disk, and deletes the first program file and the differential package stored on the hard disk.

[0063] For example, please refer to Figure 1, which is a schematic diagram illustrating a program update method according to an embodiment of the related art. In Figure 1, the smart terminal's hard disk stores a currently running first program file and a differential package downloaded from a server. The smart terminal generates a complete second program file based on the first program file and the differential package. The second program file stored on the hard disk is then retained, and the first program file and the differential package stored on the hard disk are deleted, thereby implementing the program update.

[0064] It should be noted that when performing a program update according to the above method, it is necessary to copy some of the character strings in the first program file to the second program file based on the differential package. That is, some of the character strings in the second program file are copied from the first program file. Since the second program file is stored on the hard disk of the smart terminal, the size of the hard disk available space for the smart terminal must be at least equal to the size of the second program file. However, in actual applications, there may also be a situation where the size of the hard disk available space of the smart terminal is much smaller than the second program file, that is, the smart terminal is a thin device. At this time, it is impossible to achieve a program update by first generating a complete second program file and then replacing the first program file with the second program file. Therefore, an embodiment of the present application provides a program update method, which operates directly on the basis of the first program file according to the differential package, updates the first program file to the second program file, and achieves a program update and upgrade. For example, please refer to Figure 2, which is a schematic diagram of a program update method provided by an embodiment of the present application. In Figure 2, the hard disk of the smart terminal stores the currently running first program file and the differential package downloaded from the server. The smart terminal directly moves the character string in the first program file based on the differential package to obtain the second program file, reducing the space occupied by the smart terminal hard disk.

[0065] Next, the system architecture involved in the embodiments of the present application is introduced.

[0066] Please refer to Figure 3, which is a schematic diagram illustrating the architecture of a program update system according to an exemplary embodiment. The program update system includes a server 301 and a smart terminal 302, which are communicatively connected to each other. This communication connection can be a wired or wireless connection, which is not limited in this embodiment of the application.

[0067] Server 301 is configured to determine a matching sequence based on the first program file and the second program file, the matching sequence comprising a plurality of mutually matching fields, a plurality of self-matching fields, and a plurality of non-matching fields. An operation sequence is determined based on the plurality of mutually matching fields, the operation sequence indicating the order in which some or all of the plurality of mutually matching fields are to be used when restoring the second program file, and the character strings indicated by the plurality of mutually matching fields do not overlap when restoring the second program file in the order indicated by the operation sequence. A differential packet is generated based on the matching sequence, the operation sequence, and the non-matching data stream, the differential packet indicating the differences between the first program file and the second program file.

[0068] The server 301 is further configured to send a differential packet to the smart terminal 302. The smart terminal 302 parses the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream. The smart terminal 302 first moves the character string indicated by the mutual matching field in the first program file in the order indicated by the operation sequence, then moves the character string indicated by the self-matching field in the first program file in the order of the self-matching field and the non-matching field in the matching sequence, and moves the character string indicated by the non-matching field in the non-matching data stream to the first program file to obtain a second program file.

[0069] Among them, server 301 can be an independent server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or a cloud computing service center.

[0070] The smart terminal 302 can be any electronic product that can interact with a user through one or more methods such as a keyboard, touchpad, touch screen, remote control, voice interaction or handwriting device, such as a personal computer (PC), a mobile phone, a smart phone, a personal digital assistant (PDA), a wearable device, a pocket PC (PPC), a tablet computer, a smart car computer, a smart TV, a smart speaker, a sports watch, a sweeping robot, a smart door lock, etc.

[0071] Those skilled in the art should understand that the above-mentioned server 301 and smart terminal 302 are only examples. Other existing or future servers or smart terminals that are applicable to the embodiments of the present application should also be included in the scope of protection of the embodiments of the present application and are included here by reference.

[0072] It should be noted that the application scenarios and system architectures described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0073] Typically, the program update process includes two processes: differentiation and restoration. The differentiation process is performed by the server, and the restoration process is performed by the smart terminal. That is, the program update is achieved through interaction between the server and the smart terminal. For example, please refer to Figure 4, which is a schematic diagram of a program update method provided by an embodiment of the present application. In Figure 4, the server generates a differential package based on the first program file and the second program file. The smart terminal generates the second program file based on the first program file and the differential package.

[0074] The program update method provided in the embodiment of the present application includes two stages: a differential process and a restoration process, so they will be introduced separately below.

[0075] First, the difference process is explained in detail. Figure 5 is a flow chart of a program update method provided by an embodiment of the present application, which is applied to a server. Referring to Figure 5, the method includes the following steps.

[0076] Step 501: Determine a matching sequence based on a first program file and a second program file, where the matching sequence includes a plurality of mutual matching fields, a plurality of self-matching fields, and a plurality of non-matching fields.

[0077] The mutual match field indicates that a string in the second program file is identical to a string in the first program file. The self-match field indicates that a string in the second program file is identical to another string in the second program file. The non-match field indicates that a string in the second program file is identical to a string in a non-matching data stream. The first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than that of the first program file.

[0078] In some embodiments, a matching sequence is determined based on the first program file and the second program file using a dynamic programming or other related algorithm. Of course, in actual applications, the matching sequence determined based on the first program file and the second program file is not unique. For example, multiple matching sequences are determined based on the first program file and the second program file, and then the matching sequence with the shortest encoding length is selected from the multiple matching sequences.

[0079] Optionally, each of the multiple mutual match fields is a triplet, each mutual match field includes a match type, a match distance, and a match byte count, and each mutual match field indicates a string in the second program file and a string in the first program file, where the two strings are identical. The match distance refers to the distance between the starting position of a string in the second program file indicated by the mutual match field and the starting position of the corresponding string in the first program file, and the match byte count refers to the number of bytes included in the string in the second program file or the first program file indicated by the mutual match field, and both the match distance and the match byte count are integers.

[0080] For example, let the first program file be denoted as S and the second program file be denoted as T. The mutual match field is M=(oldmatch,dis tan ce,length), which indicates that S[t-dis tan ce,t-dis tan ce+length) is exactly the same as T[t,t+length). Among them, S[t-dis tan ce,t-dis tan ce+length) indicates a string in the first program file, the starting position of the string is t-dis tan ce, and the number of bytes included in the string is length. T[t,t+length) indicates a string in the second program file, the starting position of the string is t, and the number of bytes included in the string is length. That is to say, a mutual match field indicates a string in the second program file and a string in the first program file, and the two strings are the same. The mutual match field M=(oldmatch,dis tan ce,length) indicates that the string from t to t+length in the second program file is the same as the string from t-dis tan ce to t-dis tan ce+length in the first program file.

[0081] Of course, in actual applications, the mutual matching field can also include other data, such as the starting position of the string in the second program file. As long as the mutual matching field can indicate that a string in the second program file is the same as a string in the first program file, the embodiment of the present application does not limit this.

[0082] Optionally, each of the multiple self-matching fields is a triplet, and each self-matching field includes a match type, a match distance, and a match byte count. Each self-matching field indicates two identical character strings in the second program file. The match distance refers to the distance between the starting positions of the two identical character strings in the second program file indicated by the self-matching field, and the match byte count refers to the number of bytes included in either of the two identical character strings in the second program file indicated by the self-matching field.

[0083] For example, assuming that the self-matching field is M=(selfmatch,dis tan ce,length), the self-matching field indicates that T[t-dis tan ce,t-dis tan ce+length) is exactly the same as T[t,t+length). Among them, T[t-dis tan ce,t-dis tan ce+length) indicates a string in the second program file, the starting position of the string is t-dis tan ce, and the number of bytes included in the string is length. T[t,t+length) indicates another string in the second program file, the starting position of the string is t, and the number of bytes included in the string is length. That is to say, a self-matching field indicates two strings in the second program file, and the two strings are the same. The self-matching field M=(selfmatch,dis tan ce,length) indicates that the string from t to t+length in the second program file is the same as the string from t-dis tan ce to t-dis tan ce+length in the second program file.

[0084] Optionally, each of the multiple non-matching fields is a triplet, and each non-matching field includes a match type, a match distance, and a match byte count. Each non-matching field indicates a string in the second program file and a string in the non-matching data stream, and the two strings are the same. The match distance refers to the distance between the starting position of a string in the second program file indicated by the non-matching field and the starting position of the corresponding string in the non-matching data stream, and the match byte count refers to the number of bytes included in the string in the second program file indicated by the non-matching field or the non-matching data stream.

[0085] It should be noted that the non-matching data stream includes multiple character strings, which correspond one-to-one to the multiple non-matching fields. The starting position of the first character string in the non-matching data stream is the starting position of the non-matching data stream, and the starting position of the i-th character string in the non-matching data stream is the total number of bytes included in the first i-1 character strings in the non-matching data stream. Therefore, in practical applications, to reduce the number of bits required for encoding and improve encoding efficiency, each non-matching field in the multiple non-matching fields only includes the match type and the number of matching bytes.

[0086] For example, assuming that the non-match field is M=(nonmatch, length), the non-match field indicates that a string T[t, t+length) in the second program file is the same as a string in the non-match data stream, the starting position of the string is t, and the number of bytes included in the string is length.

[0087] It should be noted that the non-matching data stream may be composed of character strings in the second program file other than the character strings indicated by the mutual-matching field and the self-matching field. Of course, the non-matching data stream can also be obtained by other means, as long as the non-matching data stream includes the character strings indicated by each non-matching field.

[0088] Optionally, the order of the matching fields in the matching sequence is incremented from the start position of the second program file. Assume that the matching sequence includes three matching fields, and the order of the three matching fields is non-matching field M = (nonmatch, l1), mutual matching field M = (oldmatch, d2, l2), and self-matching field M = (selfmatch, d3, l3). That is, the second program file includes three areas, the first area corresponds to the non-matching field M = (nonmatch, l1), the second area corresponds to the mutual matching field M = (oldmatch, d2, l2), and the third area corresponds to the self-matching field M = (selfmatch, d3, l3). The starting position of the first area is t1, that is, the starting position of the second program file, the starting position of the second area is t2, t2 = t1 + l1, and the starting position of the third area is t3, t3 = t2 + l2. The string T[t1, t1 + l1) in the first area is the same as a string in the non-matching data stream, the string T[t2, t2 + l2) in the second area is exactly the same as a string S[t2-d2, t2-d2 + l2) in the first program file, and the string T[t3, t3 + l3) in the third area is exactly the same as a string T[t3-d3, t3-d3 + l3) in the second program file.

[0089] Step 502: Determine an operation sequence based on the multiple mutually matching fields, where the operation sequence indicates the order of some or all of the multiple mutually matching fields when restoring the second program file, and when the second program file is restored in the order indicated by the operation sequence, the character strings indicated by the multiple mutually matching fields will not overlap.

[0090] In some embodiments, an operation sequence is determined based on the multiple mutually matching fields according to the following steps (1)-(2).

[0091] (1) Determine a directed graph based on the multiple mutually matching fields, where the directed graph indicates a topological order of the multiple mutually matching fields.

[0092] A plurality of vertices of a directed graph are determined according to the order of the plurality of mutually matching fields in the matching sequence, wherein the plurality of vertices correspond one-to-one to the plurality of mutually matching fields. Two vertices are selected from the plurality of vertices, and it is determined whether the mutually matching fields corresponding to the two selected vertices intersect. If the mutually matching fields corresponding to the two selected vertices intersect, a directed edge is drawn between the two selected vertices. Every two vertices in the plurality of vertices are traversed in the same manner, thereby obtaining a directed graph.

[0093] For ease of description, the two selected vertices are referred to as the first vertex and the second vertex. If the mutual matching fields corresponding to the first vertex and the second vertex intersect, a directed edge is drawn between the first and second vertices. If the mutual matching fields corresponding to the first vertex and the second vertex do not intersect, no directed edge is drawn between the first and second vertices.

[0094] Based on the above description, a mutual matching field indicates a string in the second program file and a string in the first program file. That is, a mutual matching field indicates the position of a string in the first program file before and after the movement. In the case where the mutual matching field corresponding to the first vertex and the mutual matching field corresponding to the second vertex have an intersection, it indicates that the position of the string indicated by the mutual matching field corresponding to the first vertex after the movement and the position of the string indicated by the mutual matching field corresponding to the second vertex before the movement have an intersection. In this way, after the string indicated by the mutual matching field corresponding to the first vertex in the first program file is moved, the string indicated by the mutual matching field corresponding to the second vertex will be overwritten and cannot continue to move, resulting in a string movement conflict. In order to avoid string movement conflicts and ensure that the smart terminal can restore the second program file normally, the execution order of the mutual matching field corresponding to the second vertex must precede the mutual matching field corresponding to the first vertex. Therefore, a directed edge is constructed between the first vertex and the second vertex, and the direction of the directed edge is from the second vertex to the first vertex.

[0095] For example, a matching sequence includes four mutually matching fields, M1, M2, M3, and M4, arranged in sequence. Based on these four mutually matching fields, a directed graph is determined to include four vertices. A first vertex 1 and a second vertex 2 are selected from the four vertices. The mutually matching field corresponding to the first vertex 1 is M1, and the mutually matching field corresponding to the second vertex 2 is M2. As shown in Figure 6, M1 = (oldmatch, d1, l1, p1) indicates that the string T[p1, p1+l1) in the second program file is obtained by shifting the string S[p1-d1, p1-d1+l1) in the first program file. M2 = (oldmatch, d2, l2, p2) indicates that the string T[p2, p2+l2) in the second program file is obtained by shifting the string S[p2-d2, p2-d2+l2) in the first program file. Since T[p1, p1+l1) and S[p2-d2, p2-d2+l2) have an intersection, Therefore, the execution order of the mutual matching field M2 corresponding to the second vertex 2 must be before the mutual matching field M1 corresponding to the first vertex 1, so as to construct a directed edge from the second vertex 2 to the first vertex 1 between the first vertex 1 and the second vertex 2, and traverse every two vertices in the multiple vertices in turn to obtain the directed graph shown in Figure 6.

[0096] (2) When the directed graph includes a directed closed loop, the directed graph is de-looped to obtain an operation sequence.

[0097] If a directed graph includes a directed closed loop, the topological order of the multiple mutually matching fields will change depending on the selected starting point. That is, if a vertex is arbitrarily selected from the directed closed loop as the starting point for the topological order of the multiple mutually matching fields, the topological order of the multiple mutually matching fields will be dependent on the selected starting point and will not be unique. Therefore, de-looping the directed graph is necessary.

[0098] In some embodiments, a directed graph is de-looped in different ways to obtain an operation sequence, three of which are described below.

[0099] In a first approach, a directed graph includes at least one directed closed loop. For each of the at least one directed closed loop, a target vertex in the directed closed loop is cut off to obtain a post-cut directed graph, where the target vertex is a vertex in the directed closed loop. An operation sequence is determined based on the topological order of the vertices in the post-cut directed graph. The operation sequence indicates the order in which the mutual matching fields, excluding the target mutual matching field, among the multiple mutual matching fields are to be restored when the second program file is restored. The target mutual matching field is the mutual matching field corresponding to the target vertex.

[0100] A directed graph includes at least one directed closed loop. For each directed closed loop in the at least one directed closed loop, a target vertex in the directed closed loop needs to be cut off to obtain a directed graph after the point of tangency. That is, for any directed closed loop in the at least one directed closed loop, a target vertex is determined from a plurality of vertices included in the directed closed loop, the target vertex in the directed closed loop is cut off, and the target vertices of the other directed closed loops in the at least one directed closed loop are cut off in the same manner to obtain a directed graph after the point of tangency.

[0101] According to the above content, each directed closed loop in the at least one directed closed loop includes a target vertex, and the mutual matching field corresponding to the target vertex is called the target mutual matching field. The directed graph after the tangent point includes vertices other than the target vertices. Since the vertices correspond to the mutual matching fields one-to-one, the topological order of the vertices in the directed graph after the tangent point is directly determined as the order of the mutual matching fields other than the target mutual matching fields when restoring the second program file, thereby obtaining an operation sequence. In other words, the operation sequence indicates the order of some of the multiple mutual matching fields when restoring the second program file.

[0102] For example, for any directed closed loop in the at least one directed closed loop, the vertex with the least number of character strings indicated by the corresponding mutual matching field is determined from the multiple vertices included in the directed closed loop to obtain the target vertex of the directed closed loop. In other words, the target vertex has the least number of character strings indicated by the target mutual matching field. This helps reduce the size of the differential packet. Of course, in actual applications, the target vertex of the directed closed loop can also be determined in other ways, as long as the size of the subsequently generated differential packet is minimized.

[0103] For example, please refer to Figure 7, which is a schematic diagram of a de-looping process for a directed graph provided by an embodiment of the present application. In the left figure of Figure 7, the directed graph includes a directed closed loop, and the directed graph includes four vertices 1, 2, 3, and 4. The mutual matching field corresponding to vertex 1 is M1, the mutual matching field corresponding to vertex 2 is M2, the mutual matching field corresponding to vertex 3 is M3, and the mutual matching field corresponding to vertex 4 is M4. Assume that the target vertex in the directed closed loop is vertex 4, and the directed graph after cutting off vertex 4 is shown in the right figure. The directed graph after the cutting point includes vertices 1, 2, and 3. According to the topological order of each vertex in the directed graph after the cutting point, the order of the other mutual matching fields except the mutual matching field M4 when restoring the second program file is determined to be {M3, M2, M1}, that is, the operation sequence is C = {M3, M2, M1}.

[0104] In a second method, a directed graph includes at least one directed closed loop. For each directed closed loop in the at least one directed closed loop, a target vertex in the directed closed loop is cut off to obtain a directed graph after the cut point, where the target vertex is a vertex in the directed closed loop. The target vertex is placed at the end of the directed graph after the cut point to obtain a revised topological order of the multiple vertices. An operation sequence is determined based on the revised topological order of the multiple vertices, and the operation sequence indicates the order of the multiple mutually matching fields when restoring the second program file.

[0105] Based on the above description, each directed closed loop in the at least one directed closed loop includes a target vertex, and the mutual matching field corresponding to the target vertex is called a target mutual matching field. The directed graph after the tangent point includes other vertices except the target vertices, and the target vertex is placed at the end of the directed graph after the tangent point to obtain a directed graph after the de-looping process. The directed graph after the de-looping process includes a plurality of vertices corresponding one-to-one to the plurality of mutual matching fields, so the topological order of the corrected plurality of vertices is directly determined as the order of the plurality of mutual matching fields when restoring the second program file to obtain an operation sequence. That is, the operation sequence indicates the order of all the mutual matching fields in the plurality of mutual matching fields when restoring the second program file.

[0106] For example, please refer to Figure 8, which is a schematic diagram of another method for de-looping a directed graph provided by an embodiment of the present application. In the left figure of Figure 8, the directed graph includes a directed closed loop, and the directed graph includes four vertices 1, 2, 3, and 4. The mutual matching field corresponding to vertex 1 is M1, the mutual matching field corresponding to vertex 2 is M2, the mutual matching field corresponding to vertex 3 is M3, and the mutual matching field corresponding to vertex 4 is M4. Assume that the target vertex in the directed closed loop is vertex 4, and vertex 4 is cut off to obtain the directed graph after the cut point. The directed graph after the cut point includes vertices 1, 2, and 3. Vertex 4 is placed at the end of the directed graph after the cut point, and the topological order of the corrected vertices is shown in the right figure. According to the topological order of the corrected vertices, the order of the four mutual matching fields when restoring the second program file is determined to be {M3, M2, M1, M4}, that is, the operation sequence is C = {M3, M2, M1, M4}.

[0107] In a third approach, a directed graph includes at least one directed closed loop. For each of the at least one directed closed loop, a target edge in the directed closed loop is cut off to obtain a directed graph after edge cutting, where the target edge is an outgoing edge of a vertex corresponding to a first mutual matching field and an incoming edge of a vertex corresponding to a second mutual matching field, and the first mutual matching field and the second mutual matching field are two mutual matching fields among the multiple mutual matching fields. An operation sequence is determined based on the topological order of each vertex in the directed graph after edge cutting, and the operation sequence indicates the order of the multiple mutual matching fields when restoring the second program file.

[0108] A directed graph includes at least one directed closed loop. For each directed closed loop in the at least one directed closed loop, a target edge in the directed closed loop needs to be cut off to obtain a trimmed directed graph. That is, for any directed closed loop in the at least one directed closed loop, a target edge is determined from the multiple edges included in the directed closed loop, the target edge in the directed closed loop is cut off, and the target edges of the other directed closed loops in the at least one directed closed loop are cut off in the same manner to obtain a trimmed directed graph.

[0109] According to the above, each of the at least one directed closed loop includes a target edge, which is an outgoing edge of the vertex corresponding to the first mutually matching field and an incoming edge of the vertex corresponding to the second mutually matching field. The directed graph after edge pruning still includes the multiple vertices. Since vertices correspond one-to-one to mutually matching fields, the topological order of each vertex in the directed graph after edge pruning is directly determined as the order of the multiple mutually matching fields when restoring the second program file, thereby obtaining an operation sequence. In other words, the operation sequence indicates the order of all the multiple mutually matching fields when restoring the second program file.

[0110] Among them, the target edge in each directed closed loop is determined according to any relevant algorithm among the in-degree + out-degree greedy method, the greedy random adaptive algorithm, the dynamic programming algorithm, and the Cartesian algorithm, as long as the size of the subsequently generated differential packet is minimized.

[0111] For example, please refer to Figure 9, which is a schematic diagram of another method of de-looping a directed graph provided by an embodiment of the present application. In the left figure of Figure 9, the directed graph includes a directed closed loop, and the directed graph includes four vertices 1, 2, 3, and 4. The mutual matching field corresponding to vertex 1 is M1, the mutual matching field corresponding to vertex 2 is M2, the mutual matching field corresponding to vertex 3 is M3, and the mutual matching field corresponding to vertex 4 is M4. Assume that the target edge in the directed closed loop is the directed edge between vertex 2 and vertex 4, and the directed graph after cutting the target edge is shown in the right figure. According to the topological order of each vertex in the directed graph after cutting the edge, it is determined that the order of the four mutual matching fields when restoring the second program file is {M4, M3, M2, M1}, that is, the operation sequence is C = {M4, M3, M2, M1}.

[0112] It should be noted that when de-looping a directed graph according to the above three methods, there is no need to consider how many directed subgraphs with directed closed loops the directed graph includes. That is, there is no need to consider whether the directed graph includes multiple regions connected by edges, and each region has a directed closed loop. Instead, after determining the directed graph based on the multiple mutually matching fields, if the directed graph includes a directed closed loop, the directed graph is directly de-looped according to any of the above three methods. In practical applications, if a directed graph includes multiple directed subgraphs with directed closed loops, if the directed graph is directly de-looped according to any of the above three methods, the efficiency of the directed graph de-looping will be affected. Therefore, in other embodiments, in order to improve the efficiency of the directed graph de-looping, the directed graph is first divided into multiple directed subgraphs, and then each directed subgraph is de-looped. That is, if the directed graph includes a directed subgraph with a directed closed loop, the directed subgraph is de-looped according to any of the above three methods to obtain an operation sequence. In the case where a directed graph includes multiple directed subgraphs with directed closed loops, the edges between the multiple directed subgraphs are first cut off, and then each directed subgraph in the multiple directed subgraphs is de-looped according to any one of the three methods mentioned above to obtain multiple operation sequences, which correspond one-to-one to the multiple directed subgraphs.

[0113] Of course, in practical applications, after severing the edges between the multiple directed subgraphs using the third method described above, it is necessary to determine the cost of slicing the directed graph into multiple directed subgraphs using a relevant algorithm. The slicing cost increases with the number of slicing steps. Given the limitations of server hardware configuration, the number of slicing steps should not be too large. Typically, a directed graph is sliced ​​into 2-5 directed subgraphs.

[0114] For example, please refer to Figure 10, which is a schematic diagram of another method of de-looping a directed graph provided by an embodiment of the present application. In Figure 10, the directed graph includes a directed subgraph 1 and a directed subgraph 2 having directed closed loops. Both directed subgraph 1 and directed subgraph 2 include two directed closed loops. When de-looping a directed graph, the edges between the two directed subgraphs are first cut off, and then each of the two directed subgraphs is de-looped according to any of the three methods mentioned above.

[0115] Of course, in practical applications, there may be cases where the directed graph does not include a directed closed loop. In this case, there is no need to remove the loop from the directed graph, but the topological order of each vertex in the directed graph is directly determined as the operation sequence.

[0116] It should be noted that the operation sequence includes the identifiers corresponding to each mutual matching field, rather than each mutual matching field. This can reduce the amount of data in the operation sequence and, in turn, reduce the size of the subsequently generated differential packet. Of course, in some cases, the operation sequence may also include each mutual matching field, which is not limited in this embodiment of the present application.

[0117] Step 503: Generate a differential packet based on the matching sequence, the operation sequence, and the non-matching data stream, where the differential packet indicates the difference between the first program file and the second program file.

[0118] In step 502, the directed graph is delooped in different ways to obtain an operation sequence. The resulting operation sequences are different depending on the delooping method. Consequently, the process of generating differential packets based on the matching sequence, operation sequence, and non-matching data stream is also different. Therefore, the following three cases will be described separately.

[0119] In the first case, the directed graph is delooped according to the first method described above to obtain an operation sequence. In this case, the string indicated by the target mutual match field in the first program file is added to the non-matching data stream to obtain an updated non-matching data stream. The target mutual match field in the matching sequence is converted to a non-matching field to obtain an updated matching sequence. A differential packet is generated based on the updated matching sequence, the operation sequence, and the updated non-matching data stream.

[0120] That is, when the directed graph includes at least one directed closed loop, the target mutual matching field corresponding to the target vertex in each directed closed loop is converted into a non-matching field to obtain an updated matching sequence. Then, the string indicated by the target mutual matching field in the first program file is added to the non-matching data stream to obtain an updated non-matching data stream. The updated matching sequence, the operation sequence, and the updated non-matching data stream are then encoded according to the relevant algorithm to obtain a differential packet.

[0121] Based on the description above, the mutual match field indicates that a string in the second program file is identical to a string in the first program file, and the non-match field indicates that a string in the second program file is identical to a string in the non-match data stream. Therefore, when converting the target mutual match field to a non-match field, the string indicated by the target mutual match field in the first program file is directly added to the non-match data stream.

[0122] For example, using Figure 7 above, the target vertex in the directed closed loop is vertex 4, and the mutual matching field corresponding to vertex 4 is M4. After removing vertex 4, the string S[p4-d4,p4-d4+l4) indicated by the mutual matching field M4 in the first program file is added to the non-matching data stream, converting the mutual matching field M4 in the matching sequence into a non-matching field.

[0123] In the second case, the directed graph is delooped using the second method described above to obtain an operation sequence. In this case, a first identifier is added to the target mutual match field in the match sequence to obtain an updated match sequence. The first identifier indicates that the operation corresponding to the target mutual match field is a first-class hold operation. A differential packet is generated based on the updated match sequence, the operation sequence, and the non-matching data stream.

[0124] In other words, during the delooping process of the directed graph according to the second method described above, the target vertex in each directed closed loop is placed at the end of the other vertices in each directed closed loop, thereby changing the order of the multiple mutually matching fields when restoring the second program file, without removing the target mutually matching fields in the matching sequence. The updated matching sequence, operation sequence, and non-matching data stream are then encoded according to the relevant algorithm to obtain a differential packet.

[0125] The first type of suspension operation involves temporarily not moving the string indicated by the target mutual-matching field in the first program file. Instead, the strings indicated by the other mutual-matching fields in the first program file are first moved according to the order of the other mutual-matching fields indicated by the operation sequence. Then, the string indicated by the target mutual-matching field in the first program file is moved. The other mutual-matching fields and the target mutual-matching field belong to the same operation sequence, meaning that the vertices corresponding to the other mutual-matching fields and the vertices corresponding to the target mutual-matching field belong to the same directed subgraph.

[0126] Optionally, after de-looping the directed graph in the second manner, a third identifier can be added to other mutual matching fields in the matching sequence except the target mutual matching field, and the third identifier indicates that the operation mode corresponding to the other mutual matching fields is a non-suspend operation.

[0127] The first identifier and the third identifier are pre-set, for example, the first identifier is stash-short and the third identifier is normal. Moreover, the first identifier and the third identifier can be adjusted according to different requirements.

[0128] 8 as an example, the target vertex in the directed closed loop is vertex 4, and the mutual matching field corresponding to vertex 4 is M4. After vertex 4 is cut off, a first identifier is added to the mutual matching field M4 in the matching sequence.

[0129] In the third case, the directed graph is delooped according to the third method described above to obtain an operation sequence. In this case, a second flag is added to the first mutual match field in the match sequence to obtain an updated match sequence. The second flag indicates that the operation corresponding to the first mutual match field is a second-type hold operation. A differential packet is generated based on the updated match sequence, the operation sequence, and the non-matching data stream.

[0130] In other words, during the delooping process of the directed graph using the third method described above, only the execution order of the first mutually matching fields when restoring the second program file is changed; the first mutually matching fields in the matching sequence are not removed. The updated matching sequence, operation sequence, and non-matching data stream are then encoded using the relevant algorithm to generate a differential packet.

[0131] The second type of hold operation means temporarily not moving the overlapping strings between the string indicated by the first mutual match field in the first program file and the string indicated by the second mutual match field in the second program file connected by the target edge. Instead, the remaining strings indicated by the mutual match fields in the first program file are moved according to the order of the mutual match fields indicated by the same operation sequence. Then, the overlapping strings in the first program file are moved.

[0132] The second identifier is pre-set, for example, the second identifier is stash-long. Moreover, the second identifier can be adjusted according to different requirements.

[0133] For example, using Figure 9 above as an example, the target edge in the directed closed loop is the directed edge between vertex 2 and vertex 4. The target edge is the outgoing edge of vertex 2 corresponding to the first mutual matching field M2 and the incoming edge of vertex 4 corresponding to the second mutual matching field M4. After the target edge is cut off, the second identifier is added to the first mutual matching field M2 in the matching sequence.

[0134] It should be noted that, in the case where the directed graph includes a directed closed loop, the updated matching sequence obtained by de-looping the directed graph may differ from the order of the various matching fields in the matching sequence determined based on the first program file and the second program file in the above step 501. In order to facilitate the subsequent intelligent terminal to move the character string indicated by the matching field included in the updated matching sequence in the first program file according to the operation sequence, it is also necessary to determine the starting position of the character string in the second program file indicated by each matching field in the updated matching sequence according to the relevant algorithm. That is, each matching field is converted from a triple to a quadruple, and each matching field includes a matching type, a matching distance, a matching byte number and a matching position, and the matching position refers to the starting position of a character string in the second program file indicated by the matching field.

[0135] For example, please refer to Figure 11, which is a flowchart of a differential process provided by an embodiment of the present application. In Figure 11, the server determines a matching sequence based on the first program file and the second program file. A directed graph is determined based on the multiple mutually matching fields included in the matching sequence. If the directed graph includes a directed closed loop, the directed graph is delooped to obtain an operation sequence. The matching sequence, the operation sequence, and the non-matching data stream are then encoded to generate a differential packet.

[0136] In an embodiment of the present application, by improving the packaging tool on the server, combining different versions of program files of the same program, determining the same character strings in different versions of program files, obtaining a matching sequence including multiple mutual matching fields, multiple self-matching fields and multiple non-matching fields, and an operation sequence indicating the execution order of the mutual matching fields. By encoding the matching sequence, the operation sequence and the non-matching data stream, it is possible to generate differential packets more quickly, achieving a faster and more stream-saving program update. In addition, an embodiment of the present application also provides a variety of ways to carry out de-ringing of directed graphs, and different de-ringing processing methods correspond to different differential packet sizes and the occupancy requirements of the intelligent terminal hard disk space. Therefore, the server can select different de-ringing processing methods in combination with the size of the available space on the intelligent terminal hard disk, that is, the redundancy of the swap area, to solve the problem of string movement conflict.

[0137] Next, the restoration process is explained in detail. FIG12 is a flow chart of another program update method provided by an embodiment of the present application, which is applied to a smart terminal. Referring to FIG12 , the method includes the following steps.

[0138] Step 1201: Obtain a differential package, where the differential package indicates the difference between a first program file and a second program file. The first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than that of the first program file.

[0139] In some embodiments, the smart terminal sends a program update request to the server, the program update request carrying a program identifier. The server receives the program update request from the smart terminal, obtains a differential package based on the program identifier from a stored correspondence between the program identifier and the differential package, and then sends the differential package to the smart terminal.

[0140] The program identifier is used to uniquely identify the program to be updated. The program identifier may be the program number, name, type, model, etc., or a combination of these information.

[0141] Optionally, the program update request can also carry other information, such as the version number of the first program file, etc., which is not limited in the embodiments of the present application. Since the program to be updated may have different versions of program files, and the server stores differential packages corresponding to different versions of program files. Therefore, in the case where the program update request sent by the smart terminal carries the version number of the first program file, after the server receives the program update request sent by the smart terminal, based on the version number of the first program file, it obtains the differential package from the corresponding relationship between the stored version number and the differential package, and then sends the differential package to the smart terminal.

[0142] In other embodiments, after the server generates a differential package based on the first program file and the second program file according to steps 501-503, it can directly send the differential package to the smart terminal, so that the smart terminal obtains the differential package and performs program update.

[0143] Step 1202: Parse the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream. The matching sequence includes multiple mutual matching fields, multiple self-matching fields, and multiple non-matching fields. The operation sequence indicates the order of the multiple mutual matching fields when restoring the second program file. The mutual matching field indicates that a string in the second program file is the same as a string in the first program file. The self-matching field indicates that a string in the second program file is the same as another string in the second program file. The non-matching field indicates that a string in the second program file is the same as a string in the non-matching data stream.

[0144] After the intelligent terminal obtains the differential packet, it parses the differential packet according to the relevant algorithm to obtain a matching sequence, an operation sequence, and a non-matching data stream. Among them, the matching sequence obtained by the intelligent terminal from the differential packet parsing is not the matching sequence determined by the server based on the first program file and the second program file according to the above step 501, but the updated matching sequence obtained after the server performs de-looping on the directed graph. That is, the server first determines the initial matching sequence based on the first program file and the second program file, and in the process of the server performing de-looping on the directed graph, the initial matching sequence is updated to obtain an updated matching sequence. The updated matching sequence includes multiple mutual matching fields, and the multiple mutual matching fields are part or all of the mutual matching fields in the multiple mutual matching fields included in the initial matching sequence.

[0145] Step 1203: Move the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, move the character strings indicated by the multiple self-matching fields in the first program file in the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, and move the character strings indicated by the multiple non-matching fields in the non-matching data stream to the first program file to obtain a second program file.

[0146] The intelligent terminal first moves the character strings indicated by the multiple mutually matching fields in the first program file according to the order of the multiple mutually matching fields indicated by the operation sequence, that is, operates the multiple mutually matching fields. Then, the intelligent terminal moves the character strings indicated by the multiple self-matching fields and the multiple non-matching fields in the first program file according to the order of the multiple self-matching fields and the multiple non-matching fields indicated by the matching sequence, that is, operates the multiple self-matching fields and the multiple non-matching fields to obtain a complete second program file. In other words, through the multiple mutually matching fields, the multiple self-matching fields, and the multiple non-matching fields, the intelligent terminal directly restores the second program file in its entirety and without overlap based on the first program file, without having to first generate a complete second program file and then replace the first program file with the second program file, thereby reducing the space occupied by the intelligent terminal hard disk and improving the efficiency of program updates.

[0147] Based on the above description, during the delooping process of the directed graph, the operation corresponding to the target mutual matching field corresponding to the target vertex is converted to a first-type hold operation, or the operation corresponding to the first mutual matching field corresponding to the target edge is converted to a second-type hold operation. In different cases, the strings indicated by the multiple mutual matching fields in the first program file are moved differently according to the order indicated by the operation sequence. Therefore, the following two cases are divided into the following two cases for explanation.

[0148] In the first case, the operation mode corresponding to the target mutual-match field corresponding to the target vertex is converted to a first-class hold operation. A mutual-match field is selected from the multiple mutual-match fields in the order indicated by the operation sequence. If the selected mutual-match field does not include the first identifier, the string indicated by the selected mutual-match field in the first program file is moved. If the selected mutual-match field includes the first identifier, the string indicated by the selected mutual-match field is retrieved from the target location and moved to the first program file. The first identifier indicates that the operation mode corresponding to the selected mutual-match field is a first-class hold operation.

[0149] If the selected mutual-match field does not include the first identifier, the operation mode corresponding to the selected mutual-match field is a non-suspend operation. In this case, the character string indicated by the selected mutual-match field in the first program file is moved to the matching position included in the selected mutual-match field. If the selected mutual-match field includes the first identifier, the operation mode corresponding to the selected mutual-match field is a first-type suspend operation. In this case, based on the identifier of the selected mutual-match field, the character string indicated by the selected mutual-match field in the first program file is retrieved from the target location. The retrieved character string is then moved to the matching position included in the selected mutual-match field.

[0150] Among them, the target location may be an idle area of ​​the hard disk of the intelligent terminal, or other external storage devices. That is, before the intelligent terminal moves the strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, it is also necessary to move the strings indicated by the mutually matching fields in the first program file whose operation mode is the first type of shelving operation and the second type of shelving operation to an idle area of ​​the hard disk or other external storage devices. In this way, it is possible to avoid the strings indicated by each mutually matching field from being overwritten, resulting in string movement conflicts. For example, when the first mutually matching field includes a first identifier, the string indicated by the first mutually matching field in the first program file is obtained, and the string indicated by the first mutually matching field is stored in the target location, and the first mutually matching field is any one of the multiple mutually matching fields. When the first mutually matching field includes a second identifier, the overlapping string of the string indicated by the first mutually matching field in the first program file and the string indicated by the second mutually matching field in the second program file is obtained, and the overlapping string is stored in the target location. When restoring the second program file, the order of the first mutually matching field is earlier than the order of the second mutually matching field.

[0151] It should be noted that, to avoid conflicts in the movement of the strings indicated by the mutually matching fields, before the smart terminal moves the strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, moving the strings indicated by the mutually matching fields for the first type of pending operation and the second type of pending operation to a free area of ​​the hard disk or other external storage device is merely an example. In other embodiments, the smart terminal can also parse the strings indicated by the mutually matching fields for the first type of pending operation and the second type of pending operation from the differential packet in real time while moving the strings indicated by the multiple mutually matching fields in the first program file. That is, after the server determines the operation mode corresponding to each mutually matching field in step 503, it incorporates the strings indicated by the mutually matching fields for the first type of pending operation and the second type of pending operation into the differential packet. In this way, after receiving the differential packet sent by the server, the smart terminal can directly parse the strings indicated by the mutually matching fields for the first type of pending operation and the second type of pending operation from the differential packet.

[0152] For example, using FIG8 as an example, assuming the operation sequence is C = {M3, M2, M1, M4}, the character strings indicated by the mutually matching fields M3, M2, M1, and M4 in the first program file are moved in the order indicated by the operation sequence. Because mutually matching field M4 includes the first identifier, the character string S[p4-d4, p4-d4+l4] indicated by mutually matching field M4 in the first program file is retrieved from the target position. The matching position included in mutually matching field M4 is p4, so the retrieved character string S[p4-d4, p4-d4+l4) is moved to p4.

[0153] In the second case, the operation mode corresponding to the first mutual matching field corresponding to the target edge is converted into a second type of shelving operation. In the order indicated by the operation sequence, a mutual matching field is selected from the multiple mutual matching fields. When the selected mutual matching field does not include the second identifier, the character string indicated by the mutual matching field selected in the first program file is moved. When the selected mutual matching field includes the second identifier, the movable character string is determined based on the character string indicated by the mutual matching field selected in the first program file and the overlapping character string corresponding to the selected mutual matching field stored in the target position, and the movable character string in the first program file is moved, and the second identifier indicates that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation. When the selected mutual matching field is the last mutual matching field among the multiple mutual matching fields, after the movable character string is moved, the overlapping character string is moved to the first program file to be spliced ​​with the movable character string.

[0154] In the case where the selected mutual matching field does not include the second identifier, it indicates that the operation mode corresponding to the selected mutual matching field is a non-suspend operation. At this time, the character string indicated by the selected mutual matching field in the first program file is moved to the matching position included in the selected mutual matching field. In the case where the selected mutual matching field includes the second identifier, it indicates that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation. At this time, based on the identifier of the selected mutual matching field, the overlapping character string indicated by the selected mutual matching field in the first program file is obtained from the target position. Then, according to the relevant algorithm, based on the character string indicated by the selected mutual matching field in the first program file and the overlapping character string indicated by the selected mutual matching field, a movable character string is determined, and the movable character string is moved to the matching position included in the selected mutual matching field. In the case where the selected mutual matching field is the last mutual matching field among the multiple mutual matching fields, after the movable character string is moved, the overlapping character string indicated by the selected mutual matching field is moved to the first program file, and the overlapping character string and the movable character string are spliced. When the selected mutual matching field is not the last mutual matching field among the multiple mutual matching fields, after moving the movable character string, continue to select the next mutual matching field in the order indicated by the operation sequence, and then move the character string indicated by the next mutual matching field in the first program file until the selected mutual matching field is the last mutual matching field in the operation sequence.

[0155] For example, taking FIG. 9 above as an example, assuming that the operation sequence is C={M4, M3, M2, M1}, the character strings indicated by the mutually matching fields M4, M3, M2, and M1 in the first program file are moved in sequence according to the order indicated by the operation sequence. Since the mutually matching field M2 includes a second identifier, the overlapping character string S[p2'-d2', p2'-d2'+l2') indicated by the mutually matching field M2 in the first program file is obtained from the target position. Based on the character string S[p2-d2, p2-d2+l2) indicated by the mutually matching field M2 in the first program file and the overlapping character string S[p2'-d2', p2'-d2'+l2'), a movable character string S[p2"-d2", p2"-d2"+l2") is determined, and then the movable character string S[p2"-d2", p2"-d2"+l2") is moved to the matching position p2 included in the mutually matching field M2. Since the mutual matching field M2 is not the last mutual matching field in the operation sequence, after the movable string S[p2"-d2", p2"-d2"+l2") is moved to the matching position p2 included in the mutual matching field M2, the string indicated by the mutual matching field M1 in the first program file is continued to be moved. After the string indicated by the mutual matching field M1 in the first program file is moved, the overlapping string S[p2'-d2', p2'-d2'+l2') is moved to the matching position p4 included in the mutual matching field M4, and the overlapping string S[p2'-d2', p2'-d2'+l2') is spliced ​​with the moved movable string.

[0156] After moving the character strings indicated by the multiple mutual-matching fields in the first program file in the order indicated by the operation sequence, it is also necessary to move the character strings indicated by the multiple self-matching fields in the first program file in the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, and move the character strings indicated by the multiple non-matching fields in the non-matching data stream to the first program file to obtain the second program file.

[0157] In some embodiments, a matching field is selected from the matching sequence according to the order of the multiple self-matching fields and the multiple non-matching fields indicated by the matching sequence. If the selected matching field is a self-matching field, the string indicated by the selected matching field in the first program file is moved to the matching position included in the selected self-matching field. If the selected matching field is a non-matching field, the string indicated by the selected matching field is obtained from the non-matching data stream and moved to the matching position included in the selected non-matching field. The multiple self-matching fields and the multiple non-matching fields are sequentially traversed in the same manner to obtain the second program file.

[0158] It should be noted that the above content is based on the example that each matching field in the matching sequence is a quadruple, that is, each matching field includes a matching type, a matching distance, a matching byte number and a matching position. Therefore, in the process of moving the character strings indicated by each matching field in the first program file, the character strings indicated by each matching field are moved to the matching position included in the corresponding matching field. Of course, in actual applications, there may also be a situation where each matching field in the matching sequence is a triple, that is, each matching field includes a matching type, a matching distance and a matching byte number. At this time, in the process of moving the character string indicated by any matching field in the first program file, it is necessary to first determine the matching fields whose serial numbers are before the serial number of the matching field based on the serial number of the matching field, and determine the sum of the matching byte numbers of each matching field as the target position of the matching field, and then move the character string indicated by the matching field to the target position of the matching field.

[0159] For example, please refer to Figure 13, which is a flowchart of a restoration process provided by an embodiment of the present application. In Figure 13, the intelligent terminal obtains a differential packet and parses the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream. The matching sequence includes multiple mutual matching fields, multiple self-matching fields, and multiple non-matching fields. The intelligent terminal first moves the character strings indicated by the multiple mutual matching fields in the first program file in the order of the multiple mutual matching fields indicated by the operation sequence, that is, operates the multiple mutual matching fields. Then, the intelligent terminal moves the character strings indicated by the multiple self-matching fields and the multiple non-matching fields in the first program file in the order of the multiple self-matching fields and the multiple non-matching fields indicated by the matching sequence, that is, operates the multiple self-matching fields and the multiple non-matching fields to obtain a complete second program file.

[0160] It should be noted that the program update method provided in the embodiments of the present application has achieved excellent results for different types of programs. For example, the experimental results obtained by using the program update method provided in the embodiments of the present application for three different types of programs are shown in Table 1. Table 1 includes the first program file and the second program file corresponding to each of the three different types of programs. The first program files and the second program files corresponding to the three programs are all Android application packages (APKs).

[0161] Taking program 1 as an example, the size of the first program file corresponding to program 1 is 219 megabytes (MB), and the size of the second program file corresponding to program 1 is 220MB. If a complete second program file is generated by the relevant technology first, and then the first program file is replaced by the second program file to implement the update of program 1, then 220MB of hard disk space of the intelligent terminal needs to be occupied. If the first method provided in the embodiment of the present application is de-ringed, the target mutual matching field is converted into a non-matching field. Then, the size of the differential packet generated by the server is 40774 kilobytes (KB), and there is no need to occupy the hard disk space of the intelligent terminal when the program is updated. If the second method provided in the embodiment of the present application is de-ringed, the operation mode corresponding to the target mutual matching field is converted into the first type of shelving operation. Then, the size of the differential packet generated by the server is 34033KB. Compared with directly converting the target mutual matching field into a non-matching field, the differential packet is reduced by 6741KB, and when the program is updated, 9612KB of hard disk space of the intelligent terminal needs to be occupied, achieving a balance between the differential packet and the hard disk space.

[0162] If the method provided in the embodiment of the present application is first divided into two directed subgraphs, and then the operation mode corresponding to the target mutual matching field in each directed subgraph is converted into the first type of shelving operation. Then, the size of the differential packet generated by the server is 34520KB, and when the program is updated, 6710KB of hard disk space of the intelligent terminal is required. Compared with directly converting the operation mode corresponding to the target mutual matching field into the first type of shelving operation, the hard disk space occupied is reduced by 2902KB. This shows that by first dividing the directed graph into multiple directed subgraphs and then de-looping each directed subgraph, the hard disk space occupied can be greatly reduced.

[0163] Wherein, after the directed graph is divided into two directed subgraphs, the overlapping character strings corresponding to the edges between the two directed subgraphs are first placed in the free area of ​​the hard disk. For the first directed subgraph in the two directed subgraphs, the character string indicated by the target mutual matching field in the first directed subgraph is placed in the free area of ​​the hard disk. According to the order of the mutual matching fields indicated by the first operation sequence corresponding to the first directed subgraph, the character string in the first program file is moved. After the character string in the first program file is moved according to the order of the mutual matching fields indicated by the first operation sequence, the hard disk space occupied by the character string indicated by the target mutual matching field in the first directed subgraph is released immediately, and then the character string indicated by the target mutual matching field in the second directed subgraph is placed in the free area of ​​the hard disk. Then, according to the order of the mutual matching fields indicated by the second operation sequence corresponding to the second directed subgraph, the character string in the first program file is moved. Finally, the overlapping character strings corresponding to the edges between the two directed subgraphs are moved to the first program file to obtain the second program file.

[0164] That is, during the process of moving the character strings indicated by the mutually matching fields included in the matching sequence, the overlapping character strings corresponding to the edges between the two directed subgraphs are always placed in the free area of ​​the hard disk. Moreover, the first directed subgraph and the second directed subgraph jointly occupy the same hard disk space. In order to simultaneously meet the first occupancy requirement of the character string indicated by the target mutually matching field in the first directed subgraph and the second occupancy requirement of the character string indicated by the target mutually matching field in the second directed subgraph, the amount of available space on the smart terminal hard disk must be at least equal to the maximum of the first occupancy requirement and the second occupancy requirement.

[0165] If the method provided in the embodiment of the present application is used to first divide the program into four directed subgraphs, and then convert the operation mode corresponding to the target mutual matching field in each directed subgraph into a first-class pending operation, the size of the differential packet generated by the server is 35561KB, and the program update requires 4505KB of hard disk space on the smart terminal. Compared with directly converting the operation mode corresponding to the target mutual matching field into a first-class pending operation, the hard disk space usage is reduced by 5107KB.

[0166] Table 1

[0167] In an embodiment of the present application, by improving the restoration tool on the intelligent terminal, first, according to the order indicated by the operation sequence, the character strings indicated by the multiple mutual matching fields in the first program file are moved, and then according to the order of the multiple self-matching fields and the multiple non-matching fields indicated by the matching sequence, the character strings indicated by the multiple self-matching fields and the multiple non-matching fields in the first program file are moved. In this way, through the multiple mutual matching fields, the multiple self-matching fields and the multiple non-matching fields, the second program file can be restored completely and without overlap directly on the basis of the first program file. Compared with the related art of first generating a complete second program file and then replacing the first program file with the second program file, the embodiment of the present application can directly move and modify the character string on the first program file to obtain the second program file. That is, the second program file is obtained by moving the internal character string of the first program file and filling the non-matching data stream, thereby reducing the occupation of the intelligent terminal hard disk space and improving the efficiency of program updates.

[0168] FIG14 is a schematic diagram of the structure of a program update device provided in an embodiment of the present application. The program update device can be implemented as part or all of a server by software, hardware, or a combination of both. Referring to FIG14 , the device includes: a first determination module 1401, a second determination module 1402, and a generation module 1403.

[0169] The first determination module 1401 is configured to determine a matching sequence based on the first program file and the second program file. The matching sequence includes a plurality of mutually matching fields, a plurality of self-matching fields, and a plurality of non-matching fields. The detailed implementation process is referred to the corresponding content in the above embodiments and will not be repeated here.

[0170] Among them, the mutual match field indicates that a string in the second program file is the same as a string in the first program file, the self-match field indicates that a string in the second program file is the same as another string in the second program file, the non-match field indicates that a string in the second program file is the same as a string in the non-matching data stream, the first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than the version of the first program file.

[0171] Second determining module 1402 is configured to determine an operation sequence based on the multiple mutually matching fields. The operation sequence indicates the order in which some or all of the multiple mutually matching fields are to be restored when the second program file is restored in the order indicated by the operation sequence. When the second program file is restored in the order indicated by the operation sequence, the character strings indicated by the multiple mutually matching fields do not overlap. The detailed implementation process is described in the corresponding content of the above embodiments and is not further described here.

[0172] The generation module 1403 is used to generate a difference packet based on the matching sequence, the operation sequence and the non-matching data stream, wherein the difference packet indicates the difference between the first program file and the second program file. The detailed implementation process is referred to the corresponding content of each embodiment above and will not be repeated here.

[0173] Optionally, the second determining module 1402 includes:

[0174] a directed graph unit, configured to determine a directed graph based on the multiple mutually matching fields, wherein the directed graph indicates a topological order of the multiple mutually matching fields;

[0175] The de-looping unit is used to perform de-looping on the directed graph to obtain an operation sequence when the directed graph includes a directed closed loop.

[0176] Optionally, the directed graph includes at least one directed closed loop, and the directed graph includes a plurality of vertices, and the plurality of vertices correspond one-to-one to the plurality of mutually matching fields;

[0177] The de-ring unit is specifically used for:

[0178] For each directed closed loop in the at least one directed closed loop, cutting off a target vertex in the directed closed loop to obtain a directed graph after the cutting point, where the target vertex is a vertex in the directed closed loop;

[0179] An operation sequence is determined based on the topological order of each vertex in the directed graph after the tangent point, and the operation sequence indicates the order of the mutual matching fields in the multiple mutual matching fields except the target mutual matching field when restoring the second program file, and the target mutual matching field is the mutual matching field corresponding to the target vertex.

[0180] Optionally, the generating module 1403 is specifically configured to:

[0181] Adding the character string indicated by the target mutual matching field in the first program file to the non-matching data stream to obtain an updated non-matching data stream;

[0182] Convert the target mutual matching field in the matching sequence into a non-matching field to obtain an updated matching sequence;

[0183] A differential packet is generated based on the updated matching sequence, the operation sequence, and the updated non-matching data stream.

[0184] Optionally, the directed graph includes at least one directed closed loop, and the directed graph includes a plurality of vertices, and the plurality of vertices correspond one-to-one to the plurality of mutually matching fields;

[0185] The de-ring unit is specifically used for:

[0186] For each directed closed loop in the at least one directed closed loop, cutting off a target vertex in the directed closed loop to obtain a directed graph after the cutting point, where the target vertex is a vertex in the directed closed loop;

[0187] Placing the target vertex at the end of the directed graph after the tangent point to obtain a corrected topological order of the multiple vertices;

[0188] An operation sequence is determined based on the corrected topological order of the plurality of vertices, where the operation sequence indicates an order of the plurality of mutually matching fields when restoring the second program file.

[0189] Optionally, the generating module 1403 is specifically configured to:

[0190] Adding a first identifier to the target mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the first identifier indicates that the operation mode corresponding to the target mutual matching field is a first-type hold operation, and the target mutual matching field is the mutual matching field corresponding to the target vertex;

[0191] A differential packet is generated based on the updated matching sequence, operation sequence, and non-matching data stream.

[0192] Optionally, the directed graph includes at least one directed closed loop, and the directed graph includes a plurality of vertices, and the plurality of vertices correspond one-to-one to the plurality of mutually matching fields;

[0193] The de-ring unit is specifically used for:

[0194] For each directed closed loop in the at least one directed closed loop, cutting off a target edge in the directed closed loop to obtain a directed graph after edge cutting, where the target edge is an outgoing edge of a vertex corresponding to the first mutual matching field and an incoming edge of a vertex corresponding to the second mutual matching field, and the first mutual matching field and the second mutual matching field are two mutual matching fields among the multiple mutual matching fields;

[0195] An operation sequence is determined based on the topological order of each vertex in the directed graph after edge trimming, and the operation sequence indicates the order of the multiple mutually matching fields when restoring the second program file.

[0196] Optionally, the generating module 1403 is specifically configured to:

[0197] Adding a second identifier to the first mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the second identifier indicates that the operation mode corresponding to the first mutual matching field is a second type of shelving operation;

[0198] A differential packet is generated based on the updated matching sequence, operation sequence, and non-matching data stream.

[0199] Optionally, the de-ring unit is specifically used for:

[0200] In the case where the directed graph includes a directed subgraph having a directed closed loop, performing a de-looping process on the directed subgraph to obtain an operation sequence;

[0201] In the case that the directed graph includes multiple directed subgraphs having directed closed loops, edges between the multiple directed subgraphs are cut off, and each directed subgraph in the multiple directed subgraphs is subjected to a de-looping process to obtain an operation sequence.

[0202] In an embodiment of the present application, by improving the packaging tool on the server, combining the program files of different versions of the same program, determining the same character strings in the program files of different versions, obtaining a matching sequence including multiple mutual matching fields, multiple self-matching fields and multiple non-matching fields, and an operation sequence indicating the execution order of the mutual matching fields. By encoding the matching sequence, the operation sequence and the non-matching data stream, it is possible to generate a differential packet more quickly, and achieve a program update that is faster and more stream-saving. In addition, an embodiment of the present application also provides a variety of ways in which directed graphs are de-ringed, and different de-ringing processing modes correspond to different differential packet sizes and the occupancy requirements of the intelligent terminal hard disk space. Therefore, the server can select different de-ringing processing modes in combination with the size of the available space of the intelligent terminal hard disk, i.e., the abundance of the swap zone, to solve the problem of character string movement conflict.

[0203] It should be noted that the program update device provided in the above embodiment is merely illustrated by the division of the aforementioned functional modules when performing a program update. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the device can be divided into different functional modules to perform all or part of the functions described above. Furthermore, the program update device provided in the above embodiment and the program update method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0204] FIG15 is a schematic diagram of the structure of a program update device provided in an embodiment of the present application. The program update device can be implemented as part or all of a smart terminal by software, hardware, or a combination of both. Referring to FIG15 , the device includes: a first acquisition module 1501, a parsing module 1502, and a moving module 1503.

[0205] First acquisition module 1501 is configured to acquire a differential packet, which indicates the difference between a first program file and a second program file. The first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than that of the first program file. The detailed implementation process is described in the corresponding content of the above embodiments and is not repeated here.

[0206] Parsing module 1502 is used to parse the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream. The matching sequence includes multiple mutual matching fields, multiple self-matching fields, and multiple non-matching fields. The operation sequence indicates the order of the multiple mutual matching fields when restoring the second program file. The mutual matching field indicates that a string in the second program file is the same as a string in the first program file. The self-matching field indicates that a string in the second program file is the same as another string in the second program file. The non-matching field indicates that a string in the second program file is the same as a string in the non-matching data stream. The detailed implementation process refers to the corresponding content in the above-mentioned embodiments and will not be repeated here.

[0207] Move module 1503 is configured to move the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, move the character strings indicated by the multiple self-matching fields in the first program file in the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, and move the character strings indicated by the multiple non-matching fields in the non-matching data stream to the first program file to obtain a second program file. The detailed implementation process is referenced to the corresponding content in the above embodiments and is not further described here.

[0208] Optionally, the device further comprises:

[0209] a second obtaining module, configured to obtain, when the first mutual matching field includes the first identifier, a character string indicated by the first mutual matching field in the first program file, and store the character string indicated by the first mutual matching field in a target location, wherein the first mutual matching field is any one of the multiple mutual matching fields;

[0210] The third acquisition module is used to obtain the overlapping character strings of the character string indicated by the first mutual matching field in the first program file and the character string indicated by the second mutual matching field in the second program file when the first mutual matching field includes the second identifier, and store the overlapping character strings to the target location, so that when restoring the second program file, the order of the first mutual matching field is earlier than the order of the second mutual matching field.

[0211] Optionally, the moving module 1503 is specifically configured to:

[0212] Selecting a mutual matching field from the multiple mutual matching fields in an order indicated by the operation sequence;

[0213] In a case where the selected mutual matching field does not include the first identifier, moving the character string indicated by the selected mutual matching field in the first program file;

[0214] When the selected mutual matching field includes a first identifier, a character string indicated by the selected mutual matching field is obtained from a target location, and the obtained character string is moved to a first program file. The first identifier indicates that the operation mode corresponding to the selected mutual matching field is a first type of shelving operation.

[0215] Optionally, the moving module 1503 is specifically configured to:

[0216] Selecting a mutual matching field from the multiple mutual matching fields in an order indicated by the operation sequence;

[0217] In a case where the selected mutual matching field does not include the second identifier, moving the character string indicated by the selected mutual matching field in the first program file;

[0218] In a case where the selected mutual matching field includes a second identifier, determining a movable character string based on a character string indicated by the selected mutual matching field in the first program file and an overlapping character string corresponding to the selected mutual matching field stored at the target location, and moving the movable character string in the first program file, wherein the second identifier indicates that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation;

[0219] When the selected mutual matching field is the last mutual matching field among the multiple mutual matching fields, after the movable character string is moved, the overlapping character string is moved to the first program file to be spliced ​​with the movable character string.

[0220] In an embodiment of the present application, by improving the restoration tool on the intelligent terminal, first, according to the order indicated by the operation sequence, the character strings indicated by the multiple mutual matching fields in the first program file are moved, and then according to the order of the multiple self-matching fields and the multiple non-matching fields indicated by the matching sequence, the character strings indicated by the multiple self-matching fields and the multiple non-matching fields in the first program file are moved. In this way, through the multiple mutual matching fields, the multiple self-matching fields and the multiple non-matching fields, the second program file can be restored completely and without overlap directly on the basis of the first program file. Compared with the related art of first generating a complete second program file and then replacing the first program file with the second program file, the embodiment of the present application can directly move and modify the character string on the first program file to obtain the second program file. That is, the second program file is obtained by moving the internal character string of the first program file and filling the non-matching data stream, thereby reducing the occupation of the intelligent terminal hard disk space and improving the efficiency of program updates.

[0221] It should be noted that the program update device provided in the above embodiment is merely illustrated by the division of the aforementioned functional modules when performing a program update. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the device can be divided into different functional modules to perform all or part of the functions described above. Furthermore, the program update device provided in the above embodiment and the program update method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0222] Please refer to Figure 16, which is a schematic diagram of the structure of a computer device according to an embodiment of the present application. The computer device can be the server or intelligent terminal described above. The computer device includes at least one processor 1601, a communication bus 1602, a memory 1603, and at least one communication interface 1604.

[0223] Processor 1601 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, or one or more integrated circuits for implementing the solutions of the present application, such as an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0224] Communication bus 1602 is used to transmit information between the above components. Communication bus 1602 can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or one type of bus.

[0225] The memory 1603 may be a read-only memory (ROM), a random access memory (RAM), an electrically erasable programmable read-only memory (EEPROM), an optical disc (including a compact disc read-only memory (CD-ROM), a compact disc, a laser disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1603 may exist independently and be connected to the processor 1601 via the communication bus 1602. The memory 1603 may also be integrated with the processor 1601.

[0226] Communication interface 1604 uses any transceiver or other device for communicating with other devices or communication networks. Communication interface 1604 includes a wired communication interface and may also include a wireless communication interface. A wired communication interface may be, for example, an Ethernet interface. An Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. A wireless communication interface may be a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof.

[0227] In a specific implementation, as an embodiment, the processor 1601 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG16 .

[0228] In a specific implementation, as an embodiment, a computer device may include multiple processors, such as processor 1601 and processor 1605 shown in FIG16 . Each of these processors may be a single-core processor or a multi-core processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0229] In a specific implementation, as an embodiment, the computer device may further include an output device 1606 and an input device 1607 (not shown). The output device 1606 communicates with the processor 1601 and can display information in a variety of ways. For example, the output device 1606 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 1607 communicates with the processor 1601 and can receive user input in a variety of ways. For example, the input device 1607 can be a mouse, a keyboard, a touch screen device, or a sensor device.

[0230] In some embodiments, the memory 1603 is used to store program code 1610 for executing the solution of the present application, and the processor 1601 can execute the program code 1610 stored in the memory 1603. The program code 1610 may include one or more software modules, and the computer device can implement the program update method provided in the embodiment of Figure 5 or Figure 12 above through the processor 1601 and the program code 1610 in the memory 1603.

[0231] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a digital versatile disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)). It is worth noting that the computer-readable storage medium mentioned in the embodiments of the present application may be a non-volatile storage medium, in other words, a non-transient storage medium.

[0232] That is, an embodiment of the present application further provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the steps of the above-mentioned program updating method.

[0233] The present application also provides a computer program product comprising instructions that, when executed on a computer, cause the computer to execute the steps of the program update method described above. Alternatively, a computer program is provided that, when executed on a computer, causes the computer to execute the steps of the program update method described above.

[0234] It should be understood that the "plurality" mentioned herein refers to two or more. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0235] 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 used for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the first program file and the second program file involved in the embodiments of this application were both obtained with full authorization.

[0236] The above description is an embodiment provided for this application and is not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application should be included in the scope of protection of this application.

Claims

1. A program updating method, characterized in that: Applied to a server, the method comprises: Determine a matching sequence based on the first program file and the second program file, wherein the matching sequence includes a plurality of mutual matching fields, a plurality of self-matching fields, and a plurality of non-matching fields; The mutual match field indicates that a string in the second program file is the same as a string in the first program file, the self-match field indicates that a string in the second program file is the same as another string in the second program file, the non-match field indicates that a string in the second program file is the same as a string in a non-matching data stream, the first program file and the second program file are program files of two different versions of the same program, and the version of the second program file is higher than the version of the first program file; Determining an operation sequence based on the multiple mutually matching fields, the operation sequence indicating the order of some or all of the multiple mutually matching fields when restoring the second program file, and when the second program file is restored in the order indicated by the operation sequence, the character strings indicated by the multiple mutually matching fields will not overlap; A differential packet is generated based on the matching sequence, the operation sequence, and the non-matching data stream, the differential packet indicating a difference between the first program file and the second program file.

2. The method according to claim 1, characterized in that The determining of the operation sequence based on the multiple mutually matching fields comprises: determining a directed graph based on the plurality of mutually matching fields, the directed graph indicating a topological order of the plurality of mutually matching fields; In the case that the directed graph includes a directed closed loop, a de-looping process is performed on the directed graph to obtain the operation sequence.

3. The method according to claim 2, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The de-looping the directed graph to obtain the operation sequence includes: For each directed closed loop in the at least one directed closed loop, cut off a target vertex in the directed closed loop to obtain a directed graph after the cut point, wherein the target vertex is a vertex in the directed closed loop; The operation sequence is determined based on the topological order of each vertex in the directed graph after the tangent point, and the operation sequence indicates the order of the mutual matching fields among the multiple mutual matching fields except the target mutual matching field when restoring the second program file, and the target mutual matching field is the mutual matching field corresponding to the target vertex.

4. The method according to claim 3, characterized in that The generating of a differential packet based on the matching sequence, the operation sequence and the non-matching data stream comprises: adding the character string indicated by the target mutual matching field in the first program file to the non-matching data stream to obtain an updated non-matching data stream; Converting the target mutual matching field in the matching sequence into a non-matching field to obtain an updated matching sequence; The differential packet is generated based on the updated matching sequence, the operation sequence, and the updated non-matching data stream.

5. The method according to claim 2, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The de-looping the directed graph to obtain the operation sequence includes: For each directed closed loop in the at least one directed closed loop, cut off a target vertex in the directed closed loop to obtain a directed graph after the cut point, wherein the target vertex is a vertex in the directed closed loop; Placing the target vertex at the end of the directed graph after the tangent point to obtain a modified topological order of the plurality of vertices; The operation sequence is determined based on the modified topological order of the plurality of vertices, the operation sequence indicating an order of the plurality of mutually matching fields when restoring the second program file.

6. The method according to claim 5, characterized in that The generating of a differential packet based on the matching sequence, the operation sequence and the non-matching data stream comprises: Adding a first identifier to the target mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the first identifier indicates that the operation mode corresponding to the target mutual matching field is a first type of shelving operation, and the target mutual matching field is the mutual matching field corresponding to the target vertex; The differential packet is generated based on the updated matching sequence, the operation sequence, and the non-matching data stream.

7. The method according to claim 2, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The de-looping the directed graph to obtain the operation sequence includes: For each directed closed loop in the at least one directed closed loop, cut off a target edge in the directed closed loop to obtain a directed graph after the cut edge, wherein the target edge is an outgoing edge of a vertex corresponding to a first mutual matching field and an incoming edge of a vertex corresponding to a second mutual matching field, and the first mutual matching field and the second mutual matching field are two mutual matching fields among the multiple mutual matching fields; The operation sequence is determined based on the topological order of each vertex in the directed graph after edge cutting, and the operation sequence indicates the order of the multiple mutually matching fields when restoring the second program file.

8. The method according to claim 7, characterized in that The generating of a differential packet based on the matching sequence, the operation sequence and the non-matching data stream comprises: adding a second identifier to the first mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the second identifier indicates that the operation mode corresponding to the first mutual matching field is a second type of shelving operation; The differential packet is generated based on the updated matching sequence, the operation sequence, and the non-matching data stream.

9. The method according to any one of claims 2 to 8, characterized in that: The de-looping the directed graph to obtain the operation sequence includes: In the case where the directed graph includes a directed subgraph having a directed closed loop, performing a de-looping process on the directed subgraph to obtain the operation sequence; In the case that the directed graph includes a plurality of directed subgraphs having directed closed loops, edges between the plurality of directed subgraphs are cut off, and each directed subgraph in the plurality of directed subgraphs is respectively de-looped to obtain the operation sequence.

10. A program updating method, characterized in that: Applied to a smart terminal, the method comprises: Obtain a differential package, the differential package indicating a difference between a first program file and a second program file, the first program file and the second program file being program files of two different versions of the same program, and the version of the second program file is higher than the version of the first program file; Parsing the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream, the matching sequence comprising a plurality of mutual matching fields, a plurality of self-matching fields, and a plurality of non-matching fields, the operation sequence indicating an order of the plurality of mutual matching fields when restoring the second program file, the mutual matching field indicating that a string in the second program file is identical to a string in the first program file, the self-matching field indicating that a string in the second program file is identical to another string in the second program file, and the non-matching field indicating that a string in the second program file is identical to a string in the non-matching data stream; In the order indicated by the operation sequence, the character strings indicated by the multiple mutual matching fields in the first program file are moved; in the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, the character strings indicated by the multiple non-matching fields in the first program file are moved; and the character strings indicated by the multiple non-matching fields in the non-matching data stream are moved to the first program file to obtain the second program file.

11. The method according to claim 10, characterized in that Before moving the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence, the method further includes: In a case where the first mutual matching field includes a first identifier, obtaining a character string indicated by the first mutual matching field in the first program file, and storing the character string indicated by the first mutual matching field to a target location, wherein the first mutual matching field is any one of the multiple mutual matching fields; In the case where the first mutual matching field includes a second identifier, an overlapping string of a string indicated by the first mutual matching field in the first program file and a string indicated by the second mutual matching field in the second program file is obtained, and the overlapping string is stored in the target location, and when restoring the second program file, the order of the first mutual matching field is earlier than the order of the second mutual matching field.

12. The method according to claim 10 or 11, characterized in that The moving the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence includes: Selecting a mutual matching field from the plurality of mutual matching fields in an order indicated by the operation sequence; In a case where the selected mutual matching field does not include the first identifier, moving the character string indicated by the selected mutual matching field in the first program file; In the case that the selected mutual matching field includes the first identifier, the character string indicated by the selected mutual matching field is obtained from the target location, and the obtained character string is moved to the first program file, and the first identifier indicates that the operation mode corresponding to the selected mutual matching field is a first type of shelving operation.

13. The method according to claim 10 or 11, characterized in that: The moving the character strings indicated by the multiple mutually matching fields in the first program file in the order indicated by the operation sequence includes: Selecting a mutual matching field from the plurality of mutual matching fields in an order indicated by the operation sequence; In a case where the selected mutual matching field does not include the second identifier, moving the character string indicated by the selected mutual matching field in the first program file; In a case where the selected mutual matching field includes the second identifier, determining a movable character string based on the character string indicated by the selected mutual matching field in the first program file and an overlapping character string corresponding to the selected mutual matching field stored at a target position, and moving the movable character string in the first program file, the second identifier indicating that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation; In a case where the selected mutually matching field is the last mutually matching field among the multiple mutually matching fields, after the movable character string is moved, the overlapping character string is moved to the first program file to be concatenated with the movable character string.

14. A program updating device, characterized in that: The device comprises: A first determination module, configured to determine a matching sequence based on the first program file and the second program file, wherein the matching sequence includes a plurality of mutual matching fields, a plurality of self-matching fields, and a plurality of non-matching fields; The mutual match field indicates that a string in the second program file is the same as a string in the first program file, the self-match field indicates that a string in the second program file is the same as another string in the second program file, the non-match field indicates that a string in the second program file is the same as a string in a non-matching data stream, the first program file and the second program file are program files of two different versions of the same program, and the version of the second program file is higher than the version of the first program file; a second determining module, configured to determine an operation sequence based on the multiple mutually matching fields, the operation sequence indicating an order in which some or all of the multiple mutually matching fields are to be used when restoring the second program file, and character strings indicated by the multiple mutually matching fields will not overlap when restoring the second program file in the order indicated by the operation sequence; A generating module is used to generate a differential packet based on the matching sequence, the operation sequence and the non-matching data stream, wherein the differential packet indicates a difference between the first program file and the second program file.

15. The device according to claim 14, characterized in that The second determining module comprises: A directed graph unit, configured to determine a directed graph based on the plurality of mutually matching fields, the directed graph indicating a topological order of the plurality of mutually matching fields; A de-looping unit is used to perform de-looping on the directed graph to obtain the operation sequence when the directed graph includes a directed closed loop.

16. The device according to claim 15, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The decyclizing unit is specifically used for: For each directed closed loop in the at least one directed closed loop, cut off a target vertex in the directed closed loop to obtain a directed graph after the cut point, wherein the target vertex is a vertex in the directed closed loop; The operation sequence is determined based on the topological order of each vertex in the directed graph after the tangent point, and the operation sequence indicates the order of the mutual matching fields among the multiple mutual matching fields except the target mutual matching field when restoring the second program file, and the target mutual matching field is the mutual matching field corresponding to the target vertex.

17. The device according to claim 16, characterized in that The generation module is specifically used for: adding the character string indicated by the target mutual matching field in the first program file to the non-matching data stream to obtain an updated non-matching data stream; Converting the target mutual matching field in the matching sequence into a non-matching field to obtain an updated matching sequence; The differential packet is generated based on the updated matching sequence, the operation sequence, and the updated non-matching data stream.

18. The device according to claim 15, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The decyclizing unit is specifically used for: For each directed closed loop in the at least one directed closed loop, cut off a target vertex in the directed closed loop to obtain a directed graph after the cut point, wherein the target vertex is a vertex in the directed closed loop; Placing the target vertex at the end of the directed graph after the tangent point to obtain a modified topological order of the plurality of vertices; The operation sequence is determined based on the modified topological order of the plurality of vertices, the operation sequence indicating an order of the plurality of mutually matching fields when restoring the second program file.

19. The device according to claim 18, characterized in that The generation module is specifically used for: Adding a first identifier to the target mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the first identifier indicates that the operation mode corresponding to the target mutual matching field is a first type of shelving operation, and the target mutual matching field is the mutual matching field corresponding to the target vertex; The differential packet is generated based on the updated matching sequence, the operation sequence, and the non-matching data stream.

20. The device according to claim 15, characterized in that The directed graph includes at least one directed closed loop, the directed graph includes a plurality of vertices, and the plurality of vertices correspond to the plurality of mutual matching fields one by one; The decyclizing unit is specifically used for: For each directed closed loop in the at least one directed closed loop, cut off a target edge in the directed closed loop to obtain a directed graph after the cut edge, wherein the target edge is an outgoing edge of a vertex corresponding to a first mutual matching field and an incoming edge of a vertex corresponding to a second mutual matching field, and the first mutual matching field and the second mutual matching field are two mutual matching fields among the multiple mutual matching fields; The operation sequence is determined based on the topological order of each vertex in the directed graph after edge cutting, and the operation sequence indicates the order of the multiple mutually matching fields when restoring the second program file.

21. The device according to claim 20, characterized in that The generation module is specifically used for: adding a second identifier to the first mutual matching field in the matching sequence to obtain an updated matching sequence, wherein the second identifier indicates that the operation mode corresponding to the first mutual matching field is a second type of shelving operation; The differential packet is generated based on the updated matching sequence, the operation sequence, and the non-matching data stream.

22. The device according to any one of claims 15 to 21, characterized in that: The decyclizing unit is specifically used for: In the case where the directed graph includes a directed subgraph having a directed closed loop, performing a de-looping process on the directed subgraph to obtain the operation sequence; In the case that the directed graph includes a plurality of directed subgraphs having directed closed loops, edges between the plurality of directed subgraphs are cut off, and each directed subgraph in the plurality of directed subgraphs is respectively de-looped to obtain the operation sequence.

23. A program updating device, characterized in that: The device comprises: A first acquisition module is used to acquire a differential package, where the differential package indicates a difference between a first program file and a second program file, where the first program file and the second program file are two different versions of the same program, and the version of the second program file is higher than the version of the first program file; a parsing module, configured to parse the differential packet to obtain a matching sequence, an operation sequence, and a non-matching data stream, wherein the matching sequence includes a plurality of mutual matching fields, a plurality of self-matching fields, and a plurality of non-matching fields, the operation sequence indicates an order of the plurality of mutual matching fields when restoring the second program file, the mutual matching field indicates that a string in the second program file is identical to a string in the first program file, the self-matching field indicates that a string in the second program file is identical to another string in the second program file, and the non-matching field indicates that a string in the second program file is identical to a string in the non-matching data stream; A moving module is used to move the character strings indicated by the multiple mutual matching fields in the first program file in the order indicated by the operation sequence, move the character strings indicated by the multiple self-matching fields in the first program file in the order of the multiple self-matching fields and the multiple non-matching fields in the matching sequence, and move the character strings indicated by the multiple non-matching fields in the non-matching data stream to the first program file to obtain the second program file.

24. The device according to claim 23, characterized in that The device also includes: a second acquisition module, configured to acquire, when the first mutual matching field includes a first identifier, a character string indicated by the first mutual matching field in the first program file, and store the character string indicated by the first mutual matching field to a target location, wherein the first mutual matching field is any one of the multiple mutual matching fields; A third acquisition module is used to acquire overlapping strings of the string indicated by the first mutual matching field in the first program file and the string indicated by the second mutual matching field in the second program file when the first mutual matching field includes a second identifier, and store the overlapping strings to the target location, so that when restoring the second program file, the order of the first mutual matching field is earlier than the order of the second mutual matching field.

25. The device according to claim 23 or 24, characterized in that The mobile module is specifically used for: Selecting a mutual matching field from the plurality of mutual matching fields in an order indicated by the operation sequence; In a case where the selected mutual matching field does not include the first identifier, moving the character string indicated by the selected mutual matching field in the first program file; In the case that the selected mutual matching field includes the first identifier, the character string indicated by the selected mutual matching field is obtained from the target location, and the obtained character string is moved to the first program file, and the first identifier indicates that the operation mode corresponding to the selected mutual matching field is a first type of shelving operation.

26. The device according to claim 23 or 24, characterized in that The mobile module is specifically used for: Selecting a mutual matching field from the plurality of mutual matching fields in an order indicated by the operation sequence; In a case where the selected mutual matching field does not include the second identifier, moving the character string indicated by the selected mutual matching field in the first program file; In a case where the selected mutual matching field includes the second identifier, determining a movable character string based on the character string indicated by the selected mutual matching field in the first program file and an overlapping character string corresponding to the selected mutual matching field stored at a target position, and moving the movable character string in the first program file, the second identifier indicating that the operation mode corresponding to the selected mutual matching field is a second type of shelving operation; In a case where the selected mutually matching field is the last mutually matching field among the multiple mutually matching fields, after the movable character string is moved, the overlapping character string is moved to the first program file to be concatenated with the movable character string.

27. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory is used to store a computer program, and the processor is configured to execute the computer program stored in the memory to implement the steps of the method according to any one of claims 1 to 13.

28. A computer-readable storage medium, characterized in that: The storage medium stores instructions, and when the instructions are executed on the computer, the computer executes the steps of the method according to any one of claims 1 to 13.

29. A computer program, characterized in that The computer program comprises instructions, and when the instructions are executed on the computer, the computer is caused to execute the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Program updating method and device, equipment, storage medium and computer program

    CN118796244A

  • Plug-in updating method and device of application program, server and storage medium

    CN110231947A

  • Differential packet generation method and related equipment

    CN111522574A

  • Block differential upgrade package generation method and device and block differential upgrade method and device

    CN115718614A

  • Byte-level file differencing and updating algorithms

    US20030212712A1