diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-24 10:37:31 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-04-24 17:54:08 -0700 |
commit | c60d2ec3e3ea09b344e42f9671fefb46eb8ec334 (patch) | |
tree | d090e1efe408ca47581917b9cc904c55e985800f /core/cochran.h | |
parent | acc343834ae416aa4a17a0cd508c8ddf31f8281d (diff) | |
download | subsurface-c60d2ec3e3ea09b344e42f9671fefb46eb8ec334.tar.gz |
use libdivecomputer 'fingerprint' to avoid downloading extra data
This opportunistically uses a cache of 'fingerprints' for already
downloaded dives.
As we download data from a dive computer, we save the fingerprint and
dive ID of the most recent dive in a per-divecopmputer fingerprint cache
file.
The next time we download from that dive computer, we will load the
cache file for that dive computer if it exists, verify that we still
have the dive that is referenced in that cachefile, and if so use the
fingerprint to let libdivecomputer potentially stop downloading dives
early.
This doesn't much matter for most dive computers, but some (like the
Scubapro G2) are not able to download one dive at a time, and need the
fingerprint to avoid doing a full dump. That is particularly noticeable
over bluetooth, where a full dump can be very slow.
NOTE! The fingerprint cache is a separate entity from the dive log
itself. Unlike the dive log, it doesn't synchronize over the cloud, so
if you download using different clients (say, your phone and your
laptop), the fingerprint cache entries are per device.
So you may still end up downloading dives you already have, because the
fingerprint code basically only works to avoid duplicate downloads on
the same installation.
Also, note that we only have a cache of one single entry per dive
computer and downloader, so if you download dives and then don't save
the end result, the fingerprint will now point to a dive that you don't
actually have in your dive list. As a result, next time you download,
the fingerprint won't match any existing dive, and we'll resort to the
old non-optimized behavior.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/cochran.h')
0 files changed, 0 insertions, 0 deletions