balancer

package
v3.3.0-rc.0.0...-f5e52c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package balancer implements client balancer.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAddrAvilable = status.Error(codes.Unavailable, "there is no address available")

ErrNoAddrAvilable is returned by Get() when the balancer does not have any active connection to endpoints at the time. This error is returned only when opts.BlockingWait is true.

Functions

This section is empty.

Types

type DialFunc

type DialFunc func(ep string, dopts ...grpc.DialOption) (*grpc.ClientConn, error)

DialFunc defines gRPC dial function.

type GRPC17Health

type GRPC17Health struct {
	// contains filtered or unexported fields
}

GRPC17Health does the bare minimum to expose multiple eps to the grpc reconnection code path

func NewGRPC17Health

func NewGRPC17Health(
	eps []string,
	timeout time.Duration,
	dialFunc DialFunc,
) *GRPC17Health

NewGRPC17Health returns a new health balancer with gRPC v1.7.

func (*GRPC17Health) Close

func (b *GRPC17Health) Close() error

func (*GRPC17Health) ConnectNotify

func (b *GRPC17Health) ConnectNotify() <-chan struct{}

func (*GRPC17Health) Endpoint

func (b *GRPC17Health) Endpoint(hostPort string) string

func (*GRPC17Health) Get

func (b *GRPC17Health) Get(ctx context.Context, opts grpc.BalancerGetOptions) (grpc.Address, func(), error)

func (*GRPC17Health) HostPortError

func (b *GRPC17Health) HostPortError(hostPort string, err error)

func (*GRPC17Health) NeedUpdate

func (b *GRPC17Health) NeedUpdate() bool

NeedUpdate returns true if all connections are down or addresses do not include current pinned address.

func (*GRPC17Health) Next

func (b *GRPC17Health) Next()

func (*GRPC17Health) Notify

func (b *GRPC17Health) Notify() <-chan []grpc.Address

func (*GRPC17Health) Pinned

func (b *GRPC17Health) Pinned() string

func (*GRPC17Health) Ready

func (b *GRPC17Health) Ready() <-chan struct{}

func (*GRPC17Health) Start

func (b *GRPC17Health) Start(target string, config grpc.BalancerConfig) error

func (*GRPC17Health) StopC

func (b *GRPC17Health) StopC() chan struct{}

func (*GRPC17Health) Up

func (b *GRPC17Health) Up(addr grpc.Address) func(error)

func (*GRPC17Health) UpdateAddrs

func (b *GRPC17Health) UpdateAddrs(eps ...string)

func (*GRPC17Health) UpdateAddrsC

func (b *GRPC17Health) UpdateAddrsC() chan NotifyMsg

type NotifyMsg

type NotifyMsg int
const (
	NotifyReset NotifyMsg = iota
	NotifyNext
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL