You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alternative title: "OMG What is Dusty Abusing Now?"
I have a situation where I want to change two tables via the REST API and I want those changes to fail or succeed atomically.
Context: I currently store the total number of words in a scene for each day that the user edits the scene. This allows me to calculate "how much have I written each day" queries. This table is getting kind of obnoxious, even on a per-user basis, since there are m*n entries. My plan is to aggregate these into a "how many words were added in total on this day" table and delete historical entries as they age out. I obviously don't want the deletions of aggregated items to be committed until the aggregated object is saved or vice versa.
Some brainstorming:
dexie-cloud gets some kind of startTransaction and commit REST endpoints and if you call any queries in between you need to pass the transaction id with it. (No idea how well that would cooperate with the existing server implementation)
dexie-cloud has a single "transaction" endpoint that you can pass multiple JSON bodies into. Possibly the undocumented /import endpoint already does this? (Oh please let this be a already-solved problem 🙏🏻)
Some kind of server-side indexedDB (e.g fakeIndexedDB) could immitate each user and use the client API to do syncs correctly with all dexie-cloud's existing CRDT goodness.
hijack the undocumented /sync endpoint to send the same kind of data that the browser sends (there is no way this ends well)
The second option seems like the most promising. I tried the import endpoint with some semi-valid data and it does seem to reject everything if it can't import one thing. But when creating items, it doesn't auto-generate ids.
The text was updated successfully, but these errors were encountered:
That would be awesome. I've got something working with /import now, but that's not in a db transaction? At least import I can be sure the entire HTTP bundle made it to dexie cloud before it starts making changes, which even if it is not guaranteed, is safer than two separate requests that could fail basically any time a random router decides it is due a vacation.
alternative title: "OMG What is Dusty Abusing Now?"
I have a situation where I want to change two tables via the REST API and I want those changes to fail or succeed atomically.
Context: I currently store the total number of words in a scene for each day that the user edits the scene. This allows me to calculate "how much have I written each day" queries. This table is getting kind of obnoxious, even on a per-user basis, since there are m*n entries. My plan is to aggregate these into a "how many words were added in total on this day" table and delete historical entries as they age out. I obviously don't want the deletions of aggregated items to be committed until the aggregated object is saved or vice versa.
Some brainstorming:
The second option seems like the most promising. I tried the import endpoint with some semi-valid data and it does seem to reject everything if it can't import one thing. But when creating items, it doesn't auto-generate ids.
The text was updated successfully, but these errors were encountered: