Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chooser ¶
type Chooser interface { Start() error Stop() error Choose(context.Context, *transport.Request) (peer.Peer, func(error), error) IsRunning() bool UpdatePeer(urlString string) error }
Chooser is the interface for a YARPC endpoint that can be updated dynamically. This is an implementation of go.uber.org/yarpc/peer/Chooser
func NewSimpleChooser ¶
NewSimpleChooser creates a new Chooser, with no bells and whistles. Just a peer that can be updated manually. role is the string identifier for what this peer represents (mesos-master, hostmgr, etc)
func NewSmartChooser ¶
func NewSmartChooser( cfg leader.ElectionConfig, scope tally.Scope, role string, transport peer.Transport) (Chooser, error)
NewSmartChooser creates a new SmartChooser with dynamic peer update support. It embeds a peer.chooser, but includes the ability to react to leadership changes in zookeeper and reconfigure the peer
type PeerChooser ¶
PeerChooser is a yarpc-compatible Chooser, that periodically updates the peer url, by invoking the discover callback.
func NewPeerChooser ¶
func NewPeerChooser(transport peer.Transport, discoverInterval time.Duration, f discoverFunc, r string) *PeerChooser
NewPeerChooser create a new Chooser for dynamically updating the remote peer. When called, discover will be called once to set initial peer, such that if the discover callback succeeds, it's guaranteed to have a peer.
func (*PeerChooser) Choose ¶
func (c *PeerChooser) Choose(ctx context.Context, req *transport.Request) (peer.Peer, func(error), error)
Choose returns a peer
func (*PeerChooser) IsRunning ¶
func (c *PeerChooser) IsRunning() bool
IsRunning returns true if a peer chooser is running
func (*PeerChooser) NotifyStatusChanged ¶
func (c *PeerChooser) NotifyStatusChanged(id peer.Identifier)
NotifyStatusChanged receives notifications from the transport when the peer connects, disconnects, accepts a request, and so on.