Skip to content

Commit

Permalink
feat: make criteriaFN public (#942)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos authored Dec 4, 2023
1 parent 16d59f3 commit 13e2d7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions waku/v2/protocol/store/waku_store_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion waku/v2/protocol/store/waku_store_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 13e2d7a

Please sign in to comment.