This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 496
Overhaul of DiagnosisKey related Download and Caching Mechanisms (EXPOSUREAPP-2469) #1136
Merged
d4rken
merged 29 commits into
feature/interoperability
from
feature/interop-caching-logic-2469
Sep 11, 2020
Merged
Overhaul of DiagnosisKey related Download and Caching Mechanisms (EXPOSUREAPP-2469) #1136
d4rken
merged 29 commits into
feature/interoperability
from
feature/interop-caching-logic-2469
Sep 11, 2020
Conversation
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
* Supports interop * More modular for better testing and build flavour based behavior adjustments * More resilient handling of failed downloads * Preperations for future hourly download and serverside checksums TODO: Finish unit tests, keycache migration and cache health check
…the tests surfaced.
TODO: Tests for downloader and migration.
d4rken
added
enhancement
Improvement of an existing feature
maintainers
Tag pull requests created by maintainers
sprint5
1.5.0
labels
Sep 9, 2020
but for this it's better to read it in one block vs jumping to extra methods.
…ese in the future.
…avior that was noticed during testing.
… enable debug for these tests.
…er, default to `ETag
and reintroduce caching for the app config download.
d4rken
changed the title
[Draft] Overhaul of DiagnosisKey related Download and Caching Mechanisms (EXPOSUREAPP-2469)
Overhaul of DiagnosisKey related Download and Caching Mechanisms (EXPOSUREAPP-2469)
Sep 10, 2020
While we are still waiting on feedback if it's okay to continue if a few file downloads failed, but others succeed, changing that is a minor code change. There are no more major changes planned for this PR and it is ready to be reviewed. ❤️ |
jakobmoellerdev
suggested changes
Sep 10, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple Style Questions and a few structural points tbd, general Implementation looks good.
...-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RetrieveDiagnosisKeysTransaction.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/download/KeyFileDownloader.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/download/KeyFileDownloader.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/download/KeyFileDownloader.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/download/KeyFileDownloader.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/storage/KeyCacheRepository.kt
Outdated
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/storage/KeyCacheRepository.kt
Show resolved
Hide resolved
...p/src/main/java/de/rki/coronawarnapp/diagnosiskeys/storage/legacy/LegacyKeyCacheMigration.kt
Show resolved
Hide resolved
...p/src/main/java/de/rki/coronawarnapp/diagnosiskeys/storage/legacy/LegacyKeyCacheMigration.kt
Outdated
Show resolved
Hide resolved
* Remove unnecessary `currentDate` we always start with the newest date from the servers index. * Make a specialised class for header validation
Added tests to check that we delete the keycache entry if the download fails (which we didn't for hours :O!)
…the test menu that clears the cache.
chris-cwa
approved these changes
Sep 11, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐️⭐️⭐️⭐️⭐️
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/DiagnosisKeysModule.kt
Show resolved
Hide resolved
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/diagnosiskeys/download/KeyFileDownloader.kt
Outdated
Show resolved
Hide resolved
jakobmoellerdev
approved these changes
Sep 11, 2020
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
d4rken
added a commit
that referenced
this pull request
Sep 18, 2020
* Added first set of country flags Signed-off-by: Kolya Opahle <k.opahle@sap.com> * Added first implementation of Submission Country Selection Screen. (Currently not part of nav graph). Moved stuff inside of submission package into subpackages Signed-off-by: Kolya Opahle <k.opahle@sap.com> * Added missing changes to nav_graph file * Test Menu options for Country selection and Measurement (EXPOSUREAPP-2229) (#1086) * Implement country filter (#2229) * Implement measure for Risk calculation and Key Retrieval (#2229) * Some code cleanup for measureRiskLevelAndKeyRetrieval * Some code cleanup (#2229) * Implement usage of AppConfig usage for country codes (#2229) * change CURRENT_COUNTRY val to var * Suppress "LongMethod" warning (#2229) * Adjust unit tests to respect new country filter * Align with backend for app config country property name * Display total file size of keys in results (#2229) * Fix linting issue * Update strings.xml files * Do refactoring and some code clean up * Move RiskLevel and Key retrieval measurement in own class * Move code in logical classes. Remove translation in test fragment * Fix linting and Unit tests * Remove 3hour boolean check from debug class. * Refactor CountryWrapper and missing dates check. * Fix linting and Unit tests * Add Unit test for getMissingDates * Code cleanup * Hide keyboard on action * Extend statistics for api submission * Set callback to null after invoked Co-authored-by: Mert Safter <mert.safter@sap.com> Co-authored-by: Matthias Urhahn <matthias.urhahn@sap.com> * Overhaul of DiagnosisKey related Download and Caching Mechanisms (EXPOSUREAPP-2469) (#1136) * Rework of keyfile download and caching. * Supports interop * More modular for better testing and build flavour based behavior adjustments * More resilient handling of failed downloads * Preperations for future hourly download and serverside checksums TODO: Finish unit tests, keycache migration and cache health check * First batch of unit tests and some fixes for incorrect behavior that the tests surfaced. * Added unit tests for the KeyCacheRepository TODO: Tests for downloader and migration. * Implemented POC for migration old key files. * Fixed legacy file migration and cleanup, improved logging. * Added unit tests for legacy key file migration. * Add fallback for different file hashes in the header. * Yes kLint, we know it's a long method, but for this it's better to read it in one block vs jumping to extra methods. * More linting issues, adjusting project code style prevent a few of these in the future. * Added missing unit tests for `KeyFileDownloader` and fixed faulty behavior that was noticed during testing. * CRUD (instrumentation) test for `KeyCacheDatabase` * Remove unused `FileStorageHelper` and related constants+tests. * Fix last3Hours unit test in deviceRelease mode, we need to explicitly enable debug for these tests. * Until we have more information about the hashsum's format in the header, default to `ETag * Split app config server API from diagnosis key download API, and reintroduce caching for the app config download. * Add test to check that the cache is used on flaky connections. * Code changes based on PR comment, part #1. * Code fluff, formatting. * Handle download errors correctly. * Refactoring: * Remove unnecessary `currentDate` we always start with the newest date from the servers index. * Make a specialised class for header validation * Let legacy cache migration abort early, depending on whether the key dir exists. * If we can't create the base directory for the key repo, throw an exception. * Delete cache entry if a download fails. * Fixed test regression due to refactoring. * Consolidate staleness check into `getStale` * Consolidate clean up for failed downloads into the download method. Added tests to check that we delete the keycache entry if the download fails (which we didn't for hours :O!) * Because the hour-mode uses caching too, we add an explicit button to the test menu that clears the cache. * Add comment with reference to ticket regarding follow up on the other headers. * Move expected storage size per country into a named constant. Co-authored-by: Matthias Urhahn <matthias.urhahn@sap.com> * Implementation of tests for the interoperability countries selection screen (EXPOSUREAPP-2439) (#1140) * Added initial set of viewModel tests Signed-off-by: Kolya Opahle <k.opahle@sap.com> * Fail tests on unexpected null. Co-authored-by: Matthias Urhahn <matthias.urhahn@sap.com> Co-authored-by: Kolya Opahle <k.opahle@sap.com> Co-authored-by: apopovsap <66370584+apopovsap@users.noreply.github.com> Co-authored-by: Mert Safter <69803294+MertSafter@users.noreply.github.com> Co-authored-by: Mert Safter <mert.safter@sap.com> Co-authored-by: Matthias Urhahn <matthias.urhahn@sap.com> Co-authored-by: Matthias Urhahn <darken@darken.eu>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
enhancement
Improvement of an existing feature
maintainers
Tag pull requests created by maintainers
sprint5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is an overhaul of the existing logic for downloading and caching diagnosis keyfiles.
DownloadAPIV1
and no longer using string constants. If there is a V2 api, we will make a new interface.KeyFileDownloader
is now just responsible for determining the missing days and downloading them, i.e. syncing our cache with the server. The internal "fetch last 3 hours" is no longer "TODO remove" and has been rewritten to potentially support future hour based key file download.TODO:
Complete tests forKeyFileDownloader
ReplaceFileStorageHelper
withDeviceStorage
How to test
Download