feat: make criteriaFN public (#942)

This commit is contained in:
richΛrd 2023-12-04 16:23:04 -04:00 committed by GitHub
parent 16d59f37d0
commit 13e2d7ac4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -80,7 +80,7 @@ func (r *Result) GetMessages() []*wpb.WakuMessage {
return r.Messages
}
type criteriaFN = func(msg *wpb.WakuMessage) (bool, error)
type CriteriaFN = func(msg *wpb.WakuMessage) (bool, error)
type HistoryRequestParameters struct {
selectedPeer peer.ID
@ -399,7 +399,7 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR
}
// Find the first message that matches a criteria. criteriaCB is a function that will be invoked for each message and returns true if the message matches the criteria
func (store *WakuStore) Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) {
func (store *WakuStore) Find(ctx context.Context, query Query, cb CriteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error) {
if cb == nil {
return nil, errors.New("callback can't be null")
}

View File

@ -84,7 +84,7 @@ type Store interface {
SetHost(h host.Host)
Start(context.Context, *relay.Subscription) error
Query(ctx context.Context, query Query, opts ...HistoryRequestOption) (*Result, error)
Find(ctx context.Context, query Query, cb criteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error)
Find(ctx context.Context, query Query, cb CriteriaFN, opts ...HistoryRequestOption) (*wpb.WakuMessage, error)
Next(ctx context.Context, r *Result) (*Result, error)
Resume(ctx context.Context, pubsubTopic string, peerList []peer.ID) (int, error)
Stop()