refactor: make batcher configurable#815
Merged
julienrbrt merged 5 commits intomasterfrom Aug 11, 2023
Merged
Conversation
Contributor
|
The issue I have with simply adding an option and still taking the whole struct, is that you may overwrite a good default option that you haven't provided. Example here: https://github.com/cosmos/cosmos-sdk/blob/66d9be0e1080ab6c7e013fc83bfed18ddd1b3c14/store/iavl/store.go#L54 We could simplify the api by adding a variadic way to update the options. Bonus is that NewMutableTreeWithOpts can still be used to provide all options, so there is no API break (or we clean it up and remove it). type Option func(*Options)
NewMutableTree(db dbm.DB, cacheSize int, skipFastStorageUpgrade bool, lg log.Logger, options ...Option) *MutableTree {
opts := DefaultOptions()
for _, opt := range options {
opt(&opts)
}
return NewMutableTreeWithOpts(...)
}Unless we are ok with that risk, and then it lgtm! |
Contributor
|
I like @julienrbrt 's idea, we should make sure to set the default options even if users miss the config |
cool-develope
approved these changes
Aug 11, 2023
Contributor
|
testing failed ? |
Contributor
|
@Mergifyio backport release/v1.x.x |
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Aug 11, 2023
Co-authored-by: Marko Baricevic <marbar3778@yahoo.com> Co-authored-by: Cool Developer <cool199966@outlook.com> Co-authored-by: Julien Robert <julien@rbrt.fr> (cherry picked from commit 0420895) # Conflicts: # CHANGELOG.md
julienrbrt
pushed a commit
that referenced
this pull request
Aug 11, 2023
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.
follow up to #807