Documentation ¶
Index ¶
- Constants
- Variables
- type FilterError
- type FilterParameters
- type FilterPingOption
- type FilterPingParameters
- type FilterSubscribeOption
- func DefaultSubscriptionOptions() []FilterSubscribeOption
- func DefaultUnsubscribeOptions() []FilterSubscribeOption
- func DontWait() FilterSubscribeOption
- func UnsubscribeAll() FilterSubscribeOption
- func WithAutomaticPeerSelection(fromThesePeers ...peer.ID) FilterSubscribeOption
- func WithAutomaticRequestID() FilterSubscribeOption
- func WithFastestPeerSelection(fromThesePeers ...peer.ID) FilterSubscribeOption
- func WithPeer(p peer.ID) FilterSubscribeOption
- func WithRequestID(requestID []byte) FilterSubscribeOption
- func WithWaitGroup(wg *sync.WaitGroup) FilterSubscribeOption
- type FilterSubscribeParameters
- type Metrics
- type Option
- type PeerSet
- type PubsubTopics
- type SubscribersMap
- func (sub *SubscribersMap) Clear()
- func (sub *SubscribersMap) Count() int
- func (sub *SubscribersMap) Delete(peerID peer.ID, pubsubTopic string, contentTopics []string) error
- func (sub *SubscribersMap) DeleteAll(peerID peer.ID) error
- func (sub *SubscribersMap) FlagAsFailure(peerID peer.ID)
- func (sub *SubscribersMap) FlagAsSuccess(peerID peer.ID)
- func (sub *SubscribersMap) Get(peerID peer.ID) (PubsubTopics, bool)
- func (sub *SubscribersMap) Has(peerID peer.ID) bool
- func (sub *SubscribersMap) IsFailedPeer(peerID peer.ID) bool
- func (sub *SubscribersMap) Items(pubsubTopic string, contentTopic string) <-chan peer.ID
- func (sub *SubscribersMap) RemoveAll()
- func (sub *SubscribersMap) Set(peerID peer.ID, pubsubTopic string, contentTopics []string)
- type WakuFilterFullNode
- type WakuFilterLightNode
- func (wf *WakuFilterLightNode) FilterSubscription(peerID peer.ID, contentFilter protocol.ContentFilter) (*subscription.SubscriptionDetails, error)
- func (wf *WakuFilterLightNode) IsListening(pubsubTopic, contentTopic string) bool
- func (wf *WakuFilterLightNode) IsSubscriptionAlive(ctx context.Context, subscription *subscription.SubscriptionDetails) error
- func (wf *WakuFilterLightNode) Ping(ctx context.Context, peerID peer.ID, opts ...FilterPingOption) error
- func (wf *WakuFilterLightNode) SetHost(h host.Host)
- func (wf *WakuFilterLightNode) Start(ctx context.Context) error
- func (wf *WakuFilterLightNode) Stop()
- func (wf *WakuFilterLightNode) Subscribe(ctx context.Context, contentFilter protocol.ContentFilter, ...) ([]*subscription.SubscriptionDetails, error)
- func (wf *WakuFilterLightNode) Subscriptions() []*subscription.SubscriptionDetails
- func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter protocol.ContentFilter, ...) (*WakuFilterPushResult, error)
- func (wf *WakuFilterLightNode) UnsubscribeAll(ctx context.Context, opts ...FilterSubscribeOption) (*WakuFilterPushResult, error)
- func (wf *WakuFilterLightNode) UnsubscribeWithSubscription(ctx context.Context, sub *subscription.SubscriptionDetails, ...) (*WakuFilterPushResult, error)
- type WakuFilterPushError
- type WakuFilterPushResult
Constants ¶
const DefaultMaxSubscriptions = 1000
const FilterPushID_v20beta1 = libp2pProtocol.ID("/vac/waku/filter-push/2.0.0-beta1")
FilterPushID_v20beta1 is the current Waku Filter protocol identifier used to allow filter service nodes to push messages matching registered subscriptions to this client.
const FilterSubscribeENRField = uint8(1 << 2)
const FilterSubscribeID_v20beta1 = libp2pProtocol.ID("/vac/waku/filter-subscribe/2.0.0-beta1")
FilterSubscribeID_v20beta1 is the current Waku Filter protocol identifier for servers to allow filter clients to subscribe, modify, refresh and unsubscribe a desired set of filter criteria
const MaxContentTopicsPerRequest = 30
const MaxCriteriaPerSubscription = 1000
const MessagePushTimeout = 20 * time.Second
Variables ¶
var (
ErrNoPeersAvailable = errors.New("no suitable remote peers")
)
Functions ¶
This section is empty.
Types ¶
type FilterError ¶ added in v0.6.0
func NewFilterError ¶ added in v0.6.0
func NewFilterError(code int, message string) FilterError
func (*FilterError) Error ¶ added in v0.6.0
func (e *FilterError) Error() string
type FilterParameters ¶
type FilterPingOption ¶ added in v0.9.0
type FilterPingOption func(*FilterPingParameters)
func WithPingRequestId ¶ added in v0.9.0
func WithPingRequestId(requestId []byte) FilterPingOption
type FilterPingParameters ¶ added in v0.9.0
type FilterPingParameters struct {
// contains filtered or unexported fields
}
type FilterSubscribeOption ¶
type FilterSubscribeOption func(*FilterSubscribeParameters) error
func DefaultSubscriptionOptions ¶ added in v0.6.0
func DefaultSubscriptionOptions() []FilterSubscribeOption
func DefaultUnsubscribeOptions ¶ added in v0.6.0
func DefaultUnsubscribeOptions() []FilterSubscribeOption
func DontWait ¶ added in v0.8.0
func DontWait() FilterSubscribeOption
DontWait is used to fire and forget an unsubscription, and don't care about the results of it
func UnsubscribeAll ¶ added in v0.6.0
func UnsubscribeAll() FilterSubscribeOption
func WithAutomaticPeerSelection ¶
func WithAutomaticPeerSelection(fromThesePeers ...peer.ID) FilterSubscribeOption
WithAutomaticPeerSelection is an option used to randomly select a peer from the peer store. If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore
func WithAutomaticRequestID ¶ added in v0.8.0
func WithAutomaticRequestID() FilterSubscribeOption
WithAutomaticRequestID is an option to automatically generate a request ID when creating a filter subscription
func WithFastestPeerSelection ¶
func WithFastestPeerSelection(fromThesePeers ...peer.ID) FilterSubscribeOption
WithFastestPeerSelection is an option used to select a peer from the peer store with the lowest ping If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore
func WithPeer ¶
func WithPeer(p peer.ID) FilterSubscribeOption
func WithRequestID ¶ added in v0.8.0
func WithRequestID(requestID []byte) FilterSubscribeOption
WithRequestID is an option to set a specific request ID to be used when creating/removing a filter subscription
func WithWaitGroup ¶ added in v0.8.0
func WithWaitGroup(wg *sync.WaitGroup) FilterSubscribeOption
WithWaitGroup allows specifying a waitgroup to wait until all unsubscribe requests are complete before the function is complete
type FilterSubscribeParameters ¶
type FilterSubscribeParameters struct {
// contains filtered or unexported fields
}
func (*FilterSubscribeParameters) Copy ¶ added in v0.9.0
func (old *FilterSubscribeParameters) Copy() *FilterSubscribeParameters
type Metrics ¶ added in v0.8.0
type Metrics interface { RecordMessage() RecordRequest(requestType string, duration time.Duration) RecordPushDuration(duration time.Duration) RecordSubscriptions(num int) RecordError(err metricsErrCategory) }
Metrics exposes the functions required to update prometheus metrics for filter protocol
type Option ¶
type Option func(*FilterParameters)
func DefaultOptions ¶
func DefaultOptions() []Option
func WithMaxSubscribers ¶ added in v0.6.0
func WithPeerManager ¶ added in v0.9.0
func WithPeerManager(pm *peermanager.PeerManager) Option
func WithTimeout ¶
type PubsubTopics ¶ added in v0.6.0
type PubsubTopics map[string]protocol.ContentTopicSet // pubsubTopic => contentTopics
type SubscribersMap ¶ added in v0.6.0
func NewSubscribersMap ¶ added in v0.6.0
func NewSubscribersMap(timeout time.Duration) *SubscribersMap
func (*SubscribersMap) Clear ¶ added in v0.6.0
func (sub *SubscribersMap) Clear()
func (*SubscribersMap) Count ¶ added in v0.6.0
func (sub *SubscribersMap) Count() int
func (*SubscribersMap) DeleteAll ¶ added in v0.6.0
func (sub *SubscribersMap) DeleteAll(peerID peer.ID) error
func (*SubscribersMap) FlagAsFailure ¶ added in v0.6.0
func (sub *SubscribersMap) FlagAsFailure(peerID peer.ID)
func (*SubscribersMap) FlagAsSuccess ¶ added in v0.6.0
func (sub *SubscribersMap) FlagAsSuccess(peerID peer.ID)
func (*SubscribersMap) Get ¶ added in v0.6.0
func (sub *SubscribersMap) Get(peerID peer.ID) (PubsubTopics, bool)
func (*SubscribersMap) IsFailedPeer ¶ added in v0.6.0
func (sub *SubscribersMap) IsFailedPeer(peerID peer.ID) bool
func (*SubscribersMap) Items ¶ added in v0.6.0
func (sub *SubscribersMap) Items(pubsubTopic string, contentTopic string) <-chan peer.ID
func (*SubscribersMap) RemoveAll ¶ added in v0.6.0
func (sub *SubscribersMap) RemoveAll()
type WakuFilterFullNode ¶ added in v0.6.0
type WakuFilterFullNode struct { *service.CommonService // contains filtered or unexported fields }
func NewWakuFilterFullNode ¶ added in v0.8.0
func NewWakuFilterFullNode(timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger, opts ...Option) *WakuFilterFullNode
NewWakuFilterFullNode returns a new instance of Waku Filter struct setup according to the chosen parameter and options
func (*WakuFilterFullNode) SetHost ¶ added in v0.6.0
func (wf *WakuFilterFullNode) SetHost(h host.Host)
Sets the host to be able to mount or consume a protocol
func (*WakuFilterFullNode) Start ¶ added in v0.6.0
func (wf *WakuFilterFullNode) Start(ctx context.Context, sub *relay.Subscription) error
func (*WakuFilterFullNode) Stop ¶ added in v0.6.0
func (wf *WakuFilterFullNode) Stop()
Stop unmounts the filter protocol
type WakuFilterLightNode ¶ added in v0.8.0
type WakuFilterLightNode struct { *service.CommonService // contains filtered or unexported fields }
func NewWakuFilterLightNode ¶ added in v0.8.0
func NewWakuFilterLightNode(broadcaster relay.Broadcaster, pm *peermanager.PeerManager, timesource timesource.Timesource, reg prometheus.Registerer, log *zap.Logger) *WakuFilterLightNode
NewWakuFilterLightnode returns a new instance of Waku Filter struct setup according to the chosen parameter and options Note that broadcaster is optional. Takes an optional peermanager if WakuFilterLightnode is being created along with WakuNode. If using libp2p host, then pass peermanager as nil
func (*WakuFilterLightNode) FilterSubscription ¶ added in v0.8.0
func (wf *WakuFilterLightNode) FilterSubscription(peerID peer.ID, contentFilter protocol.ContentFilter) (*subscription.SubscriptionDetails, error)
FilterSubscription is used to obtain an object from which you could receive messages received via filter protocol
func (*WakuFilterLightNode) IsListening ¶ added in v0.9.0
func (wf *WakuFilterLightNode) IsListening(pubsubTopic, contentTopic string) bool
func (*WakuFilterLightNode) IsSubscriptionAlive ¶ added in v0.8.0
func (wf *WakuFilterLightNode) IsSubscriptionAlive(ctx context.Context, subscription *subscription.SubscriptionDetails) error
func (*WakuFilterLightNode) Ping ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Ping(ctx context.Context, peerID peer.ID, opts ...FilterPingOption) error
func (*WakuFilterLightNode) SetHost ¶ added in v0.8.0
func (wf *WakuFilterLightNode) SetHost(h host.Host)
Sets the host to be able to mount or consume a protocol
func (*WakuFilterLightNode) Start ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Start(ctx context.Context) error
func (*WakuFilterLightNode) Stop ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Stop()
Stop unmounts the filter protocol
func (*WakuFilterLightNode) Subscribe ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Subscribe(ctx context.Context, contentFilter protocol.ContentFilter, opts ...FilterSubscribeOption) ([]*subscription.SubscriptionDetails, error)
Subscribe setups a subscription to receive messages that match a specific content filter If contentTopics passed result in different pubSub topics (due to Auto/Static sharding), then multiple subscription requests are sent to the peer. This may change if Filterv2 protocol is updated to handle such a scenario in a single request. Note: In case of partial failure, results are returned for successful subscriptions along with error indicating failed contentTopics.
func (*WakuFilterLightNode) Subscriptions ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Subscriptions() []*subscription.SubscriptionDetails
func (*WakuFilterLightNode) Unsubscribe ¶ added in v0.8.0
func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter protocol.ContentFilter, opts ...FilterSubscribeOption) (*WakuFilterPushResult, error)
Unsubscribe is used to stop receiving messages from a peer that match a content filter
func (*WakuFilterLightNode) UnsubscribeAll ¶ added in v0.8.0
func (wf *WakuFilterLightNode) UnsubscribeAll(ctx context.Context, opts ...FilterSubscribeOption) (*WakuFilterPushResult, error)
UnsubscribeAll is used to stop receiving messages from peer(s). It does not close subscriptions
func (*WakuFilterLightNode) UnsubscribeWithSubscription ¶ added in v0.8.0
func (wf *WakuFilterLightNode) UnsubscribeWithSubscription(ctx context.Context, sub *subscription.SubscriptionDetails, opts ...FilterSubscribeOption) (*WakuFilterPushResult, error)
UnsubscribeWithSubscription is used to close a particular subscription If there are no more subscriptions matching the passed [peer, contentFilter] pair, server unsubscribe is also performed
type WakuFilterPushError ¶ added in v0.9.0
type WakuFilterPushResult ¶ added in v0.6.0
func (*WakuFilterPushResult) Add ¶ added in v0.9.0
func (arr *WakuFilterPushResult) Add(err WakuFilterPushError)
func (*WakuFilterPushResult) Errors ¶ added in v0.9.0
func (arr *WakuFilterPushResult) Errors() []WakuFilterPushError