Expose metadata about sync status of shapes & records #704
Replies: 3 comments 1 reply
-
That's spot on. We need to provide APIs for developer to handle shapes and transactions, etc. The status of a requested shape: "Has the shape that I requested synched already?". The status of the overall database: "Is data too stale that I don't want to keep diverging from server?". We've been looking into a transaction manager that would move a transaction through multiple states: local, sent(/accepted), acked. I haven't put so much thinking into the state of individual shape state beyond being requested and delivered. All updates come down through a single (causally-ordered) replication stream following commit order on the server -- shapes are as stale as late you are with the replication stream. However, it would be still interesting to know the last time data for a shape was delivered -- I have to think more :). |
Beta Was this translation helpful? Give feedback.
-
Cool! The transaction manager sounds very useful. Lots of apps will probably want a spinner going w/ full sync indication for sensitive stuff. I've also seen apps that list how many transactions still need to sync which is an interesting indicator when you're offline (and fun to see them going down when you get back online). I can probably figure out the data I need for the sync manager in userland — I'll give that a go soonish and report back. |
Beta Was this translation helpful? Give feedback.
-
👋 we've been working the last month on a rebuild of the Electric server over at a temporary repo https://github.com/electric-sql/electric-next/ You can read more about why we made the decision at https://next.electric-sql.com/about We're really excited about all the new possibilities the new server brings and we hope you'll check it out soon and give us your feedback. We're now moving the temporary repo back here. As part of that migration we're closing all the old issues, PRs, and discussions. We really appreciate you taking the time to start this discussion! If it's still relevant in the new system, please reopen. |
Beta Was this translation helpful? Give feedback.
-
I'm sure this is on your roadmap but I haven't seen anything public so I thought I'd throw out my use case / thoughts.
I've been experimenting with how to specify the data that needs synced for specific routes in my app. For most apps I can think of building, I'd want to sync all data but it'd be ideal to only load initially the precise data needed for that route and then lazy load other data in the background.
Also I'd want to be able to distinguish between several states a shape can be in i.e. a shape never been synced, it's been synced in the past but while the app has been closed, is stale by 12 hours, and the shape is fully synced up with the backend. Then in my route loader function I could say either wait until fully synced or if the data isn't that stale, immediately render rather than waiting for the initial sync to finish (this has a big impact on the app loading time).
I could imagine a sync manager lib in userland that works similar to this:
We'd want similar metadata exposed for individual records, especially for tracking individual records e.g. as Bm_Dorian wrote earlier on Discord:
Beta Was this translation helpful? Give feedback.
All reactions