v2

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster interface {
	// Register a new channel to receive broadcasts from a pubsubtopic
	Register(topic *string, newch chan<- *protocol.Envelope)
	// Register a new channel to receive broadcasts from a pubsub topic and return a channel to wait until this operation is complete
	WaitRegister(topic *string, newch chan<- *protocol.Envelope) doneCh
	// Unregister a channel so that it no longer receives broadcasts from a pubsub topic
	Unregister(topic *string, newch chan<- *protocol.Envelope)
	// Unregister a subscriptor channel and return a channel to wait until this operation is done
	WaitUnregister(topic *string, newch chan<- *protocol.Envelope) doneCh
	// Shut this broadcaster down.
	Close()
	// Submit a new object to all subscribers
	Submit(*protocol.Envelope)
}

The Broadcaster interface describes the main entry points to broadcasters.

func NewBroadcaster

func NewBroadcaster(buflen int) Broadcaster

NewBroadcaster creates a Broadcaster with an specified length It's used to register subscriptors that will need to receive an Envelope containing a WakuMessage

type PeerConnectionStrategy added in v0.4.0

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

PeerConnectionStrategy is a utility to connect to peers, but only if we have not recently tried connecting to them already

func NewPeerConnectionStrategy added in v0.4.0

func NewPeerConnectionStrategy(h host.Host, cacheSize int, minPeers int, dialTimeout time.Duration, backoff backoff.BackoffFactory, logger *zap.Logger) (*PeerConnectionStrategy, error)

NewPeerConnectionStrategy creates a utility to connect to peers, but only if we have not recently tried connecting to them already. cacheSize is the size of a TwoQueueCache dialTimeout is how long we attempt to connect to a peer before giving up minPeers is the minimum number of peers that the node should have backoff describes the strategy used to decide how long to backoff after previously attempting to connect to a peer

func (*PeerConnectionStrategy) PeerChannel added in v0.4.0

func (c *PeerConnectionStrategy) PeerChannel() chan<- peer.AddrInfo

PeerChannel exposes the channel on which discovered peers should be pushed

func (*PeerConnectionStrategy) Start added in v0.4.0

Start attempts to connect to the peers passed in by peerCh. Will not connect to peers if they are within the backoff period.

func (*PeerConnectionStrategy) Stop added in v0.4.0

func (c *PeerConnectionStrategy) Stop()

Jump to

Keyboard shortcuts

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