package remotes
import "github.com/moby/swarmkit/v2/remotes"
Index ¶
Constants ¶
const DefaultObservationWeight = 10
DefaultObservationWeight provides a weight to use for positive observations that will balance well under repeated observations.
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.
Source Files ¶
- Version
- v2.0.0-20250103191802-8c1959736554 (latest)
- Published
- Jan 3, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 1 week ago –
Tools for package owners.