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

Logging deletion operations #2

Closed
ShishKabab opened this issue Jun 11, 2019 · 5 comments
Closed

Logging deletion operations #2

ShishKabab opened this issue Jun 11, 2019 · 5 comments

Comments

@ShishKabab
Copy link
Member

First, a bit of background info on how the Sync works:

  1. When you set up Storex as the storage layer for your application (with IndexedDB as the backend for example) you set it up with the Custom PK and Sync Log middleware
    1a) The custom PK middleware generates a random ID for each new object instead of an auto-incremented ID to prevent ID conflicts between devices
    1b) The Sync Log middleware intercepts all modifications to the database and also writes them to the Client Sync Log
  2. Once in a while we sync the Client Log with the Shared Log, sending and receiving changes
  3. When new changes are received, we run the Reconciliation Algorithm to determine which changes have to be made to the client database, and execute them

The integration tests from which you can drill down can be found here:
https://github.com/WorldBrain/storex-sync/blob/4c5cce706d0223e9a6be12ad49c82af0c5b37b9e/ts/index.test.ts

This Sync Log middleware that writes all executed operations to a log can be found here:
https://github.com/WorldBrain/storex-sync/blob/4c5cce706d0223e9a6be12ad49c82af0c5b37b9e/ts/logging-middleware/index.test.ts
https://github.com/WorldBrain/storex-sync/blob/4c5cce706d0223e9a6be12ad49c82af0c5b37b9e/ts/logging-middleware/index.ts

What's missing from this middleware, is writing deletions to the log. For this you'll need to write some failing tests in the same way as above, and then write the implementations for that functionality.

Using this repository, you can work on all packages at once easily (which is necessary because there are lots of small Storex packages working together):
https://github.com/WorldBrain/storex-workspace

@ShishKabab ShishKabab changed the title Logging deletion operation Logging deletion operations Jun 11, 2019
@cdharris
Copy link

Looks like a good first contribution ;) I'm investigating taking this issue and just trying to understand the work.

Could you have a look at cdharris@b9f8f5b and let me know if I'm on the right track and whether you think there's anything else that would need to be done that's missing?

Thanks!

@ShishKabab
Copy link
Member Author

Yeah, you're exactly on the right track! Although this test seems to not delete how it says it deletes.
cdharris@b9f8f5b#diff-ee49320e41462aa7c2df8e25279d687fR313

For now, I think those are enough tests. We'll have to think about weird combinations to confuse the system at some later stage ;)

@cdharris
Copy link

Thanks for the reassurance.

Hopefully I've covered most of it in the PR here #3

@blackforestboi
Copy link
Member

Can this be closed? based on #3 ?

If so, again congrats to your first successful PR @cdharris! 🎉

@ShishKabab
Copy link
Member Author

Yup, all good!

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

No branches or pull requests

3 participants