-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: replace the cosmos-db.DB
interface with core/store
interface
#21450
Changes from 6 commits
4950027
d72613c
9f1b36b
af1ac2b
9d5dff6
0b3411f
efb7866
2388c23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ require ( | |
github.com/cometbft/cometbft v1.0.0-rc1 | ||
github.com/cometbft/cometbft/api v1.0.0-rc.1 | ||
github.com/cosmos/btcutil v1.0.5 | ||
github.com/cosmos/cosmos-db v1.0.2 | ||
github.com/cosmos/cosmos-db v1.0.3-0.20240829004618-717cba019b33 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the update to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is needed temporarily since it only updates the interface , there were some conflicts in test. |
||
github.com/cosmos/cosmos-proto v1.0.0-beta.5 | ||
github.com/cosmos/crypto v0.1.2 | ||
github.com/cosmos/go-bip39 v1.0.0 | ||
|
@@ -183,6 +183,8 @@ require ( | |
// <temporary replace> | ||
// ) | ||
// TODO remove after all modules have their own go.mods | ||
replace github.com/cosmos/iavl => github.com/cosmos/iavl v1.0.0-beta.1.0.20240813194616-eb5078efcf9e | ||
|
||
replace ( | ||
cosmossdk.io/api => ./api | ||
cosmossdk.io/collections => ./collections | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ import ( | |
"context" | ||
"io" | ||
|
||
dbm "github.com/cosmos/cosmos-db" | ||
|
||
"cosmossdk.io/core/store" | ||
storetypes "cosmossdk.io/store/types" | ||
|
||
|
@@ -162,15 +160,15 @@ func (s kvStoreAdapter) Set(key, value []byte) { | |
} | ||
} | ||
|
||
func (s kvStoreAdapter) Iterator(start, end []byte) dbm.Iterator { | ||
func (s kvStoreAdapter) Iterator(start, end []byte) store.Iterator { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve error handling in the Iterator method. The method currently uses Propose a refactor to improve error handling: -func (s kvStoreAdapter) Iterator(start, end []byte) store.Iterator {
- it, err := s.store.Iterator(start, end)
- if err != nil {
- panic(err)
- }
- return it
+func (s kvStoreAdapter) Iterator(start, end []byte) (store.Iterator, error) {
+ return s.store.Iterator(start, end)
}
|
||
it, err := s.store.Iterator(start, end) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return it | ||
} | ||
|
||
func (s kvStoreAdapter) ReverseIterator(start, end []byte) dbm.Iterator { | ||
func (s kvStoreAdapter) ReverseIterator(start, end []byte) store.Iterator { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve error handling in the ReverseIterator method. Similar to the Propose a refactor to improve error handling: -func (s kvStoreAdapter) ReverseIterator(start, end []byte) store.Iterator {
- it, err := s.store.ReverseIterator(start, end)
- if err != nil {
- panic(err)
- }
- return it
+func (s kvStoreAdapter) ReverseIterator(start, end []byte) (store.Iterator, error) {
+ return s.store.ReverseIterator(start, end)
}
|
||
it, err := s.store.ReverseIterator(start, end) | ||
if err != nil { | ||
panic(err) | ||
|
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.
does baseapp use the
BatchCreator
interface?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.
RootStore requires it