Documentation ¶
Index ¶
- type List
- func (pl *List) Choose(ctx context.Context, _ *transport.Request) (peer.Peer, func(error), error)
- func (pl *List) IsRunning() bool
- func (pl *List) NotifyStatusChanged(pid peer.Identifier)
- func (pl *List) Start() error
- func (pl *List) Stop() error
- func (pl *List) Update(updates peer.ListUpdates) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a peer list and peer chooser that favors the peer with the least pending requests, and then favors the least recently used or most recently introduced peer.
func (*List) Choose ¶
Choose satisfies peer.Chooser, providing a single peer for a request, a callback for when the request is finished, or an error if it fails. The choose method takes a context that must have a deadline. Choose resepects this deadline, waiting for an available peer until the deadline. The peer heap does not use the given *transport.Request and can safely receive nil.
func (*List) NotifyStatusChanged ¶
func (pl *List) NotifyStatusChanged(pid peer.Identifier)
NotifyStatusChanged receives notifications when a peer becomes available, connected, unavailable, or when its pending request count changes. This method satisfies peer.Subscriber and is only used for tests, since the peer heap has a subscriber for each invividual peer.