Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultObservationWeight = 10
DefaultObservationWeight provides a weight to use for positive observations that will balance well under repeated observations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Remotes ¶
type Remotes interface {
// Weight returns the remotes with their current weights.
Weights() map[api.Peer]int
// Select a remote from the set of available remotes with optionally
// excluding ID or address.
Select(...string) (api.Peer, error)
// Observe records an experience with a particular remote. A positive weight
// indicates a good experience and a negative weight a bad experience.
//
// The observation will be used to calculate a moving weight, which is
// implementation dependent. This method will be called such that repeated
// observations of the same master in each session request are favored.
Observe(peer api.Peer, weight int)
// ObserveIfExists records an experience with a particular remote if when a
// remote exists.
ObserveIfExists(peer api.Peer, weight int)
// Remove the remote from the list completely.
Remove(addrs ...api.Peer)
}
Remotes keeps track of remote addresses by weight, informed by observations.
func NewRemotes ¶
NewRemotes returns a Remotes instance with the provided set of addresses. Entries provided are heavily weighted initially.
Click to show internal directories.
Click to hide internal directories.