feat: implement batching for mutate#18
Closed
vwkd wants to merge 1 commit intokitsonk:mainfrom
vwkd:batched-atomic-mutate
Closed
feat: implement batching for mutate#18vwkd wants to merge 1 commit intokitsonk:mainfrom vwkd:batched-atomic-mutate
mutate#18vwkd wants to merge 1 commit intokitsonk:mainfrom
vwkd:batched-atomic-mutate
Conversation
vwkd
commented
May 23, 2025
| case "min": | ||
| this.min(mutation.key, mutation.value.value); | ||
| break; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Should there be a default statement throwing invalid mutations at runtime instead of relying on TypeScript types in this exhaustive switch statement?
Owner
|
Thanks for the PR. I am going to think about it, because it actually may make more sense to "unwrap" the individual methods and call mutate on the underlying store fore everything. |
Owner
|
Again thanks, the implementation was there, it was just putting it into the commit queue, but it was processing it as a single transaction and not batching it up like I thought. So I refactored the whole thing in 4d02534. Thanks for the test case though and I added you as co-author on the ultimate fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This attempts to implement batching for the
mutatemethod of an atomic transaction, which currently despite the docs saying so wasn't implemented yet.This passes the mutation arguments to
mutatethrough to the individual mutation methodsset,delete,sum,max,min, effectively makingmutatea shorthand for chained calls to the individual mutation methods. This avoids having to add more complex batching logic incommitspecifically formutate, sincecommitalready handles batching for the individual mutation methods.Not sure if this is the right approach and if this maintains consistency of the transaction.
Fixes #17.