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

use preference datastore to monitor syncJobStatus. #2142

Merged
merged 71 commits into from
Jan 2, 2024

Conversation

santosh-pingle
Copy link
Collaborator

@santosh-pingle santosh-pingle commented Aug 23, 2023

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2119

Description
Utilize the preference datastore to store SyncJobStatus. SyncJobStatus is serialized and subsequently updated within the preference datastore. The unique workname of the worker serves as the key for editing and reading the serialized data from the preference datastore.
Merge work state with SyncJobStatus.

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@santosh-pingle
Copy link
Collaborator Author

Screen.Recording.2023-08-23.at.2.10.12.PM.mov

@santosh-pingle santosh-pingle marked this pull request as ready for review August 28, 2023 10:30
@santosh-pingle santosh-pingle requested a review from a team as a code owner August 28, 2023 10:30
@santosh-pingle
Copy link
Collaborator Author

combine workstate and syncjobstatus

Screen.Recording.2023-08-29.at.4.59.56.PM.mov

@MJ1998
Copy link
Collaborator

MJ1998 commented Sep 15, 2023

Perhaps add #2046 getting resolved by this too ?

@santosh-pingle
Copy link
Collaborator Author

Resolving conflicts.

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

@santosh-pingle santosh-pingle enabled auto-merge (squash) January 2, 2024 13:02
@santosh-pingle santosh-pingle dismissed MJ1998’s stale review January 2, 2024 13:04

Owner has already approved the pr, hence dismissing it.

@santosh-pingle santosh-pingle merged commit 2df5e02 into google:master Jan 2, 2024
3 checks passed
hugomilosz pushed a commit to hugomilosz/android-fhir that referenced this pull request Jan 17, 2024
* Update syncJobStatus to preference datastore.

* add fhirdatastore file.

* code cleanup.

* unit tests

* unit test.

* Cancel ongoing coroutine job before launching new oneTimeSync in demo app.

* Fix android test, pass context instead of datastore in fhir engine configuration.

* fix tests.

* update kotlin doc.

* combine work state with syncjobstatus

* Address review comments.

* Address review comments.

* Update OneTimeSyncState and PeriodicSyncState.

* missing file.

* Stores sync job terminal state in the datastore.

* Address review comments.

* Address review comments.

* Address review comments.

* Address review comments.

* code clean up.

* Code clean up.

* Fix test.

* Fix test

* Fix tests.

* Address review comments.

* Address review comments.

* Remove DataStoreUtil.

* Address review comments.

* fix crash.

* refactoring names

* spotless apply

* private access specifier

* Address review comments.

* Address review comment.

* address review comments.

* fix tests.

* review comment.

* Removing existing unwanted call.

* Address review comments.

* Add test to assert succedded sync state.

* failed state was nit emitted.

* Update api doc.

* Address review comments.

* Review address comments.

* Address review comments.

* Address review comment.

* Address review comments.

* Address review comment.

* Address review comments.

* remove unwanted file.

---------

Co-authored-by: Santosh Pingle <spingle@google.com>
sharon2719 pushed a commit to opensrp/android-fhir that referenced this pull request Feb 6, 2024
* Update syncJobStatus to preference datastore.

* add fhirdatastore file.

* code cleanup.

* unit tests

* unit test.

* Cancel ongoing coroutine job before launching new oneTimeSync in demo app.

* Fix android test, pass context instead of datastore in fhir engine configuration.

* fix tests.

* update kotlin doc.

* combine work state with syncjobstatus

* Address review comments.

* Address review comments.

* Update OneTimeSyncState and PeriodicSyncState.

* missing file.

* Stores sync job terminal state in the datastore.

* Address review comments.

* Address review comments.

* Address review comments.

* Address review comments.

* code clean up.

* Code clean up.

* Fix test.

* Fix test

* Fix tests.

* Address review comments.

* Address review comments.

* Remove DataStoreUtil.

* Address review comments.

* fix crash.

* refactoring names

* spotless apply

* private access specifier

* Address review comments.

* Address review comment.

* address review comments.

* fix tests.

* review comment.

* Removing existing unwanted call.

* Address review comments.

* Add test to assert succedded sync state.

* failed state was nit emitted.

* Update api doc.

* Address review comments.

* Review address comments.

* Address review comments.

* Address review comment.

* Address review comments.

* Address review comment.

* Address review comments.

* remove unwanted file.

---------

Co-authored-by: Santosh Pingle <spingle@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Store sync progress in a local storage in the engine.
6 participants