Store the peer rank as an attribute and recalculate it automatically.
[quix0rs-apt-p2p.git] / TODO
1 Add all cache files to the database.
2
3 All files in the cache should be added to the database, so that they can
4 be checked to make sure nothing has happened to them. The database would
5 then need a flag to indicate files that are hashed and available, but
6 that shouldn't be added to the DHT.
7
8
9 Packages.diff files need to be considered.
10
11 The Packages.diff/Index files contain hashes of Packages.diff/rred.gz 
12 files, which themselves contain diffs to the Packages files previously 
13 downloaded. Apt will request these files for the testing/unstable 
14 distributions. They need to be dealt with properly by 
15 adding them to the tracking done by the AptPackages module.
16
17
18 PeerManager needs to download large files from multiple peers.
19
20 The PeerManager currently chooses a peer at random from the list of 
21 possible peers, and downloads the entire file from there. This needs to 
22 change if both a) the file is large (more than 512 KB), and b) there are
23 multiple peers with the file. The PeerManager should then break up the 
24 large file into multiple pieces of size < 512 KB, and then send requests 
25 to multiple peers for these pieces.
26
27 This can cause a problem with hash checking the returned data, as hashes 
28 for the pieces are not known. Any file that fails a hash check should be 
29 downloaded again, with each piece being downloaded from different peers 
30 than it was previously. The peers are shifted by 1, so that if a peers 
31 previously downloaded piece i, it now downloads piece i+1, and the first 
32 piece is downloaded by the previous downloader of the last piece, or 
33 preferably a previously unused peer. As each piece is downloaded the 
34 running hash of the file should be checked to determine the place at 
35 which the file differs from the previous download.
36
37 If the hash check then passes, then the peer who originally provided the 
38 bad piece can be assessed blame for the error. Otherwise, the peer who 
39 originally provided the piece is probably at fault, since he is now 
40 providing a later piece. This doesn't work if the differing piece is the 
41 first piece, in which case it is downloaded from a 3rd peer, with 
42 consensus revealing the misbehaving peer.
43
44
45 Consider storing deltas of packages.
46
47 Instead of downloading full package files when a previous version of
48 the same package is available, peers could request a delta of the
49 package to the previous version. This would only be done if the delta
50 is significantly (>50%) smaller than the full package, and is not too
51 large (absolutely). A peer that has a new package and an old one would
52 add a list of deltas for the package to the value stored in the DHT.
53 The delta information would specify the old version (by hash), the
54 size of the delta, and the hash of the delta. A peer that has the same
55 old package could then download the delta from the peer by requesting
56 the hash of the delta. Alternatively, very small deltas could be
57 stored directly in the DHT.
58
59
60 Consider tracking security issues with packages.
61
62 Since sharing information with others about what packages you have
63 downloaded (and probably installed) is a possible security
64 vulnerability, it would be advantageous to not share that information
65 for packages that have known security vulnerabilities. This would
66 require some way of obtaining a list of which packages (and versions)
67 are vulnerable, which is not currently available.
68
69
70 Consider adding peer characteristics to the DHT.
71
72 Bad peers could be indicated in the DHT by adding a new value that is
73 the NOT of their ID (so they are guaranteed not to store it) indicating
74 information about the peer. This could be bad votes on the peer, as
75 otherwise a peer could add good info about itself.
76
77
78 Consider adding pieces to the DHT instead of files.
79
80 Instead of adding file hashes to the DHT, only piece hashes could be
81 added. This would allow a peer to upload to other peers while it is
82 still downloading the rest of the file. It is not clear that this is
83 needed, since peer's will not be uploading and downloading ery much of
84 the time.