-
Notifications
You must be signed in to change notification settings - Fork 229
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
Rolling PR for the clients engine #1504
Conversation
@thomcc This is just a start (needs to be wired up to the sync manager, and tests!), but does the design seem sensible to you? |
5533f29
to
a23caeb
Compare
503aa71
to
dac0595
Compare
dac0595
to
1cd5eb4
Compare
OK, I think this is ready for review! 😅 The latest PR splits the implementation in two:
Also a few things to note:
|
Also, this still needs tests! 😂 |
Naively, this sounds kind of risky...are there any circumstances where delaying one of these commands and executing it much later could do weird things to the user's sync data? |
Good question!
This could either be:
For other commands...it depends on the command. But perhaps erring on the side of dropping the command would be the prudent choice. (This also doesn't impact round-tripping commands that we don't understand for other clients...those will still get reuploaded). |
34e25ce
to
ef62758
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great with some nits addressed and rebased again.
1cd5eb4
to
976265f
Compare
(I just rebased, added history wiping, and some tests, but didn't address any of the other feedback yet. I'd also like to add a test for |
The clients engine handles commands for sync engines, like wiping local data and resetting Sync metadata. These are sent in a client record's `commands` list, and acked by removing the command from the list. Our implementation is based on Desktop's, but works a little differently: * Instead of holding commands in memory, ours pulls outgoing commands directly from logins and Places. This follows the approach of bookmark restore on Desktop, which writes a flag into Places to send a `wipeEngine` command on the next sync. * Our engine relies on the embedding app to supply it with info about the current client. Thanks to these two changes, our engine doesn't need to store any state itself. This means it can be used as a short-lived object that's dropped after it syncs, like our other syncable stores, and not a long-lived singleton as on Desktop.
This calls the existing `history::delete_everything`. For symmetry, this commit also renames `bookmarks::erase_everything` to match.
42bf6eb
to
efb239b
Compare
efb239b
to
f87a5ad
Compare
The clients engine is used to send and receive commands for sync
engines, like wiping data and resetting Sync metadata. These are
sent in a client record's
commands
list, and acked by removingthe command from the list. The engine syncs twice: once at the
start of the sync, to apply any incoming commands from other clients,
and once at the end, to upload any outgoing commands added as a result
of the sync.
Our implementation is based on Desktop's, but works a little
differently:
directly from logins and Places. This follows the approach of
bookmark restore on Desktop, which writes a flag into Places to send
a
wipeEngine
command on the next sync.Settings
struct containing info about the current client.
Thanks to these two changes, our engine doesn't need to store any state
itself. This means it can be used as a short-lived object that's dropped
after it syncs, like our other syncable stores, and not a long-lived
singleton as on Desktop.
Closes #1380.
Pull Request checklist
cargo test --all
produces no test failurescargo clippy --all --all-targets --all-features
runs without emitting any warningscargo fmt
does not produce any changes to the code./gradlew ktlint detekt
runs without emitting any warningsswiftformat --swiftversion 4 megazords components/*/ios && swiftlint
runs without emitting any warnings or producing changes[ci full]
to the PR title.