Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

Push only support #1739

Open primus11 opened 10 months ago

primus11 commented 10 months ago

When one works offline it usually makes sense to do both pull and push but on the other hand when one tries to push asap it might not always be desired to do full sync. One might for example want to push asap on web but not on native. Even though WatermelonDB was initially designed with having single endpoint this isn't always the case either because of trying to use existing systems, having no control over systems or because there is need to have multiple endpoints. Previously pushing asap would do full sync and this combined with having multiple endpoints can trigger 10s of connections even when it would be mostly enough to do just one push connection. Because of so many connections even if data is minimal this can cause long execution times. This PR essentially separates push part from synchronize and exposes it to lib-users.

This PR is related to multiple other PRs (#1738, #1552, #1548) which must be merged before. Since I don't know if any of these will be merged I am just pushing this here as is. All of these changes together will be available in our fork.