mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-10 04:51:20 +00:00
simplify cursor2stream
This commit is contained in:
parent
bfca37c869
commit
1fb7e7ae77
@ -1782,14 +1782,14 @@ func (s *cursor2stream) HasNext() bool {
|
|||||||
cmp := bytes.Compare(s.nextK, s.toPrefix)
|
cmp := bytes.Compare(s.nextK, s.toPrefix)
|
||||||
return (s.orderAscend && cmp < 0) || (!s.orderAscend && cmp > 0)
|
return (s.orderAscend && cmp < 0) || (!s.orderAscend && cmp > 0)
|
||||||
}
|
}
|
||||||
func (s *cursor2stream) Next() ([]byte, []byte, error) {
|
func (s *cursor2stream) Next() (k, v []byte, err error) {
|
||||||
select {
|
select {
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
return nil, nil, s.ctx.Err()
|
return nil, nil, s.ctx.Err()
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
s.limit--
|
s.limit--
|
||||||
k, v, err := s.nextK, s.nextV, s.nextErr
|
k, v, err = s.nextK, s.nextV, s.nextErr
|
||||||
if s.orderAscend {
|
if s.orderAscend {
|
||||||
s.nextK, s.nextV, s.nextErr = s.c.Next()
|
s.nextK, s.nextV, s.nextErr = s.c.Next()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user