Documentation ¶
Index ¶
- type Peers
- func (p *Peers) Add(id peer.ID) bool
- func (p *Peers) Delete(id peer.ID)
- func (p *Peers) OnFailure(id peer.ID)
- func (p *Peers) OnLatency(id peer.ID, size int, latency time.Duration)
- func (p *Peers) SelectBest(n int) []peer.ID
- func (p *Peers) SelectBestFrom(peers []peer.ID) peer.ID
- func (p *Peers) Total() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peers ¶
type Peers struct {
// contains filtered or unexported fields
}
func (*Peers) SelectBest ¶
SelectBest selects at most n peers sorted by responsiveness and latency.
SelectBest parametrized by N because sync protocol relies on receiving data from redundant connections to guarantee that it will get complete data set. If it doesn't get complete data set it will have to fallback into hash resolution, which is generally more expensive.
func (*Peers) SelectBestFrom ¶
SelectBest peer with preferences.
Click to show internal directories.
Click to hide internal directories.