-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: make batcher configurable #815
Conversation
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! |
I like @julienrbrt 's idea, we should make sure to set the default options even if users miss the config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
testing failed ? |
@Mergifyio backport release/v1.x.x |
✅ Backports have been created
|
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
follow up to #807