consul

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResolver

func GetResolver(consul coordinator.Coordinator, service, tag string, log *logger.Logger) (naming.Resolver, error)

GetResolver returns a Resolver

func NewBalancer

func NewBalancer(consul coordinator.Coordinator, service, tag string, log *logger.Logger) (balancer.Balancer, error)

NewBalancer initializes and returns a new Balancer.

Types

type Balancer

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

Balancer save meta info in Consul

func (*Balancer) GetResolver

func (b *Balancer) GetResolver(ctx context.Context) naming.Resolver

GetResolver returns a Resolver

type Resolver

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

Resolver implements the gRPC Resolver interface using a Consul backend.

See the gRPC load balancing documentation for details about Balancer and Resolver: https://github.com/grpc/grpc/blob/master/doc/load-balancing.md.

func (*Resolver) Close

func (r *Resolver) Close()

Close closes the watcher.

func (*Resolver) Next

func (r *Resolver) Next() ([]*naming.Update, error)

Next blocks until an update or error happens. It may return one or more updates. The first call will return the full set of instances available as NewConsulResolver will look those up. Subsequent calls to Next() will block until the resolver finds any new or removed instance.

An error is returned if and only if the watcher cannot recover.

func (*Resolver) Resolve

func (r *Resolver) Resolve(target string) (naming.Watcher, error)

Resolve creates a watcher for target. The watcher interface is implemented by Resolver as well, see Next and Close.

Jump to

Keyboard shortcuts

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