R4R: Swap start/end in ReverseIterator#2913
Merged
Conversation
Contributor
|
Codecov Report
@@ Coverage Diff @@
## develop #2913 +/- ##
===========================================
- Coverage 62.15% 62.08% -0.08%
===========================================
Files 212 212
Lines 17369 17255 -114
===========================================
- Hits 10796 10712 -84
+ Misses 5663 5639 -24
+ Partials 910 904 -6
|
ebuchman
approved these changes
Nov 28, 2018
| var key = itr.source.Key() | ||
| if itr.isReverse { | ||
| if end != nil && bytes.Compare(key, end) <= 0 { | ||
| if start != nil && bytes.Compare(key, start) < 0 { |
Contributor
There was a problem hiding this comment.
don't think we need the start != nil check here anymore, but doesn't hurt
| } | ||
| itr.source.Next() | ||
| if !itr.source.Valid() || !bytes.HasPrefix(itr.source.Key(), itr.prefix) { | ||
| itr.source.Close() |
Contributor
There was a problem hiding this comment.
Was there some reason for this to be here in the first place ?
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 makes dbm.DB.ReverseIterator have the same API as the cosmos sdk's store.Store.ReverseIterator (they share the same interface, as that was the intent).
It turns out that the CosmosSDK's store.Store.ReverseIterator API as currently implemented is both different and better than what we have now in tendermint/libs/db.
With this PR, the CosmosSDK can use the tendermint/libs/db.DB as a store.Store using the db adapter in the SDK, which is needed for faster simulation (as a non-production drop-in replacement for the IAVL store in cosmos-sdk/store.IAVLStore).
See also: