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

Fix #3325: Add domain layer mechanism to save checkpoints. #3403

Closed
wants to merge 11 commits into from

Conversation

MaskedCarrot
Copy link
Contributor

@MaskedCarrot MaskedCarrot commented Jul 3, 2021

Explanation

Fixes part of #3325

This PR is stacked on top of PR #3400

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

val ephemeralState = result.getOrThrow()
// only mark checkpoint if the current state is either of type PENDING_STATE or TERMINAL_STATE.
if (ephemeralState.stateTypeCase != EphemeralState.StateTypeCase.COMPLETED_STATE)
markExplorationCheckpoint()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function kicks off the saving process in the UI layer. The reason behind this function being in the UI layer is that if we move it to the domain layer, we will be able to start the saving process but we will not be able to return the dataProvider to the UI layer to observe the saving process.

To move this function to the domain layer, I have tried creating a new dataProvider in ExplorationProgressController and using functions combineWith and .transform on it so that I can return the save operation's dataProvider to the UI layer. (The main problem here is we that have to check that the exploration is not in Loading_STATE before we can create a checkpoint` )

But so far nothing seems to work.

One more problem with saving in the UI layer is that we will be re-saving the same checkpoint if the user goes to some previous state and then comes back to the pending state. This is because we are saving every time the exploration goes into VIEWING_STATE and the current state is not a COMPLETED_STATE.

Do you have any suggestions to solve this problem?

Copy link
Contributor Author

@MaskedCarrot MaskedCarrot Jul 5, 2021

Choose a reason for hiding this comment

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

Created a new PR with an alternate approach to save checkpoints without using ap layer using background dispatchers

link to the PR with the new approach.

Copy link
Sponsor Member

@BenHenning BenHenning Jul 6, 2021

Choose a reason for hiding this comment

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

Replying to #3408 since I think that approach will be easier to bring to a working state.

Copy link
Contributor Author

@MaskedCarrot MaskedCarrot left a comment

Choose a reason for hiding this comment

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

@aggarwalpulkit596 @BenHenning PTAL at the comment above.

@MaskedCarrot
Copy link
Contributor Author

Unassigning Rajat and Vinita because there is a new PR with a different approach which may be better than the current approach.

@BenHenning BenHenning removed their assignment Jul 6, 2021
@MaskedCarrot
Copy link
Contributor Author

Closing this PR because the alternate approach is better than the approach used in this PR.

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.

None yet

5 participants