Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-5084 feat: add ability to clear data in feature data storage #1940

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

ganeshnj
Copy link
Contributor

@ganeshnj ganeshnj commented Jul 3, 2024

What and why?

We have clearAllData today which clears the events but doesn't clear the feature data storage that we use for persisting data for feature likes app hangs, watchdog terminations etc.

How?

Introduce new API to clear data in the feature data storage.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests for Session Replay

@ganeshnj ganeshnj requested review from a team as code owners July 3, 2024 14:35
@@ -31,6 +31,7 @@ internal struct CoreDirectory {
/// - Returns: The Feature's directories
func getFeatureDirectories(forFeatureNamed name: String) throws -> FeatureDirectories {
return FeatureDirectories(
root: try coreDirectory.createSubdirectory(path: "\(name)"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question/ The root doesn't seem to be used in production code. Is it necessary?

I only see root being used in tests (to access DS directory), which introduces large inconsistency:

  • the real path to feature DS is created here;
  • and here, the root targets exactly the same path without keeping both in sync.

We may benefit from having dataStorePath defined in FeatureDirectories and used by FeatureDataStore. This will centralize the DS path management and solve the inconsistency. WDYT @ganeshnj ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a high level it makes sense but current getFeatureDirectories API is throws which makes it harder to integrate with existing system.

However, I made some changes and introduced a new API which is similar that returns the path of the data store which can be used to create dir later on. This also aligns perfectly with the approach we took where data store dir is created on demand.

@ganeshnj ganeshnj requested a review from ncreated July 9, 2024 15:41
@ganeshnj ganeshnj force-pushed the ganeshnj/feat/clear-feature-storage-data branch 2 times, most recently from 2885733 to d69be39 Compare July 10, 2024 09:32
ncreated
ncreated previously approved these changes Jul 12, 2024
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯

@ganeshnj ganeshnj merged commit 216873d into develop Jul 15, 2024
16 checks passed
@ganeshnj ganeshnj deleted the ganeshnj/feat/clear-feature-storage-data branch July 15, 2024 09:46
@ncreated ncreated mentioned this pull request Jul 25, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants