What is the incremental update for software?

Source: Internet
Author: User
Tags lua silverlight

Incremental update of software

Because of moving to C #, a lot of things have been lost before. Now, starting from scratch, the first one is the automatic updating of the client. Previously, a simple search of the implementation of the relevant functions. There is an article I did not understand, another piece of the article said it should be to submit local data, and then calculate the differential packet, let the server return the differential packet. Of course, this is not impossible. It's certainly possible, but this part of the job may be a bit of a hassle for the server. Because you have to let the server have this computing power. Refer to the COCOS2DX 3.9 Lua Incremental update module and simply make an infrastructure model out of it.

What did you do?

Overwrite the installation

This is actually very simple, is to re-download a complete installation package, and then reinstall again, regardless of the original content, if the original content is so long replaced, if there is no content then add the new content is. In fact, this is easy to say, but there may be some problems.

-Traffic problems may now seem to be not a big problem, because the bandwidth is now very wide. 100M content according to 10MPBS bandwidth to calculate, also can be downloaded over a minute. -Slag problem This overlay installation generally has a problem with scum. For example, I have generated a file in the installation directory that is not in the subsequent installation package, so there is no way to get rid of this file. This can be awkward, for example, your project relies on a DLL provided by your system, and if you have a DLL in your directory, you will prefer to use the DLL in your directory (if I remember it correctly), and if I am an attacker, I would probably give you a DLL where I planted the virus. It's embarrassing.

Hit patch

This principle is also relatively simple, in fact, we all feel that the full installation is too laborious, then my software needs more frequent updates, such as some board games may be a holiday related features, so that you can add a new DLL and then not a complete installation package. Then I can patch it on the basis of the complete installation package. For example, I was out of version 1.0, after 10 days half a month dragon Boat festival, I have a dragon boat skin type, then I can directly on the basis of 1.0 to play a dragon boat patch, so he becomes the latest client 1.1. If I want to do something else in the future, I'll make a patch on the base of 1.1, making the client become 1.2. But there will be a problem with him.

-Sequential installation in the installation process can only be installed in this incremental installation, I can only 1.0 = 1.1 = 1.2; not 1.0 = "1.2. Because there is no corresponding patch in the middle. -Flow problem In fact, this solution may bring some problems, for example, now Dragon Boat Festival, I need to decorate the house into a dragon boat style, and then Wuyi Labor Day, I need to decorate the house into Wuyi Labor Day appearance. So all about the skin of the house, I have no way to keep, because the next year must not be so renovated, because the outdated too low. So about this part of the content, if you want to upgrade 1.1 points for the final version of the useless, you occupy a bit of traffic is not used. It's too embarrassing. -Maintenance complexity because you can't go straight out of a 1.0 after all are using patches, if your version number is incremented to a certain extent, the size of the patch may be far more than the size of your re-downloading of an up-to-date client. So it can only be done by the time (like six months or a quarter) by meaning (for example, Big version 2.0 3.0) to generate a complete client. This allows the user to find a recent full client version number at the time of the download. Then patch the way to get the latest client, but the complexity of this maintenance should be not small.

The core of our needs.

In fact our needs are very simple to get the latest client. Then the additional requirements are to save traffic, download convenience, the service side release convenience.

Save Flow

In fact, when it comes to saving traffic, it is possible to use local local directly. Local is really not the file, then downloaded from the network. This basically achieves the effect of saving the flow.

Easy to download

There's no need to do too much, and of course this is a lot of software. The above mentioned in fact can also be automated, for example, the full installation then I will directly download the latest full installation package, if it is a patch of this, then download the latest full installation package and the back of the patch is good. In fact, this really to do, for the user should be no feeling. All the same, but for programmers. The development that may be faced is not quite the same.

Service-side release convenience

In fact, this is entirely aimed at the programmer, in general, if this thing can be done automatically by the program will be sure to give the program. For example, the complete evening package of this, will certainly be able to do automatic packaging. Patching this is nothing more than a patch generated from the previous version. Or regenerate into a complete installation package. Uploading to the appropriate file server is fine. In fact, patching or complete installation package, there is a significant advantage is that it can be conveniently placed on multiple servers to carry out file load balancing.

So what do we do?

In thinking about this, I thought about the COCOS2DX 3.9 Lua Auto-update module that was previously contacted, and he did so through a configuration file that shows that the latest client contains those files, what the MD5 value is, and what the network path is. When the client gets the configuration list, it is easy to judge that the local files can continue to be used. Those files are obsolete so that the client can get the latest corresponding files by configuring the network path location in the heart. But that was a long time ago, otherwise, I don't need to re-plan. Just copy a copy of the code. Let's make a set up yourself. This is more thorough, to change what you want to change.

Format of the file

{"Versionscheckcode": "xc09vu4qcrd43lrf01byod26d45dweekx5kecukia7q4160fkawqbhxtke63z148", "TimeStamp": 1496649771 , "ServerURL": "Http://or2dwwrsz.bkt.clouddn.com", "Fileinfos": [{"FilePath": "Jumpkick.httplib\\packages\\ Moq.4.2.1409.1722\\lib\\net40\\moq.xml "," FileMD5 ":" c7e9c70a19b84f31e51eb65f4ee38803 "," FileUrl ":" Lv4zbb_ c7e9c70a19b84f31e51eb65f4ee38803 "},{" FilePath ":" jumpkick.httplib\\packages\\moq.4.2.1409.1722\\lib\\sl4\\ Moq.Silverlight.dll "," FileMD5 ":" 0ee20e7ccba7d6667c48efebe41503ff "," FileUrl ":" X057qt_ 0ee20e7ccba7d6667c48efebe41503ff "},{" FilePath ":" jumpkick.httplib\\packages\\moq.4.2.1409.1722\\lib\\sl4\\ Moq.Silverlight.xml "," FileMD5 ":" c25417228db2dd820f45e93112e8596c "," FileUrl ":" S0lo6g_ C25417228db2dd820f45e93112e8596c "}]}

A simple explanation

    • Versionscheckcode: Current version file checksum information.

    • TimeStamp: Time stamp to do this file

    • ServerURL: The address of the server, mainly used for splicing with subsequent files.

    • Fileinfos: List of corresponding file information

    • Fileinfos[?]:filepath: Local file path, corresponding local address after downloading from the network

    • FILEINFOS[?]:FILEMD5: The MD5 value of this file, used to determine if the original corresponding location of the file is the same as the file on the network

    • Fileinfos[?]:fileurl: This file exists in the network location, of course, this is not the front URL path is serverurl behind the content

Project Address

In fact, the whole project is the most complicated place when this updated idea is made with this document. The rest of the content is actually relatively simple, is the implementation of the specific code. Code convenience I am too lazy to say, directly to the project address thrown up.

Client


Service side


The benefits of doing so

Save traffic, easy to combine with other software, convenient for server release. Save traffic This is the top of the mentioned I said.

Easy to combine with other software

In fact, it is easy to understand that the software is updated with the software a dime relationship does not. So I can just run up on the line, do not need a relationship specifically updated software is how to do. Use this item up to a maximum. Just re-change the UI on our side of the line.

Convenient Server Publishing

In fact, the most troublesome thing is the server side. Need to generate this configuration file, my side of the server is actually not running refers to the tool to generate this file. I can specify a directory. This file is then generated to export all files of the corresponding directory to an output directory. However, for many CDN does not support multi-level directory (such as seven cattle), so I will all the files have changed the name, so that they try not to repeat, the program can read the line.

How to use

First, use the server I have written to generate the corresponding configuration files and renaming files.

The resulting directory structure is so colored that the configuration file is placed inside a fixed directory. Upload folder upload to a file server, here I use seven Qiniu

and upload all the files from the upload directory.

That's what it's like when you're done uploading.

The speech server is deployed, and so on with the new version again this operation is OK. In fact, this part of the upload server work can be integrated into the service side. Upload the content just fine, in fact very simple. Of course, this is my lazy. Previously there was no research on the SDK of seven kn This can be used as a function extension, anyway project I have open source, interested people can expand this part of the function themselves. OK, let's continue to say what the client does.

How to use the client?

 Autoupdatehelper helper = new Autoupdatehelper (); Helper.            Webxmlurl = "Http://7xs9hw.com1.z0.glb.clouddn.com/VersionInfo.json"; Helper.            Configxmlpath = "Synchronizeversions.xml"; Helper.            Tempxmlpath = "Synchronizeversions_temp.xml"; Helper.            FilePath = "Client"; Helper.                    CallBack = obj = {if (obj is Dictionary<updatedatatype, object>) {                    var dic = obj as Dictionary<updatedatatype, object>; foreach (var item in dic) {if (Name2action.containskey (item. Key)) Name2action[item. Key] (item.                    Value);            }                }            }; try {Helper.            Start (); } catch (Exception ex) {MessageBox.Show (ex.            Message); }

is actually a simple set of URLs and configuration files. Actually, this place should be. Configuration is also put in the configuration file inside, why not put it? Because I am lazy, hahaha.

Run diagram of the client

The client ran out of the closed, in fact, should be run out of a specific file, and then automatically update the logic is complete, this Part I will continue to improve.

The wrong place

This kind of processing actually download will become very flexible. But it also leads to other problems. For example, the packing problem mentioned earlier. Because the server is just a file server, so the server does not calculate the ability to differentiate packets, so all the files are one-to-one download, so there will be a lot of small files download. This kind of download is actually compared to the egg ache. This is the design of the pit. To be flexible, we can only compromise.

The wrong place to achieve

In fact, so far I just realized the most basic function. Not even yet, for example, after the file is started, but the general framework has been set up. As for the back there are a lot of implementation is not very reasonable place, I first a single column, convenient after maintenance.

    • Download failed retry does not exist

    • The limit for the number of downloads does not exist (now is how many downloads, many simultaneous downloads may have a time-out problem.) )

    • The corresponding file is not started after the completion

    • There is no Quick start feature (now every boot needs to re-verify all files, you can actually avoid this problem.) )

Something

Although this project is just an imperfect framework. But this update should make the update more interesting. Let's complete this framework together. More hope to do a successful open source project, do not forget beginner's mind.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.