storage

package
v0.0.0-...-27cef4d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidGroupIndex = errors.New("invalid group index")
)

storage errors

Functions

func MaxPeerStorageLen

func MaxPeerStorageLen() int

MaxPeerStorageLen is returns the maximum number of connections allowed.

Types

type Peer

type Peer interface {
	ID() string
	PingTime() time.Duration
	IsClose() bool
}

Peer is a functional list of Peer structures to be used internally.

type PeerStorage

type PeerStorage interface {
	Add(peer Peer, scoreFunc Score) bool
	List() []string
	Have(addr string) bool
	NotEnoughPeer() bool
}

PeerStorage is a list of functions to be exposed to external sources.

func NewPeerStorage

func NewPeerStorage() PeerStorage

NewPeerStorage is the PeerStorage creator.

type Score

type Score func(string) (time.Duration, bool)

Score is the type of function that scores.

Jump to

Keyboard shortcuts

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