cluster

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGetConnTimeout = 10 * time.Second
)

Variables

View Source
var (
	// ErrClusterClosed returned when requested on a closed cluster.
	ErrClusterClosed = errors.New("cluster closed")

	// ErrClusterEmpty returned when no connections left in cluster.
	ErrClusterEmpty = errors.New("cluster empty")

	// ErrUnknownEndpoint returned when no connections left in cluster.
	ErrUnknownEndpoint = errors.New("unknown endpoint")

	// ErrNilBalancerElement returned when requested on a nil Balancer element.
	ErrNilBalancerElement = errors.New("nil balancer element")
	// ErrUnknownBalancerElement returned when requested on a unknown Balancer element.
	ErrUnknownBalancerElement = errors.New("unknown balancer element")
	// ErrUnknownTypeOfBalancerElement returned when requested on a unknown types of Balancer element.
	ErrUnknownTypeOfBalancerElement = errors.New("unknown types of balancer element")
)

Functions

func DiffEndpoints

func DiffEndpoints(curr, next []endpoint.Endpoint, eq, add, del func(i, j int))

func SortEndpoints

func SortEndpoints(es []endpoint.Endpoint)

func WithConnConfig

func WithConnConfig(connConfig conn.Config) option

func WithWG

func WithWG(wg wg.WG) option

Types

type Cluster

type Cluster interface {
	Insert(ctx context.Context, endpoint endpoint.Endpoint, opts ...option)
	Update(ctx context.Context, endpoint endpoint.Endpoint, opts ...option)
	Get(ctx context.Context) (conn conn.Conn, err error)
	Pessimize(ctx context.Context, endpoint endpoint.Endpoint) error
	Close(ctx context.Context) error
	Remove(ctx context.Context, endpoint endpoint.Endpoint, wg ...option)
	SetExplorer(repeater repeater.Repeater)
	Force()
}

func New

func New(
	trace trace.Driver,
	dial func(context.Context, string) (*grpc.ClientConn, error),
	balancer ibalancer.Balancer,
) Cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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