Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Spec ¶
func Spec() yarpcconfig.PeerListSpec
Spec returns a configuration specification for the random peer list implementation, making it possible to select a random peer with transports that use outbound peer list configuration (like HTTP).
cfg := yarpcconfig.New() cfg.MustRegisterPeerList(random.Spec())
This enables the random peer list:
outbounds: otherservice: unary: http: url: https://host:port/rpc random: peers: - 127.0.0.1:8080 - 127.0.0.1:8081
Types ¶
type List ¶
type List struct {
*peerlist.List
}
List is a PeerList that rotates which peers are to be selected randomly
type ListOption ¶
type ListOption interface {
// contains filtered or unexported methods
}
ListOption customizes the behavior of a random list.
func Capacity ¶
func Capacity(capacity int) ListOption
Capacity specifies the default capacity of the underlying data structures for this list.
Defaults to 10.
func Source ¶
func Source(source rand.Source) ListOption
Source is a source of randomness for the peer list.
Click to show internal directories.
Click to hide internal directories.