fix(storev3): cursor

This commit is contained in:
Richard Ramos 2024-06-05 11:42:27 -04:00
parent 349754056d
commit ad1b0948e3
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
1 changed files with 3 additions and 8 deletions

View File

@ -9,8 +9,7 @@ import (
// Result represents a valid response from a store node
type Result struct {
noCursor bool
done bool
done bool
messages []*pb.WakuMessageKeyValue
store *WakuStore
@ -25,7 +24,7 @@ func (r *Result) Cursor() []byte {
}
func (r *Result) IsComplete() bool {
return r.noCursor && r.done
return r.done
}
func (r *Result) PeerID() peer.ID {
@ -41,7 +40,7 @@ func (r *Result) Response() *pb.StoreQueryResponse {
}
func (r *Result) Next(ctx context.Context) error {
if r.noCursor {
if r.cursor == nil {
r.done = true
r.messages = nil
return nil
@ -55,10 +54,6 @@ func (r *Result) Next(ctx context.Context) error {
r.cursor = newResult.cursor
r.messages = newResult.messages
if r.cursor == nil {
r.noCursor = true
}
return nil
}