Versions in this module Expand all Collapse all v2 v2.8.2 Nov 1, 2024 v2.8.1 Nov 1, 2024 Changes in this version + var ErrNoAvailable = errors.ServiceUnavailable("no_available_node", "") + func NewPeerContext(ctx context.Context, p *Peer) context.Context + func SetGlobalSelector(builder Builder) + type Balancer interface + Pick func(ctx context.Context, nodes []WeightedNode) (selected WeightedNode, done DoneFunc, err error) + type BalancerBuilder interface + Build func() Balancer + type Builder interface + Build func() Selector + func GlobalSelector() Builder + type Default struct + Balancer Balancer + NodeBuilder WeightedNodeBuilder + func (d *Default) Apply(nodes []Node) + func (d *Default) Select(ctx context.Context, opts ...SelectOption) (selected Node, done DoneFunc, err error) + type DefaultBuilder struct + Balancer BalancerBuilder + Node WeightedNodeBuilder + func (db *DefaultBuilder) Build() Selector + type DefaultNode struct + func (n *DefaultNode) Address() string + func (n *DefaultNode) InitialWeight() *int64 + func (n *DefaultNode) Metadata() map[string]string + func (n *DefaultNode) Scheme() string + func (n *DefaultNode) ServiceName() string + func (n *DefaultNode) Version() string + type DoneFunc func(ctx context.Context, di DoneInfo) + type DoneInfo struct + BytesReceived bool + BytesSent bool + Err error + ReplyMD ReplyMD + type Node interface + Address func() string + InitialWeight func() *int64 + Metadata func() map[string]string + Scheme func() string + ServiceName func() string + Version func() string + func NewNode(scheme, addr string, ins *registry.ServiceInstance) Node + type NodeFilter func(context.Context, []Node) []Node + type Peer struct + Node Node + func FromPeerContext(ctx context.Context) (p *Peer, ok bool) + type Rebalancer interface + Apply func(nodes []Node) + type ReplyMD interface + Get func(key string) string + type SelectOption func(*SelectOptions) + func WithNodeFilter(fn ...NodeFilter) SelectOption + type SelectOptions struct + NodeFilters []NodeFilter + type Selector interface + Select func(ctx context.Context, opts ...SelectOption) (selected Node, done DoneFunc, err error) + type WeightedNode interface + Pick func() DoneFunc + PickElapsed func() time.Duration + Raw func() Node + Weight func() float64 + type WeightedNodeBuilder interface + Build func(Node) WeightedNode