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

Persist tabs. #4862

Merged
merged 1 commit into from
Mar 2, 2022
Merged

Persist tabs. #4862

merged 1 commit into from
Mar 2, 2022

Conversation

mhammond
Copy link
Member

I think this is about ready, but I need to do another self-review - but putting it up for feedback, particularly from @skhamis and @lougeniaC64. Also includes #4859, but I'll rebase once this lands.

@mhammond
Copy link
Member Author

Fixes #3373

@codecov-commenter
Copy link

codecov-commenter commented Feb 25, 2022

Codecov Report

Merging #4862 (07894b2) into main (3089294) will decrease coverage by 1.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4862      +/-   ##
==========================================
- Coverage   39.11%   38.09%   -1.02%     
==========================================
  Files         159      167       +8     
  Lines       12054    12376     +322     
==========================================
  Hits         4715     4715              
- Misses       7339     7661     +322     
Impacted Files Coverage Δ
components/tabs/src/error.rs 0.00% <0.00%> (ø)
components/tabs/src/schema.rs 0.00% <0.00%> (ø)
components/tabs/src/storage.rs 0.00% <0.00%> (ø)
components/tabs/src/sync/engine.rs 0.00% <0.00%> (ø)
components/tabs/src/sync/store.rs 0.00% <0.00%> (ø)
examples/tabs-sync/src/tabs-sync.rs 0.00% <0.00%> (ø)
components/support/sql/src/open_database.rs 0.00% <0.00%> (ø)
components/support/sql/src/maybe_cached.rs 0.00% <0.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3089294...07894b2. Read the comment docs.

// Note that this means a database is only actually needed after Sync fetches remote tabs,
// and because sync users are in the minority, the use of a database here is purely
// optional and created on demand. The implication here is that asking for the "remote tabs"
// when no database exists is considered a normal situation and just implies no remote tabs exist.
Copy link
Contributor

@lougeniaC64 lougeniaC64 Feb 26, 2022

Choose a reason for hiding this comment

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

So get_remote_tabs will retrieve the remote tabs as of the last sync (if any exist) and the consumer should call sync if they want to get the absolute latest remote tabs, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep - which is very similar to how things work now, except that before the first sync we previously returned no tabs whereas now we return what was previously persisted.

Copy link
Contributor

@lougeniaC64 lougeniaC64 left a comment

Choose a reason for hiding this comment

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

Looks good! Reviewing this PR (particularly with the comments you added) made it easier for me to build a conceptual model of how this sync engine works, specifically how it differs from the other components. I actually like the storage schema as it holds only what's needed, would be easy to extend if the task continuity work calls for it, and adheres to architectural patterns we've already established.

|row| -> Result<_> { Ok(serde_json::from_str(&row.get::<_, String>(0)?)?) },
) {
Ok(crts) => {
// only return clients that actually have tabs.
Copy link
Member Author

Choose a reason for hiding this comment

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

Best I can tell, the old code doesn't filter out clients with no open tabs - presumably it relies on the consumer doing this, and there might even be a use-case for knowing the clients exist even if they currently have no tabs? So I'm removing this filtering.

@mhammond mhammond marked this pull request as ready for review February 28, 2022 05:22
@mhammond mhammond requested a review from lougeniaC64 February 28, 2022 05:23
@skhamis
Copy link
Contributor

skhamis commented Feb 28, 2022

👍

Copy link
Contributor

@lougeniaC64 lougeniaC64 left a comment

Choose a reason for hiding this comment

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

👍🏾

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.

4 participants