discovery

package
v0.6.0-preview Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	AddNode(string) bool           // Add an address to the discovery list
	RemoveNode(string) bool        // Remove an address from the discovery list
	GetAllNodes() []string         // Return all addresses this peer maintains
	GetRandomNodes(n int) []string // Return n random addresses for this peer to connect to
	FindNode(string) bool          // Find a node in the discovery list
}

Discovery is the interface that consolidates bootstrap peer membership selection and validating peer selection for non-validating peers

type DiscoveryImpl

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

DiscoveryImpl is an implementation of Discovery

func NewDiscoveryImpl

func NewDiscoveryImpl() *DiscoveryImpl

NewDiscoveryImpl is a constructor of a Discovery implementation

func (*DiscoveryImpl) AddNode

func (di *DiscoveryImpl) AddNode(address string) bool

AddNode adds an address to the discovery list

func (*DiscoveryImpl) FindNode

func (di *DiscoveryImpl) FindNode(address string) bool

FindNode returns true if its address is stored in the discovery list

func (*DiscoveryImpl) GetAllNodes

func (di *DiscoveryImpl) GetAllNodes() []string

GetAllNodes returns an array of all addresses saved in the discovery list

func (*DiscoveryImpl) GetRandomNodes

func (di *DiscoveryImpl) GetRandomNodes(n int) []string

GetRandomNodes returns n random nodes

func (*DiscoveryImpl) RemoveNode

func (di *DiscoveryImpl) RemoveNode(address string) bool

RemoveNode removes an address from the discovery list

Jump to

Keyboard shortcuts

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