RUMM-2204: Data is written in the SDK specific location#975
Merged
0xnm merged 4 commits intoJul 11, 2022
Merged
Conversation
…K v2 file format is not compatible anyway
mariusc83
requested changes
Jul 7, 2022
| package com.datadog.android.core.internal | ||
|
|
||
| import android.content.Context | ||
| import androidx.annotation.WorkerThread |
Member
There was a problem hiding this comment.
I think these 2 first commits are from another PR ? Maybe you need a rebase ?
Member
Author
There was a problem hiding this comment.
The first commit is indeed from #973, I cherry-picked it explicitly, because it is on the develop branch.
0xnm
deleted the
nogorodnikov/rumm-2204/data-is-written-in-sdk-specific-location
branch
July 11, 2022 15:35
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
This change brings support of dedicated storage folders for multiple SDK instances. Now each
SdkCoreinstance will get a unique ID, which issha256(token+site), and this ID will be used to create a root folder where this particular instance is going to store features data. Now, the folder structure will be like the following:In the example above we have 2 instances of
SdkCorerunning with IDsb0f6d4ccffaaanda4b6c1d4eebb.CoreFeaturenow ownsstorageDirwhich will be the root for all the storage of the particular SDK instance. By referencing it from the persistence layer it is possible to removeContextreferences from many places.SDK is still going to store files in the cache folder, in that sense nothing changed.
This change also cherry-picks f1890e1 to remove unused endpoints (in order to avoid adding unnecessary code) and removes file location migration (from files dir to cache dir), because anyway new file format for batches is not compatible with old SDK.
Similar to DataDog/dd-sdk-ios#906.
NB: If SHA-256 doesn't exist on the device there is no fallback, we don't proceed with SDK initialization. I think this is fine, because "this should never happen" (c) (unlikely that some OEMs is going to strip out such basic things from the OS build).
Review checklist (to be filled by reviewers)