filter

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const FilterID_v20beta1 = libp2pProtocol.ID("/vac/waku/filter/2.0.0-beta1")

FilterID_v20beta1 is the current Waku Filter protocol identifier

Variables

View Source
var (
	ErrNoPeersAvailable = errors.New("no suitable remote peers")
)

Functions

This section is empty.

Types

type ContentFilter

type ContentFilter struct {
	Topic         string
	ContentTopics []string
}

type Filter

type Filter struct {
	PeerID         peer.ID
	Topic          string
	ContentFilters []string
	Chan           chan *protocol.Envelope
	// contains filtered or unexported fields
}

type FilterMap

type FilterMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewFilterMap

func NewFilterMap() *FilterMap

func (*FilterMap) Delete

func (fm *FilterMap) Delete(key string)

func (*FilterMap) Get

func (fm *FilterMap) Get(key string) (Filter, bool)

func (*FilterMap) Items

func (fm *FilterMap) Items() <-chan FilterMapItem

func (*FilterMap) Notify

func (fm *FilterMap) Notify(msg *pb.WakuMessage, requestId string)

func (*FilterMap) RemoveAll

func (fm *FilterMap) RemoveAll()

func (*FilterMap) Set

func (fm *FilterMap) Set(key string, value Filter)

type FilterMapItem

type FilterMapItem struct {
	Key   string
	Value Filter
}

type FilterParameters

type FilterParameters struct {
	// contains filtered or unexported fields
}

type FilterSubscribeOption

type FilterSubscribeOption func(*FilterSubscribeParameters)

func DefaultSubscribtionOptions

func DefaultSubscribtionOptions() []FilterSubscribeOption

func WithAutomaticPeerSelection

func WithAutomaticPeerSelection() FilterSubscribeOption

func WithFastestPeerSelection

func WithFastestPeerSelection(ctx context.Context) FilterSubscribeOption

func WithPeer

func WithPeer(p peer.ID) FilterSubscribeOption

type FilterSubscribeParameters

type FilterSubscribeParameters struct {
	// contains filtered or unexported fields
}

type FilterSubscription

type FilterSubscription struct {
	RequestID string
	Peer      peer.ID
}

type Option

type Option func(*FilterParameters)

func DefaultOptions

func DefaultOptions() []Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

func (Subscriber) HasContentTopic added in v0.1.0

func (sub Subscriber) HasContentTopic(topic string) bool

type Subscribers

type Subscribers struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSubscribers

func NewSubscribers(timeout time.Duration) *Subscribers

func (*Subscribers) Append

func (sub *Subscribers) Append(s Subscriber) int

func (*Subscribers) FlagAsFailure

func (sub *Subscribers) FlagAsFailure(peerID peer.ID)

func (*Subscribers) FlagAsSuccess

func (sub *Subscribers) FlagAsSuccess(peerID peer.ID)

func (*Subscribers) IsFailedPeer added in v0.1.0

func (sub *Subscribers) IsFailedPeer(peerID peer.ID) bool

func (*Subscribers) Items

func (sub *Subscribers) Items(contentTopic *string) <-chan Subscriber

func (*Subscribers) Length

func (sub *Subscribers) Length() int

func (*Subscribers) RemoveContentFilters

func (sub *Subscribers) RemoveContentFilters(peerID peer.ID, requestId string, contentFilters []*pb.FilterRequest_ContentFilter)

type WakuFilter

type WakuFilter struct {
	MsgC chan *protocol.Envelope
	// contains filtered or unexported fields
}

func NewWakuFilter

func NewWakuFilter(ctx context.Context, host host.Host, isFullNode bool, log *zap.Logger, opts ...Option) (*WakuFilter, error)

NewWakuRelay returns a new instance of Waku Filter struct setup according to the chosen parameter and options

func (*WakuFilter) Stop

func (wf *WakuFilter) Stop()

Stop unmounts the filter protocol

func (*WakuFilter) Subscribe

func (wf *WakuFilter) Subscribe(ctx context.Context, f ContentFilter, opts ...FilterSubscribeOption) (filterID string, theFilter Filter, err error)

Subscribe setups a subscription to receive messages that match a specific content filter

func (*WakuFilter) Unsubscribe

func (wf *WakuFilter) Unsubscribe(ctx context.Context, contentFilter ContentFilter, peer peer.ID) error

Unsubscribe is used to stop receiving messages from a peer that match a content filter

func (*WakuFilter) UnsubscribeByFilter added in v0.2.0

func (wf *WakuFilter) UnsubscribeByFilter(ctx context.Context, filter Filter) error

UnsubscribeFilterByID removes a subscription to a filter node completely using using a filter. It also closes the filter channel

func (*WakuFilter) UnsubscribeFilter

func (wf *WakuFilter) UnsubscribeFilter(ctx context.Context, cf ContentFilter) error

Unsubscribe filter removes content topics from a filter subscription. If all the contentTopics are removed the subscription is dropped completely

func (*WakuFilter) UnsubscribeFilterByID

func (wf *WakuFilter) UnsubscribeFilterByID(ctx context.Context, filterID string) error

UnsubscribeFilterByID removes a subscription to a filter node completely using the filterID returned when the subscription was created

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL