A kind of method and system of pre-update software client
Technical field
The present invention relates to software upgrading field, particularly a kind of method and system of pre-update software client.
Background technology
The renewal of tradition application software, generally upgrades along with the issue of update software.But for the field of widespread use, such as office software, game etc., because the number of users using is huge simultaneously, if these users upgrade simultaneously, easily cause server to stop up, increase server load, cause server running fault, this has affected again user's renewal conversely.
For the larger software of renewal amount, such as big game application software etc., because updating file is downloaded consuming time longer, cannot meet user and upgrade in time and use in time, can bring much inconvenience to user, especially upgrade the time limit, while upgrading compared with multi-user simultaneously, this situation not only easily impacts server, and, more can seriously delay update time of user.
Summary of the invention
For addressing the above problem, the object of the present invention is to provide a kind of method and system of pre-update software client, reduce server load, for user, upgrade in time in time.
The present invention solves the technical scheme that its problem adopts:
Preferred enforcement of the present invention just provides a kind of method of pre-update software client, comprising:
(1) updating file is stored in the middle of data source file, and according to updating file data source index file corresponding to the storage Information generation in data source file;
(2) client is downloaded this data source file automatically;
(3) difference of front and back client is upgraded in contrast, according to data source index file, generates update instruction file;
(4) client is downloaded this update instruction file automatically, and upgrades according to this update instruction file and the data source file downloaded.
Described data source index file has been stored sign, off-set value and the size of updating file in data source file.
Described step (3) is specially:
The difference between the client of front and back is upgraded in contrast;
Newly-increased for needs or revise updating file, from reading in the middle of data source index file, need sign, off-set value and size newly-increased or updating file that revise, generate corresponding newly-increased file instruction, the file of deleting for needs, record needs the sign of deleted file, generates corresponding deleted file instruction;
The version number of client after the title of data source file and renewal is write to update instruction file.
In described step (4), according to this update instruction file and the data source file downloaded, upgrade and be specially:
The data source file corresponding according to the name lookup of the data source file recording in update instruction file;
Carry out one by one newly-increased file instruction and deleted file instruction in update instruction file, for newly-increased file instruction, according to the sign of the updating file recording in newly-increased file instruction, off-set value and size, from reading corresponding updating file in the middle of data source file, write client, for deleted file instruction, according to the sign of the deleted file recording in deleted file instruction, from client, delete corresponding file;
The version number recording in update instruction file is write to client.
Another preferred embodiment of the present invention provides a kind of system of pre-update software client, comprising:
Data source generation module, is stored in updating file in the middle of data source file in the mode of continuous blocks, and according to updating file data source index file corresponding to the storage Information generation in data source file;
Free download module, client is downloaded this data source file automatically;
Update instruction generation module, the difference of front and back client is upgraded in contrast, according to data source index file, generates update instruction file;
Update module, client is downloaded this update instruction file automatically, and upgrades according to this update instruction file and the data source file downloaded.
Described data source index file has been stored sign, off-set value and the size of updating file in data source file.
Described update instruction generation module comprises:
Contrast unit, the difference between the client of front and back is upgraded in contrast;
Newly-increased delete cells, newly-increased for needs or revise updating file, from reading in the middle of data source index file, need sign, off-set value and size newly-increased or updating file that revise, generate corresponding newly-increased file instruction, the file of deleting for needs, record needs the sign of deleted file, generates corresponding deleted file instruction;
Extra cell, writes update instruction file by the version number of client after the title of data source file and renewal.
Described update module comprises:
Search unit, the data source file corresponding according to the name lookup of the data source file recording in update instruction file;
Performance element, carry out one by one newly-increased file instruction and deleted file instruction in update instruction file, for newly-increased file instruction, according to the sign of the updating file recording in newly-increased file instruction, off-set value and size, from reading corresponding updating file in the middle of data source file, write client, for deleted file instruction, according to the sign of the deleted file recording in deleted file instruction, from client, delete corresponding file;
Version updating unit, writes client by the version number recording in update instruction file.
The invention has the beneficial effects as follows:
The present invention adopts a kind of method and system of pre-update software client, first according to updating file generated data source file and the data source index file corresponding with data source file, user can download this data source file in advance, when client need to be upgraded, according to the difference of upgrading former and later two clients, generate instruction updating file, update instruction file comprises newly-increased and delete instruction, newly-increased instruction has comprised need to increase and revise to client the instruction of corresponding updating file newly, as long as read corresponding updating file information from data source index file, thereby avoided searching one by one the loaded down with trivial details of updating file from huge data source file, delete instruction has recorded the file identification that needs deletion, user can upgrade client according to this instruction updating file, in whole process, data source file can be downloaded in advance, avoided the huge downloading flow of simultaneously downloading identical update time, having eliminated server obstruction etc. may cause server to produce the problem of fault, update instruction file is the index to data source file just, has greatly dwindled the flow of downloading while upgrading, and can not impact immediate updating, user upgrades according to this update instruction file, can reach the effect that upgrades in time and use in time.
Accompanying drawing explanation
Below in conjunction with accompanying drawing and example, the invention will be further described.
Fig. 1 is the process flow diagram of the method for the invention;
Fig. 2 is the process flow diagram of generation update instruction file of the present invention;
Fig. 3 is the process flow diagram that client of the present invention is upgraded;
Fig. 4 is the structure composition frame chart of system of the present invention;
Fig. 5 is the structure composition frame chart of update instruction generation module of the present invention;
Fig. 6 is the structure composition frame chart of update module of the present invention.
Embodiment
The invention provides a kind of method of pre-update software client, shown in Fig. 1, comprise step:
Step 100, is stored in updating file in the middle of data source file, and according to updating file data source index file corresponding to the storage Information generation in data source file; Wherein, updating file is stored in the middle of data source file in the mode of continuous blocks, data source index file has recorded sign, off-set value and the size of updating file in the middle of data source file, and described sign can be the cryptographic hash of filename or the filename of updating file;
Step 101, service end is after generated data source file and data source index file, and client can be downloaded this data source file automatically, during download, can automatically be carried out by the background program of client, or is selected to download by user according to corresponding prompting;
Step 102, the difference of front and back client is upgraded in contrast, according to data source index file, generates update instruction file;
Step 103, client is downloaded this update instruction file automatically, and upgrades according to this update instruction file and the data source file downloaded.
Shown in Fig. 2, described step 102, when generating update instruction file, comprising:
Step 200, the difference between the client of front and back is upgraded in contrast;
Step 201, by contrast, can know the updating file that before upgrading, client need to be increased, modified or deleted, newly-increased for needs and revise updating file, from reading in the middle of data source index file, need sign, off-set value and size newly-increased or updating file that revise, with this, generate corresponding newly-increased file instruction, the updating file of deleting for needs, record needs the sign of deleted file, generates corresponding deleted file instruction;
Step 202, after above step completes, need to write the version number of client after the title of data source file and renewal in the middle of update instruction file.
Shown in Fig. 3, when described step 103 is upgraded according to update instruction file and the data source file downloaded, specifically comprise:
Step 300, the position that first needs to search the data source file of having downloaded, can find corresponding data source file according to the title of the data source file recording in update instruction file;
Step 301, carry out one by one newly-increased file instruction and deleted file instruction in update instruction file, for newly-increased file instruction, according to the sign of the updating file recording in newly-increased file instruction, off-set value and size, from reading corresponding updating file in the middle of data source file, write client, for deleted file instruction, according to the sign of the deleted file recording in deleted file instruction, from client, delete corresponding file;
Step 302, writes client by the version number recording in update instruction file.
In the present invention, server is after generated data source file and corresponding data source index file, and client can be downloaded this data source file automatically, or is selected to download by client, but does not now carry out renewal; When needs upgrade, server can generate update instruction file automatically, these update instruction files generate according to the difference between client before and after upgrading, the inside has comprised newly-increased file instruction and deleted file instruction, newly-increased file instruction can directly be searched from data source index file, and needn't go to search from data source file itself, has saved the time of searching, client can automatically be downloaded this update instruction file and upgrade, and also can be selected to upgrade by user.Because data source index file is with respect to data source file, the size of itself is very limited, therefore, can greatly shorten the formation speed of update instruction file, improves the more new technological process of postorder; Between update instruction file and data source file owing to thering is an intergrade, during this period, user carries out the download segmentation of two files, solve user while upgrading at one time and downloaded the problem that may cause server to stop up simultaneously, improved the efficiency of upgrading simultaneously, and met all users and upgrade and follow-up timely application simultaneously.
The present invention also provides a kind of system of pre-update software client, shown in Fig. 4, comprising:
Data source generation module 400, is stored in updating file in the middle of data source file in the mode of continuous blocks, and according to updating file data source index file corresponding to the storage Information generation in data source file;
Free download module 401, client is downloaded this data source file automatically;
Update instruction generation module 402, the difference of front and back client is upgraded in contrast, according to data source index file, generates update instruction file;
Update module 403, client is downloaded this update instruction file automatically, and upgrades according to this update instruction file and the data source file downloaded.
Described data source index file has been stored sign, off-set value and the size of updating file in data source file.
Shown in Fig. 5, described update instruction generation module 402 comprises:
Contrast unit 500, the difference between the client of front and back is upgraded in contrast;
Newly-increased delete cells 501, newly-increased for needs or revise updating file, from reading in the middle of data source index file, need sign, off-set value and size newly-increased or updating file that revise, generate corresponding newly-increased file instruction, the file of deleting for needs, record needs the sign of deleted file, generates corresponding deleted file instruction;
Extra cell 502, writes update instruction file by the version number of client after the title of data source file and renewal.
Shown in Fig. 6, described update module 403 comprises:
Search unit 600, the data source file corresponding according to the name lookup of the data source file recording in update instruction file;
Performance element 601, carry out one by one newly-increased file instruction and deleted file instruction in update instruction file, for newly-increased file instruction, according to the sign of the updating file recording in newly-increased file instruction, off-set value and size, from reading corresponding updating file in the middle of data source file, write client, for deleted file instruction, according to the sign of the deleted file recording in deleted file instruction, from client, delete corresponding file;
Version updating unit 602, writes client by the version number recording in update instruction file.
The concrete implementation of described system is with reference to described in described method, and described system can be completely achieved function described in described method.
The above, be preferred embodiment of the present invention, and the present invention is not limited to above-mentioned embodiment, as long as it reaches technique effect of the present invention with identical means, all should belong to protection scope of the present invention.