[raft/store] Update Transact signature#1577
Open
MariemBaccari wants to merge 1 commit into
Open
Conversation
adc2bed to
558c48b
Compare
5dcae06 to
373d538
Compare
This was referenced Jun 30, 2026
373d538 to
1c46a39
Compare
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.
Transactcurrently takes a rawfunc(ctx, R) errorclosure which works for thesqlstorebut can't be replicated by the Raftstore since it needs a request type, payload and an independently accessible function to execute on the apply side.This PR changes the interface to accept a
store.Action[R]instead in preparation for the raftstore implementation.The interface function
Executeshould contain the current action (business logic) defined in the handlers.To keep changes minimal in this PR, the
FuncAction[R]adapter wraps the existing closures as a stubAction.Follow-up PRs will remove
FuncAction[R]and extract the actions for all handlers.The PR also adds
TransactWithResult[R, Res], a generic function wrappingTransactwhich serves as a helper for result type asserts to avoid code duplication on the handler side. The reason why we need a wrapper instead of makingTransactgeneric is that Go does not currently allow generic methods.