peerlistmgr

package
v0.0.0-...-132f1c2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Options = options{}

Options is a factory for different options.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option is a function that sets some option.

type PeerListManager

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

PeerListManager uses a discovery.Notifier to manage tchannel.PeerList by making sure that there are connections to at least minPeers.

func New

func New(
	peerList *tchannel.PeerList,
	discoverer discovery.Discoverer,
	notifier discovery.Notifier,
	opts ...Option,
) (*PeerListManager, error)

New creates new PeerListManager.

func (PeerListManager) ConnCheckFrequency

func (o PeerListManager) ConnCheckFrequency(connCheckFrequency time.Duration) Option

ConnCheckFrequency changes how frequently manager will check for MinPeers connections.

func (PeerListManager) ConnCheckTimeout

func (o PeerListManager) ConnCheckTimeout(connCheckTimeout time.Duration) Option

ConnCheckTimeout changes the timeout used when establishing new connections.

func (PeerListManager) Logger

func (o PeerListManager) Logger(logger *zap.Logger) Option

Logger creates an Option that assigns the logger.

func (PeerListManager) MinPeers

func (o PeerListManager) MinPeers(minPeers int) Option

MinPeers changes min number of open connections to peers that the manager will try to maintain.

func (*PeerListManager) Stop

func (m *PeerListManager) Stop()

Stop shuts down the manager. It blocks until both bg go-routines exit.

Jump to

Keyboard shortcuts

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