CN116339774A - Client hot updating method, device and equipment - Google Patents

Client hot updating method, device and equipment Download PDF

Info

Publication number
CN116339774A
CN116339774A CN202310199304.4A CN202310199304A CN116339774A CN 116339774 A CN116339774 A CN 116339774A CN 202310199304 A CN202310199304 A CN 202310199304A CN 116339774 A CN116339774 A CN 116339774A
Authority
CN
China
Prior art keywords
file
client
check value
sub
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310199304.4A
Other languages
Chinese (zh)
Inventor
蔡芳汉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202310199304.4A priority Critical patent/CN116339774A/en
Publication of CN116339774A publication Critical patent/CN116339774A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention relates to the technical field of application development and discloses a method, a device and equipment for hot updating of a client, which divide a resource package of front-end engineering into a plurality of resource files according to a routing module, divide each resource file into a plurality of subfiles according to specific functions, and set a unique file check value for each subfile, so that partial subfiles needing to be updated can be identified through the file check value when the resource package is updated, the technical problem of low updating efficiency caused by the fact that the whole script file needs to be downloaded when the client is subjected to hot updating in the prior art is solved, and the technical effects of shortening hot updating time, reducing flow use and improving hot updating efficiency are realized.

Description

Client hot updating method, device and equipment
Technical Field
The embodiment of the invention relates to the technical field of application development, in particular to a client hot update method, device and equipment.
Background
Because mobile application updating iteration is more and more frequent, the traditional application store installation package updating form is complex, the downloaded data volume is large, the updating will of a user is low, the user cannot use a new function or repair the problem in time, and the requirement cannot be met. In order to solve the above problems, it is necessary to introduce a hot update mechanism to update the new version, so as to implement new function update or bug fix.
The traditional hot updating mode adopts modes of downloading DEX binary files and the like to carry out hot updating, but along with tightening and prohibiting rights of an Android system, the compatibility problem of the hot updating mode is more and more increased. The other way is to replace the original with H5 for the client page, and then to modify the client function by downloading the JavaScript script, but the JavaScript script normally packed by the front-end engineering usually has only one app.js, and includes all application modules and functions, so that the number is small, the volume is large, the whole script file needs to be downloaded as long as the modification is simple, the requirement on the quick and efficient hot update is not met, and the update efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a client hot updating method, device and equipment, which solve the technical problem of low updating efficiency caused by the fact that the client needs to download the whole script file when carrying out hot updating in the prior art.
In a first aspect, the present application provides a client-side hot update method, applied to a server side, where the client-side hot update method includes:
obtaining a resource package to be updated, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of subfiles according to the functions, and each subfile corresponds to a unique file check value;
Traversing each sub-file in the resource package to be updated, and generating the file check value of each sub-file;
generating current version information according to the current timestamp of the resource package to be updated, and pushing the current version information to a client;
and loading a target sub-file into a downloading list of the client based on the resource updating request sent by the client, wherein the target sub-file is the sub-file in which the file check value in the resource package to be updated is changed relative to the resource package of the last version.
In a second aspect, the present application provides a client hot update method, applied to a client, where the client hot update method includes:
receiving a file check value of each sub-file in a resource package to be updated, which is sent by a server side;
comparing the file check value with a file check value in a local resource package to determine a file check value of a target sub-file, wherein the local resource package comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a group of mapping relations between file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is the sub-file in the resource package to be updated, wherein the file check value of the sub-file is changed relative to the file check value in the local resource package;
The file check value of the target subfile is sent to the server side;
and downloading the target subfiles loaded in the download list by the server side.
In a third aspect, the present application provides a client thermal update apparatus configured at a server, where the client thermal update apparatus includes:
the resource receiving unit is used for obtaining a resource package to be updated, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of subfiles according to the functions, and each subfile corresponds to a unique file check value;
the identifier generating unit is used for traversing each sub-file in the resource package to be updated and generating the file check value of each sub-file;
the version information generation unit is used for generating current version information according to the current timestamp of the resource package to be updated and pushing the current version information to the client;
and the resource loading unit is used for loading a target sub-file to a downloading list of the client based on the resource updating request sent by the client, wherein the target sub-file is the sub-file in which the file check value in the resource package to be updated is changed relative to the resource package of the previous version.
In a fourth aspect, the present application provides a client thermal update apparatus configured to a client, where the client thermal update apparatus includes:
the identification receiving unit is used for receiving the file check values of all the subfiles sent by the server side;
the identification comparison unit is used for comparing the file check value with the file check value in a local resource package to determine the file check value of a target sub-file, wherein the local resource package comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is the sub-file with the file check value changed relative to the file check value in the local resource package;
the result feedback unit is used for sending the file check value of the target subfile to the server side;
and the file downloading unit is used for downloading the target subfiles loaded in the downloading list by the server side.
In a fifth aspect, the present application provides a client thermal update system, the system comprising:
The server side is used for acquiring a resource package to be updated, traversing each sub-file in the resource package to be updated, generating the file check value of each sub-file, generating current version information according to the current timestamp of the resource package to be updated, pushing the current version information to a client, and loading a target sub-file to a downloading list of the client based on the received resource update request, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, and each sub-file corresponds to a unique file check value;
and the client is used for determining the file check value of the target sub-file based on the file check value sent by the server and downloading the target sub-file loaded into a download list by the server for hot update.
In a sixth aspect, the present application provides a client thermal update apparatus, including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the client side thermal update method for the server side as described in the first aspect of the application or to perform the client side thermal update method for the client side as described in the second aspect of the application.
In a seventh aspect, the present application provides a computer readable storage medium, where computer instructions are stored, where the computer instructions are configured to cause a processor to implement the client thermal update method applied to a server according to the first aspect of the present application, or implement the client thermal update method applied to a client according to the second aspect of the present application.
In an eighth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the client side thermal update method for a server side according to the first aspect of the present application, or implements the client side thermal update method for a client side according to the second aspect of the present application.
The embodiment of the invention discloses a client hot updating method, device and equipment, which divide a resource package of a front-end project into a plurality of resource files according to a routing module, divide each resource file into a plurality of subfiles according to specific functions, and set a unique file check value for each subfile, so that partial subfiles needing to be updated can be identified through the file check value when the resource package is updated, the technical problem of low updating efficiency caused by the fact that the whole script file needs to be downloaded when the client is hot updated in the prior art is solved, and the technical effects of shortening hot updating time, reducing flow use and improving hot updating efficiency are realized.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a client hot update method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another client hot update method provided by an embodiment of the present invention;
FIG. 3 is a flowchart of a further client hot update method provided by an embodiment of the present invention;
FIG. 4 is a flowchart of yet another client hot update method provided by an embodiment of the present invention;
FIG. 5 is a block diagram of a client hot update apparatus according to an embodiment of the present invention;
FIG. 6 is a block diagram of another client hot update apparatus provided by an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a client hot update device according to an embodiment of the present invention.
Detailed Description
In order to make the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a flowchart of a client hot update method according to an embodiment of the present invention, where the client hot update method is applied to a server. The present embodiment is applicable to any situation where a front-end engineering hot update is required, and the method may be performed by a client hot update device, which may be implemented in hardware and/or software, and may generally be integrated in a server. The data acquisition, storage, use, processing and the like in the technical scheme meet the relevant regulations of national laws and regulations.
As shown in fig. 1, the client hot update method is applied to a server, and specifically includes the following steps:
s101, obtaining a resource package to be updated, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of subfiles according to the functions, and each subfile corresponds to a unique file check value.
Specifically, the resource package to be updated is a JavaScript script, the logic code of the resource package is stored as an app.js file, the app.js file is divided into a plurality of resource files app1.Js, app2.Js, … … and the like according to the routing module, specifically, one routing module correspondingly represents a mapping relationship between a group of file paths and functions, so that each resource file corresponds to one file path, but different functional programs may exist under one file path, and therefore each resource file is further divided into a plurality of subfiles according to functions, wherein each subfile corresponds to a unique file check value. It should be noted that, the sub-files in the resource file are dynamically imported in the importing process, namely, the lazy loading mode is selected, but not the static importing mode, and the lazy loading mode is used for importing the sub-files, so that the effect that the corresponding sub-files can be loaded only when the route is accessed can be achieved, in a simple way, the sub-files are loaded when needed, and therefore, a certain pressure relieving effect can be provided for the server side, and the efficiency of the server side is improved.
S102, traversing each sub-file in the resource package to be updated, and generating a file check value of each sub-file.
Specifically, after the resource package to be updated is obtained, each sub-file in the resource package to be updated is traversed first, and a file check value is generated for each sub-file.
Optionally, S102 specifically includes: traversing each sub-file in the resource package to be updated, and generating a file check value of each sub-file by using a password hash function.
Specifically, the value of the cryptographic hash function (Message-Digest Algorithm 5, MD5) is unique, and as long as any character in the subfile changes, the calculated MD5 value also changes, so as to realize that the subfile is assigned with a unique corresponding file check value.
Optionally, at S102, after generating the file check value of each sub-file, the client hot update method further includes: a file path and a file size for each sub-file are generated.
Specifically, the file paths of different subfiles may be different, and the same file path may also include a plurality of subfiles with different file check values.
S103, generating current version information according to the current time stamp of the resource package to be updated, and pushing the current version information to the client.
Specifically, after the resource package to be updated is obtained, current version information is generated according to the current timestamp of the resource package to be updated, so that resource packages of different versions are distinguished, and the current version information is sent to the client, so that the client can be used for judging whether the client needs to update the resource package.
Optionally, before pushing the current version information to the client, at S103, the client hot update method further includes: receiving login verification information sent by a client; and carrying out login verification based on the login verification information, and after the login verification is passed, executing the action of pushing the current version information to the client.
Specifically, when the client is started, login verification information is sent to the server, the server verifies the login verification information, and when verification passes, the server pushes current version information to the client so that the client can judge whether the client needs to update a resource package or not.
And S104, loading the target subfile into a downloading list of the client based on the resource updating request sent by the client, wherein the target subfile is a subfile in which the file check value in the resource package to be updated is changed relative to the previous version of the resource package.
Specifically, when the client determines that the client needs to perform the hot update, an update resource request is sent to the server, and the server loads a sub-file (i.e., the target sub-file) with a changed file check value into a download list of the client based on the update resource request, so that the client performs the hot update based on the target sub-file in the download list. By identifying the changed file check value, the client does not need to download all resource packages when performing hot update, only partial subfiles are downloaded, the download amount of users is reduced, and the hot update efficiency is improved.
According to the method and the device, the resource package of the front-end engineering is divided into the plurality of resource files according to the routing module, each resource file is divided into the plurality of subfiles according to specific functions, and the unique file check value is set for each subfile, so that partial subfiles needing to be updated can be identified through the file check value when the resource package is updated, the technical problem of low updating efficiency caused by the fact that the client needs to download the whole script file when performing hot updating in the prior art is solved, the technical effects of shortening the hot updating time, reducing the flow use and improving the hot updating efficiency are achieved.
Based on the above technical solutions, before loading the target subfile into the download list of the client in S104, the client hot update method further includes:
selecting the subfiles with the file verification values changed in the resource package to be updated based on the resource package of the previous version to obtain target subfiles; or,
and determining the target subfile based on the file check value of the target subfile sent by the client, wherein the file check value of the target subfile is obtained by comparing the file check values of all subfiles sent by the client based on the server with the file check values in the local resource package.
Specifically, before loading the target subfiles into the downloading list of the client, two determining methods exist, wherein one determining method is that the server determines which of the file check values of the subfiles in the resource package to be updated is changed based on the file check values of the subfiles in the resource package of the previous version, and the changed subfiles are selected to obtain the target subfiles; the other is that the server side sends the file check value of the sub-file to the client side after generating the file check value of the sub-file, the client side selects the file check value which is changed based on the received file check value and the file check value in the local resource package, and then feeds the file check value back to the server side, and the server side determines the target sub-file based on the received file check value which is changed and loads the target sub-file into a downloading list of the client side.
When the client side compares the received file check value with the file check value in the local resource package, the corresponding file check value can be compared through the file path, specifically, the client side traverses the subfiles in the local resource package, calculates the file check value of each subfile, takes the file path as a key, and stores the file check value as a value in the local hash table. After the client receives the file check value transmitted by the server, the file check value is stored in a copy hash table, each file path is traversed from the copy hash table to obtain a corresponding file check value, and then the file check value in the copy hash table is compared with the file check value in a local hash table: (1) If the local hash table does not have the file check value corresponding to the file path in the copy hash table, the sub-file corresponding to the file check value is represented as a newly added file, and the sub-file corresponding to the file path is determined to be a target sub-file; (2) If the local hash table has the file check value corresponding to the file path in the copy hash table, but the file check value is inconsistent, the subfiles corresponding to the file check value are modified, and the subfiles corresponding to the file path are determined to be target subfiles; (3) If a file path exists in the local hash table, but the file path is not in the copy hash table, the subfiles representing the file path are deleted in the new version resource package without processing.
Based on the above technical solutions, after pushing the current version information to the client in S103, the client hot update method further includes: and receiving an update resource request sent by the client, wherein the update resource request is obtained by comparing the current version information sent by the server with the version information of the local resource package by the client.
Specifically, after the server pushes the current version information to the client, the client compares the received current version information with the version information of the local resource package, if the version numbers of the current version information and the version information are consistent, the client directly enters the application, and if the version numbers of the current version information and the version information are inconsistent, the client sends a resource updating request to the server, so that the server loads the target subfile into a downloading list of the client after receiving the resource updating request.
Fig. 2 is a flowchart of another client hot update method provided in an embodiment of the present invention, where the client hot update method is applied to a client, and as shown in fig. 2, the client hot update method specifically includes the following steps:
s201, receiving a file check value of each sub-file in a resource package to be updated, which is sent by a server side.
Specifically, after the server side obtains the resource package to be updated, the server side traverses all the subfiles in the resource package to be updated, generates a file check value of each subfile, and then sends the generated file check value to the client side. After receiving the file check value transmitted from the server, the client will store the file check value in the copy hash table for standby.
S202, comparing the file check value with the file check value in a local resource package to determine the file check value of a target sub-file, wherein the local resource package comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is a sub-file in a resource package to be updated, wherein the file check value of the sub-file is changed relative to the file check value in the local resource package.
Specifically, for the local resource package in the client, the local resource package is a JavaScript script, the logic code of the local resource package is stored as an app.js file, the app.js file is divided into a plurality of resource files app1.Js, app2.Js, … … and the like according to the routing module, and because one routing module correspondingly represents the mapping relationship between a group of file paths and functions, each resource file corresponds to one file path, but different functional programs may exist under one file path, each resource file is further divided into a plurality of subfiles according to functions, wherein each subfile corresponds to a unique file check value. The client traverses the subfiles in the local resource package, calculates the file check value of each subfile, takes the file path as a key, stores the file check value as a value in the local hash table, compares the file check value in the local hash table with the file check value in the copy hash table, and selects the changed file check value as the file check value of the target subfile.
S203, the file check value of the target sub-file is sent to the server side.
Specifically, after determining the file check value of the target sub-file, the client feeds back the file check value to the server, so that the server can determine the target sub-file based on the file check value of the target sub-file, and load the target sub-file into a download list of the client.
S204, the download server side loads the target subfiles in the download list.
Specifically, after the server side loads the target subfiles into the download list of the client side, the client side downloads the target subfiles loaded into the download list, and then performs hot update based on the downloaded target subfiles.
The embodiment of the application identifies partial subfiles needing to be thermally updated through the file check value, solves the technical problem of low update efficiency caused by the fact that the whole script file needs to be downloaded when the client side carries out thermal update in the prior art, shortens the thermal update time, reduces the flow use and improves the thermal update efficiency
On the basis of the above technical solutions, fig. 3 is a flowchart of another client hot update method according to an embodiment of the present invention, as shown in fig. 3, in the process of downloading the target subfiles in S204, the client hot update method further includes:
S301, judging whether the file size of a target sub-file in a download list is larger than a first preset value;
s302, if the file size of the target sub-file is larger than a first preset value, enabling a breakpoint downloading mode to download the target sub-file;
s303, if the file size of the target subfile is smaller than or equal to a first preset value, judging whether the number of the target subfiles with the file sizes smaller than or equal to the first preset value in the download list is larger than a second preset value;
s304, if the target sub-file is larger than the second preset value, downloading the target sub-file in a batch downloading mode is started.
Specifically, in order to maximally utilize the potential of the chip and the thread to increase the downloading speed, in the downloading process, whether the file size of the target sub-file is larger than a first preset value is also required to be judged, for example, the first preset value is 2M, and when the file size of the target sub-file is larger than the first preset value, the target sub-file is downloaded by utilizing a breakpoint downloading mode, so that the oversized file is prevented from being interrupted in the downloading process; if the size of the target subfiles is smaller than or equal to the first preset value, whether the number of the target subfiles smaller than or equal to the first preset value is larger than the second preset value is needed to be judged, for example, the second preset value is 5, if the number of the target subfiles larger than the second preset value is larger than the second preset value, the number of the downloaded files in the current batch is larger, and at the moment, the target subfiles are downloaded in a batch downloading mode, so that part of the target subfiles can be prevented from being lost in the downloading process.
On the basis of the above technical solutions, fig. 4 is a flowchart of another client hot update method according to an embodiment of the present invention, as shown in fig. 4, after S204, the client hot update method further includes:
s401, replacing the corresponding subfiles in the local resource package by the file paths of the target subfiles, and finishing hot updating.
S402, after the replacement of the target subfile is completed, the version information of the local resource package is modified to be updated current version information.
Specifically, after downloading the target sub-file, the client replaces the believed sub-file in the local resource package by using the file path of the target sub-file to complete the hot update of the client, and after the hot update is completed, the version information in the local resource part is modified into the latest current version information so as to compare the version information when the next hot update is performed.
Optionally, the application is entered directly after the client has completed the hot update.
In summary, the client hot update method provided in the embodiment of the present application has the following advantages: (1) The deployment at the server side is more convenient, only one resource package to be updated is needed to be uploaded, and the update can be carried out at any time; and the client is started to update, so that the whole process is silent and free of sense, excessive participation of users in waiting is not needed, and the user experience is excellent. (2) Through the function modularization segmentation of the download script, the download amount of each update is more concentrated, the increment division is more definite, and thus the lightweight thermal update is realized. (3) The files to be updated are identified by the file check values generated in advance, so that classified downloading of the files is realized, the updating speed is greatly improved, and the updating efficiency is improved.
Fig. 5 is a block diagram of a client hot update apparatus according to an embodiment of the present invention, where the client hot update apparatus is configured at a server, as shown in fig. 5, and the client hot update apparatus includes:
the resource obtaining unit 51 is configured to obtain a resource package to be updated, where the resource package to be updated includes a plurality of resource files divided according to a routing module, where one routing module correspondingly represents a mapping relationship between a set of file paths and functions, each resource file is divided into a plurality of subfiles according to functions, and each subfile corresponds to a unique file check value;
the identifier generating unit 52 is configured to traverse each sub-file in the resource package to be updated, and generate a file check value of each sub-file;
the version information generating unit 53 is configured to generate current version information according to a current timestamp of the resource package to be updated, and push the current version information to the client;
the resource loading unit 54 is configured to load, based on an update resource request sent by the client, a target sub-file to a download list of the client, where the target sub-file is a sub-file in which a file check value in a resource package to be updated is changed with respect to a resource package of a previous version.
Alternatively, the identifier generating unit 52 is specifically configured to:
Traversing each sub-file in the resource package to be updated, and generating a file check value of each sub-file by using a password hash function.
Optionally, before the version information generating unit 53 pushes the current version information to the client, the client thermal updating apparatus further includes:
the verification information receiving unit is configured to receive login verification information sent by the client, perform login verification based on the login verification information, and after the login verification is passed, the version information generating unit 53 performs an action of pushing current version information to the client.
Optionally, after the identifier generating unit 52 generates the file check value of each sub-file, it is further configured to: a file path and a file size for each sub-file are generated.
Optionally, before the resource loading unit 54 loads the target subfile into the download list of the client, the client thermal updating apparatus further includes:
the target subfile determining unit is used for selecting subfiles with changed file verification values in the resource package to be updated based on the resource package of the previous version to obtain target subfiles; or,
and determining the target subfile based on the file check value of the target subfile sent by the client, wherein the file check value of the target subfile is obtained by comparing the file check values of all subfiles sent by the client based on the server with the file check values in the local resource package.
Optionally, after the version information generating unit 53 pushes the current version information to the client, the client thermal updating apparatus further includes:
and the update request receiving unit is used for receiving an update resource request sent by the client, wherein the update resource request is obtained by comparing the current version information sent by the server with the version information of the local resource package by the client.
The client hot updating device provided by the embodiment of the invention can execute the client hot updating method applied to the server side provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Fig. 6 is a block diagram of another client hot update apparatus according to an embodiment of the present invention, where the client hot update apparatus is configured on a client, as shown in fig. 6, and the client hot update apparatus includes:
an identifier receiving unit 61, configured to receive file check values of all subfiles sent by a server;
the identifier comparing unit 62 is configured to compare the file check value with a file check value in a local resource packet, and determine a file check value of a target sub-file, where the local resource packet includes a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relationship between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is a sub-file whose file check value is changed relative to the file check value in the local resource packet;
A result feedback unit 63, configured to send a file check value of the target subfile to the server;
the file downloading unit 64 is configured to download the target subfiles loaded in the download list by the server side.
Optionally, in the process of downloading the target subfile by the file downloading unit 64, the client thermal updating apparatus further includes:
the downloading mode selection unit is used for judging whether the file size of the target subfile in the downloading list is larger than a first preset value or not; if the file size of the target sub-file is larger than a first preset value, downloading the target sub-file in a breakpoint downloading mode; if the file size of the target subfile is smaller than or equal to a first preset value, judging whether the number of the target subfiles with the file sizes smaller than or equal to the first preset value in the downloading list is larger than a second preset value or not; and if the target sub-file is larger than the second preset value, downloading the target sub-file in a batch downloading mode.
Optionally, after the file downloading unit 64 finishes downloading the target subfile, the client thermal updating apparatus further includes:
the hot updating unit is used for replacing corresponding subfiles in the local resource package by file paths of the target subfiles to finish hot updating;
and the version modification unit is used for modifying the version information of the local resource package into updated current version information after the replacement of the target subfile is completed.
The client hot updating device provided by the embodiment of the invention can execute the client hot updating method applied to the client provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
The embodiment of the invention also provides a client hot update system, which comprises:
the server side is used for acquiring a resource package to be updated, traversing each sub-file in the resource package to be updated, generating a file check value of each sub-file, generating current version information according to a current timestamp of the resource package to be updated, pushing the current version information to the client side, and loading a target sub-file to a downloading list of the client side based on a received resource updating request, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to the functions, and each sub-file corresponds to a unique file check value;
and the client is used for determining the file check value of the target sub-file based on the file check value sent by the server and downloading the target sub-file loaded into the download list by the server for hot update.
Specifically, after obtaining a resource package to be updated, the server firstly traverses each sub-file in the resource package to be updated, and generates a file check value for each sub-file by utilizing a password hash function; and then generating current version information according to the current time stamp of the resource package to be updated so as to distinguish resource packages of different versions, when the client logs in to be used, sending login verification information to the server, and after passing the login verification, sending the current version information to the client by the server so as to enable the client to judge whether the client needs to update the resource package. If the judgment result of the client side is that the client side needs to be updated, the client side sends an update resource request to the server side, and the server side loads the subfiles with the file check values changed (namely the target subfiles) into a downloading list of the client side based on the update resource request, so that the client side carries out hot update based on the target subfiles in the downloading list.
By using the client thermal updating system provided by the invention, the technical problem of low updating efficiency caused by the need of downloading the whole script file when the client performs thermal updating in the prior art is solved, and the technical effects of shortening the thermal updating time, reducing the flow use and improving the thermal updating efficiency are realized.
Fig. 7 is a schematic structural diagram of a client hot update device according to an embodiment of the present invention. The client thermal update apparatus is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the respective methods and processes described above, for example, a client-side hot update method applied to a server side or a client-side hot update method applied to a client side.
In some embodiments, the client-side thermal update method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more of the steps of the client hot update method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform a client-side hot update method applied to a server side or client side in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
Embodiments of the present invention also provide a computer program product comprising computer executable instructions which, when executed by a computer processor, are configured to perform the client side thermal update method provided by any embodiment of the present invention as applied to a server side, or as applied to a client side.
Computer program product in the implementation, the computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Of course, the computer program product provided in the embodiments of the present application, whose computer executable instructions are not limited to the method operations described above, may also perform the relevant operations in the client-side hot update method applied to the server and the client-side hot update method applied to the client provided in any embodiment of the present application.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention can be achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (15)

1. A client side hot update method, which is applied to a server side, the client side hot update method comprising:
Obtaining a resource package to be updated, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of subfiles according to the functions, and each subfile corresponds to a unique file check value;
traversing each sub-file in the resource package to be updated, and generating the file check value of each sub-file;
generating current version information according to the current timestamp of the resource package to be updated, and pushing the current version information to a client;
and loading a target sub-file into a downloading list of the client based on the resource updating request sent by the client, wherein the target sub-file is the sub-file in which the file check value in the resource package to be updated is changed relative to the resource package of the last version.
2. The client hot update method of claim 1, wherein traversing each of the subfiles in the resource package to be updated, generating the file check value for each of the subfiles comprises:
and traversing each subfile in the resource package to be updated, and generating the file check value of each subfile by using a password hash function.
3. The client hot update method of claim 1, wherein prior to pushing the current version information to a client, the client hot update method further comprises:
receiving login verification information sent by the client;
and carrying out login verification based on the login verification information, and after the login verification is passed, executing the action of pushing the current version information to the client.
4. The client side hot update method according to claim 1, wherein after generating the file check value of each of the subfiles, the client side hot update method further comprises:
and generating a file path and a file size of each sub-file.
5. The client hot update method of claim 1, wherein prior to loading the target subfile into the client's download list, the client hot update method further comprises:
selecting the subfiles with the file verification values changed in the resource package to be updated based on the resource package of the previous version to obtain the target subfiles; or,
and determining the target subfile based on the file check value of the target subfile sent by the client, wherein the file check value of the target subfile is obtained by comparing the file check values of all subfiles sent by the client based on the server with the file check values in a local resource package.
6. The client hot update method according to claim 1, characterized in that after pushing the current version information to a client, the client hot update method further comprises:
and receiving the resource updating request sent by the client, wherein the resource updating request is obtained by comparing the current version information sent by the server with the version information of a local resource package by the client.
7. A client side hot update method, applied to a client side, the client side hot update method comprising:
receiving a file check value of each sub-file in a resource package to be updated, which is sent by a server side;
comparing the file check value with a file check value in a local resource package to determine a file check value of a target sub-file, wherein the local resource package comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a group of mapping relations between file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is the sub-file in the resource package to be updated, wherein the file check value of the sub-file is changed relative to the file check value in the local resource package;
The file check value of the target subfile is sent to the server side;
and downloading the target subfiles loaded in the download list by the server side.
8. The client side hot update method according to claim 7, wherein in the process of downloading the target subfile, the client side hot update method further comprises:
judging whether the file size of the target subfile in the download list is larger than a first preset value or not;
if the file size of the target sub-file is larger than the first preset value, downloading the target sub-file in a breakpoint downloading mode;
if the file size of the target subfile is smaller than or equal to the first preset value, judging whether the number of the target subfiles with the file sizes smaller than or equal to the first preset value in the downloading list is larger than a second preset value or not;
and if the target sub-file is larger than the second preset value, downloading the target sub-file in a batch downloading mode.
9. The client side hot update method according to claim 7, wherein after the target subfile download is completed, the client side hot update method further comprises:
replacing corresponding subfiles in a local resource package by using the file paths of the target subfiles to finish hot update;
And after the replacement of the target subfile is completed, modifying the version information of the local resource package into updated current version information.
10. A client side hot update apparatus, configured on a server side, the client side hot update apparatus comprising:
the resource receiving unit is used for obtaining a resource package to be updated, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of subfiles according to the functions, and each subfile corresponds to a unique file check value;
the identifier generating unit is used for traversing each sub-file in the resource package to be updated and generating the file check value of each sub-file;
the version information generation unit is used for generating current version information according to the current timestamp of the resource package to be updated and pushing the current version information to the client;
and the resource loading unit is used for loading a target sub-file to a downloading list of the client based on the resource updating request sent by the client, wherein the target sub-file is the sub-file in which the file check value in the resource package to be updated is changed relative to the resource package of the previous version.
11. A client side hot update apparatus, configured to a client side, the client side hot update apparatus comprising:
the identification receiving unit is used for receiving the file check values of all the subfiles sent by the server side;
the identification comparison unit is used for comparing the file check value with the file check value in a local resource package to determine the file check value of a target sub-file, wherein the local resource package comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, each sub-file corresponds to a unique file check value, and the target sub-file is the sub-file with the file check value changed relative to the file check value in the local resource package;
the result feedback unit is used for sending the file check value of the target subfile to the server side;
and the file downloading unit is used for downloading the target subfiles loaded in the downloading list by the server side.
12. A client-side thermal update system, the system comprising:
The server side is used for acquiring a resource package to be updated, traversing each sub-file in the resource package to be updated, generating a file check value of each sub-file, generating current version information according to a current timestamp of the resource package to be updated, pushing the current version information to a client side, and loading a target sub-file to a downloading list of the client side based on the received resource update request, wherein the resource package to be updated comprises a plurality of resource files divided according to a routing module, one routing module correspondingly represents a mapping relation between a group of file paths and functions, each resource file is divided into a plurality of sub-files according to functions, and each sub-file corresponds to a unique file check value;
and the client is used for determining the file check value of the target sub-file based on the file check value sent by the server and downloading the target sub-file loaded into a download list by the server for hot update.
13. A client thermal update apparatus, the client thermal update apparatus comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform a client side thermal update method for a server side according to any one of claims 1-6 or a client side thermal update method for a client side according to any one of claims 7-9.
14. A computer readable storage medium storing computer instructions for causing a processor to implement the client side thermal update method applied to a server side of any one of claims 1 to 6 or the client side thermal update method applied to a client side of any one of claims 7 to 9 when executed.
15. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the client-side thermal update method applied to a server according to any one of claims 1-6 or implements the client-side thermal update method applied to a client according to any one of claims 7-9.
CN202310199304.4A 2023-02-28 2023-02-28 Client hot updating method, device and equipment Pending CN116339774A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310199304.4A CN116339774A (en) 2023-02-28 2023-02-28 Client hot updating method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310199304.4A CN116339774A (en) 2023-02-28 2023-02-28 Client hot updating method, device and equipment

Publications (1)

Publication Number Publication Date
CN116339774A true CN116339774A (en) 2023-06-27

Family

ID=86893989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310199304.4A Pending CN116339774A (en) 2023-02-28 2023-02-28 Client hot updating method, device and equipment

Country Status (1)

Country Link
CN (1) CN116339774A (en)

Similar Documents

Publication Publication Date Title
CN110858172A (en) Automatic test code generation method and device
CN110888658B (en) Method and device for dynamically changing function modules in application program and storage medium
CN111752843A (en) Method, device, electronic equipment and readable storage medium for determining influence surface
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN114217848A (en) Dependency relationship processing method and device, electronic equipment and computer storage medium
CN113541987A (en) Method and device for updating configuration data
CN116501997A (en) Short link generation method, device, electronic equipment and storage medium
CN110781424A (en) Method for intelligently clearing browser cache for Web project automation test
CN116339774A (en) Client hot updating method, device and equipment
CN112052152A (en) Simulation test method and device
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN111338928A (en) Chrome-based browser testing method and device
CN112506796A (en) Data processing method, device, equipment and storage medium
JP2019152947A (en) System management device, system management method, and program
CN110262756B (en) Method and device for caching data
CN115840604B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN115794165A (en) Application upgrading method and device, EPS and medium
CN114661439A (en) Method, device, equipment and storage medium for migrating system application configuration
CN115270672A (en) Verification method, device, equipment and storage medium of TCAM (ternary content addressable memory) encapsulation module
CN116233051A (en) Page sharing method, device and equipment for applet and storage medium
CN117931349A (en) Application interface theme changing method and device, electronic equipment and storage medium
CN115633008A (en) Block chain-based group to-do function implementation method, device, equipment and medium
CN116737316A (en) Control method, device, equipment and storage medium for virtual machine VNC password
CN117472732A (en) Gray scale test method, device and equipment
CN117596141A (en) Message assembling method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination