storage

package
v0.0.0-...-6ee0886 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 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 IsClose

type IsClose func(ID string) bool

IsClose is the type of function that check peer is closed.

type PeerStorage

type PeerStorage interface {
	Add(peer peermessage.ConnectInfo, scoreFunc Score) bool
	Have(addr string) bool
	NotEnoughPeer() bool
}

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

func NewPeerStorage

func NewPeerStorage(isClose IsClose) 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