当前位置:网站首页>Incremental update of client software
Incremental update of client software
2022-04-23 06:44:00 【The old man is outside the door】
Incremental updates use an open source library bsdiff,bsdiff It's a difference algorithm , The principle is that old documents are compared with new documents , Use as much as possible old What is already in the file , Add as little new content as possible to build new file .
The common practice is to match the old file with the new file or use hash Technology extracts the common part , Then type the rest of the new document into patch package ( The offset address of the new content relative to the old content is recorded in the differential package ),
stay Patch Use in stage copying and insertion Two operations combine old files with patch File composition new file .
Incremental update process :
On the server side , Use bsdiff The tools put the old apk And the new apk Compare and get the differential package patch package ,
Download to local via network , adopt bspatch Tools to put local old apk and patch Package synthesis new apk package . Finally, install the new apk
shortcoming :
We can't guarantee that all users can upgrade , Like our latest patch Bag is 2.0 Version and 3.0 Version difference ,
If the user uses 1.0 edition , Then you cannot upgrade successfully , So we have to make a 1.0 and 3.0 Differential subcontracting between .
With more and more versions , There are more and more subcontracts to be done . Can be in Linux Write an automatic script to complete .
If the differential package is tampered with during downloading, it cannot be synthesized successfully , You can download it through md5 Or in some other way patch Check the integrity of the package .
bsdiff Incremental updating
BSDiff Is a difference update algorithm , It runs on the server side BSDiff Algorithm generation patch package , Run on client BSPatch Algorithm , Combine old files with patch Package composition new file .
The core idea of difference updating algorithm
Use as much as possible old What is already in the file , Add as little new content as possible to build new file . The usual practice is to old Document and new File to do substring matching or use hash technology , Extract public part , take new The rest of the file is packaged into patch package , stay Patch In phase , use copying and insertion Two basic operations can make old Document and patch Package synthesis new file .
BSDiff Algorithm improvement
Insertion Operation will cause a lot of pointer changes and modifications , These values need to be recorded before they can be used in Patch The stage relocates the modified area , Because these pointer control words must be in BSDiff Stage join patch package , Produced patch The bag will be bigger .BSDiff By introducing diff string The concept of , The number of pointer control words to be recorded is greatly reduced , Thus making patch The bag is smaller .
BSDiff The three basic steps are as follows :
1. Yes old All substrings in the file form a dictionary ;
2. contrast old Document and new file , produce diffstring and extra string;
3. take diffstring and extra string And the corresponding control word zip Compress into one patch package .
BSPatch Basic steps :
Client synthesis patch The basic steps are as follows :
1. receive patch package ;
2. decompression patch package ;
3. Restore new file .
Dual directory update idea :
As the update package gets bigger and bigger , It takes longer and longer to download and install updates , Cause users to wait for a long time , Some software adopts the way of background download and background update . The so-called background download is to update immediately no matter whether the user clicks or not ,
As long as there is a new version, it will be secretly downloaded to users in the background , A little rogue , But this is also for the user experience . What about background updates , Running programs , Every file is occupied , It can't be updated . still Chrome Think out ,
Dual directory update , Copy the version to another directory first , Then update this new copy , The next time the user starts, start the new version directly . such as Chrome There is the following directory structure
Chrome
+Application
+35.0.1916.153
+35.0.1916.114
chrome.exe
It uses the version number as the directory name , Update the new version every time you upgrade , The old version running in another directory is not affected . Next time it starts Chrome.exe Always load the latest version of dll Just run it .
chrome.exe It's a small program , The logic inside is to detect the version number and load the latest version dll, The program itself hardly needs to be updated .
1.csdn post
https://blog.csdn.net/darling757267/article/details/80652267
2. Simple books
https://www.jianshu.com/p/ca40bfc4a81f?utm_campaign=maleskine&utm_content=note&utm_medium=writer_share&utm_source=weibo
3.github Address
https://github.com/mendsley/bsdiff
4. You know
https://www.zhihu.com/question/24263552
版权声明
本文为[The old man is outside the door]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230548038892.html
边栏推荐
猜你喜欢
【UDS统一诊断服务】三、应用层协议(2)
非参数化相机畸变模型简介
[UDS unified diagnosis service] i. diagnosis overview (2) - main diagnosis protocols (K-line and can)
[untitled]
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
CUDA环境安装
Shell脚本 &&和||的使用
【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (1)
VHDL-任意分频器(50%占空比)
Dynamic creation and release, assignment and replication of objects
随机推荐
深蓝学院激光slam理论与实践 -第二章(里程计标定)作业
For() loop parameter call order
Vscode custom comments
约瑟夫序列 线段树 O(nlogn)
基于VGG对五种类别图片的迁移学习
C语言 #和##的使用
[ThreadX] h743 + ThreadX + Filex migration record
在visual stdio中运行qt程序
CUDA environment installation
ROS包nmea_navsat_driver读取GPS、北斗定位信息笔记
C语言实现memcpy、memset、strcpy、strncpy、strcmp、strncmp、strlen
Opencv uses genericindex for KNN search
【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (1)
【UDS统一诊断服务】四、诊断典型服务(4)— 在线编程功能单元(0x34-0x38)
【UDS统一诊断服务】一、诊断概述(3)— ISO 15765体系结构
浮点数双精度,单精度以及半精度知识总结
基于Keras的时装分类案例
CUDA环境安装
Protection of shared data
Makefile基础、常用函数及通用Makefile