mirror of https://github.com/status-im/go-waku.git
fix(storev3): cursor
This commit is contained in:
parent
349754056d
commit
ad1b0948e3
|
@ -9,8 +9,7 @@ import (
|
||||||
|
|
||||||
// Result represents a valid response from a store node
|
// Result represents a valid response from a store node
|
||||||
type Result struct {
|
type Result struct {
|
||||||
noCursor bool
|
done bool
|
||||||
done bool
|
|
||||||
|
|
||||||
messages []*pb.WakuMessageKeyValue
|
messages []*pb.WakuMessageKeyValue
|
||||||
store *WakuStore
|
store *WakuStore
|
||||||
|
@ -25,7 +24,7 @@ func (r *Result) Cursor() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Result) IsComplete() bool {
|
func (r *Result) IsComplete() bool {
|
||||||
return r.noCursor && r.done
|
return r.done
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Result) PeerID() peer.ID {
|
func (r *Result) PeerID() peer.ID {
|
||||||
|
@ -41,7 +40,7 @@ func (r *Result) Response() *pb.StoreQueryResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Result) Next(ctx context.Context) error {
|
func (r *Result) Next(ctx context.Context) error {
|
||||||
if r.noCursor {
|
if r.cursor == nil {
|
||||||
r.done = true
|
r.done = true
|
||||||
r.messages = nil
|
r.messages = nil
|
||||||
return nil
|
return nil
|
||||||
|
@ -55,10 +54,6 @@ func (r *Result) Next(ctx context.Context) error {
|
||||||
r.cursor = newResult.cursor
|
r.cursor = newResult.cursor
|
||||||
r.messages = newResult.messages
|
r.messages = newResult.messages
|
||||||
|
|
||||||
if r.cursor == nil {
|
|
||||||
r.noCursor = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue