consul

package
v0.0.0-...-9212df6 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Init

func Init()

func Register

func Register(svcName string, port int)

Types

type ConsulInstance

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

func (*ConsulInstance) Address

func (i *ConsulInstance) Address() net.Addr

func (*ConsulInstance) Tag

func (i *ConsulInstance) Tag(key string) (value string, exist bool)

func (*ConsulInstance) Weight

func (i *ConsulInstance) Weight() int

type ConsulResolver

type ConsulResolver struct {
	ConsulClient *consulapi.Client
}

func (*ConsulResolver) Diff

func (r *ConsulResolver) Diff(cacheKey string, prev, next discovery.Result) (discovery.Change, bool)

Diff computes the difference between two results. When `next` is cacheable, the Change should be cacheable, too. And the `Result` field's CacheKey in the return value should be set with the given cacheKey.

func (*ConsulResolver) Name

func (r *ConsulResolver) Name() string

Name returns the name of the resolver.

func (*ConsulResolver) Resolve

func (r *ConsulResolver) Resolve(ctx context.Context, desc string) (discovery.Result, error)

Resolve returns a list of instances for the given description of a target.

func (*ConsulResolver) Target

func (r *ConsulResolver) Target(ctx context.Context, target rpcinfo.EndpointInfo) (description string)

Jump to

Keyboard shortcuts

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