Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Spec ¶
func Spec(opts ...ChooserOption) yarpcconfig.PeerChooserSpec
Spec returns a configuration specification for the direct peer chooser. The chooser uses transport.Request#ShardKey as the peer dentifier.
cfg := yarpcconfig.New() cfg.MustRegisterPeerChooser(direct.Spec())
This enables the direct chooser:
outbounds: destination-service: grpc: direct: {}
Types ¶
type Chooser ¶
type Chooser struct {
// contains filtered or unexported fields
}
Chooser is a peer.Chooser that returns the peer identified by transport.Request#ShardKey, suitable for directly addressing a peer.
func New ¶
func New(cfg Configuration, transport peer.Transport, opts ...ChooserOption) (*Chooser, error)
New creates a new direct peer chooser.
func (*Chooser) Choose ¶
func (c *Chooser) Choose(ctx context.Context, req *transport.Request) (peer.Peer, func(error), error)
Choose uses the peer identifier set as the transport.Request#ShardKey to return the peer.
type ChooserOption ¶
type ChooserOption func(*chooserOptions)
ChooserOption customizes the behavior of the peer chooser.
type Configuration ¶
type Configuration struct{}
Configuration describes how to build a direct peer chooser.
Click to show internal directories.
Click to hide internal directories.