etcd: github.com/coreos/etcd/clientv3/balancer Index | Files | Directories

package balancer

import "github.com/coreos/etcd/clientv3/balancer"

Package balancer implements client balancer.

Index

Package Files

balancer.go utils.go

func RegisterBuilder Uses

func RegisterBuilder(cfg Config)

RegisterBuilder creates and registers a builder. Since this function calls balancer.Register, it must be invoked at initialization time.

type Balancer Uses

type Balancer interface {
    // Balancer is called on specified client connection. Client initiates gRPC
    // connection with "grpc.Dial(addr, grpc.WithBalancerName)", and then those resolved
    // addresses are passed to "grpc/balancer.Balancer.HandleResolvedAddrs".
    // For each resolved address, balancer calls "balancer.ClientConn.NewSubConn".
    // "grpc/balancer.Balancer.HandleSubConnStateChange" is called when connectivity state
    // changes, thus requires failover logic in this method.
    balancer.Balancer

    // Picker calls "Pick" for every client request.
    picker.Picker
}

Balancer defines client balancer interface.

type Config Uses

type Config struct {
    // Policy configures balancer policy.
    Policy picker.Policy

    // Name defines an additional name for balancer.
    // Useful for balancer testing to avoid register conflicts.
    // If empty, defaults to policy name.
    Name string

    // Logger configures balancer logging.
    // If nil, logs are discarded.
    Logger *zap.Logger
}

Config defines balancer configurations.

Directories

PathSynopsis
connectivityPackage connectivity implements client connectivity operations.
pickerPackage picker defines/implements client balancer picker policy.
resolver/endpointPackage endpoint resolves etcd entpoints using grpc targets of the form 'endpoint://<id>/<endpoint>'.

Package balancer imports 15 packages (graph) and is imported by 4 packages. Updated 2019-07-27. Refresh now. Tools for package owners.