Created
January 20, 2016 16:11
-
-
Save snyh/3321c93c3ea310fc643f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 Why we don't use server side choosing mirror? | |
═══════════════════════════════════════════════ | |
The IP address family can't reflect the connection status between | |
mirror server and the user, especially in China. | |
We belive Only the user side can make the best choose. | |
2 How deepin solve the problem? | |
═══════════════════════════════ | |
2.1 Make Sure that anytime the selected mirror is 100% freshness, even the mirror server is broken. | |
───────────────────────────────────────────────── | |
How deepin make the magic? The idea if very simple and workable. | |
Let apt detect every download file from mirror server and official | |
server at the same time. Using the mirror server one if available, | |
otherwise using the official server one. | |
It even can work well when the mirror is partially fresh, e.g. syncing | |
from official server. | |
2.2 Why this can workable? | |
───────────── | |
• The cost of detection is very little if it make in user side. We can | |
just using HTTP HEAD method do this for deb file and with by-hash | |
feature for Packages files. | |
• The Release file is always from official server and it's very | |
little. This can make sure the Packages files is 100% fresh and then | |
make sure all deb is 100% fresh. | |
2.3 How this be implement? | |
───────────── | |
• Patching the [apt] for hooking choosing URI in | |
pkgAcquire::Worker::QueueItem | |
• The final URI will be find by third-part program (currently is | |
lastore-smartmirrors) | |
• The third-part program just simply send a HEAD request both to | |
mirror and official server. | |
[apt] | |
https://github.com/linuxdeepin/lastore-daemon/blob/master/smartmirror.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 1, Why not choose mirrors on the server side?
Line 7, .. make the best choice
Line 10, How does
Line 11,
Line 11, Make sure the selected download source is always 100% up-to-date with the main (upstream Deepin) repo
Line 16, How does again, if -> is
Line 18, detect -> check/probe if the file is available .. If so, use the mirror
Line 26, How can this work?
Line 29, if we do it, detection -> probing
Line 30.., We can just use the HTTP
HEAD
method to probe for the corresponding file's existence on the mirror. With the by-hash feature in apt which encodes the deb hash in the filename enabled, we can be sure about which file we are pointing to. [note1]Line 33, little -> small (in size)
Line 37, implemented
Line 44, the
third-partyexternal program <https://github.com/linuxdeepin/lastore-daemon/tree/master/src/lastore-smartmirror >Generated by a brain too bored on a Physics class (not enough laptop battery power to run KSP).
accidentally deleted.