Version: v0.7.5 Latest Latest

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 17 Imported by: 0




This section is empty.


View Source
var (

	// ErrDuplication duplication treeid.
	ErrDuplication = errors.New("discovery: instance duplicate registration")


func Build

func Build(id string) naming.Resolver

Build register resolver into default discovery.

func Builder

func Builder() naming.Builder

Builder return default discvoery resolver builder.


type Config

type Config struct {
	Nodes  []string
	Region string
	Zone   string
	Env    string
	Host   string

Config discovery configures.

type Discovery

type Discovery struct {
	// contains filtered or unexported fields

Discovery is discovery client.

func New

func New(c *Config) (d *Discovery)

New new a discovery client.

func (*Discovery) Build

func (d *Discovery) Build(appid string, opts ...naming.BuildOpt) naming.Resolver

Build disovery resovler builder.

func (*Discovery) Close

func (d *Discovery) Close() error

Close stop all running process including discovery and register

func (*Discovery) Register

func (d *Discovery) Register(ctx context.Context, ins *naming.Instance) (cancelFunc context.CancelFunc, err error)

Register Register an instance with discovery and renew automatically

func (*Discovery) Reload

func (d *Discovery) Reload(c *Config)

Reload reload the config

func (*Discovery) Scheme

func (d *Discovery) Scheme() string

Scheme return discovery's scheme

func (*Discovery) Set

func (d *Discovery) Set(ins *naming.Instance) error

Set set ins status and metadata.

type Resolve

type Resolve struct {
	// contains filtered or unexported fields

Resolve discveory resolver.

func (*Resolve) Close

func (r *Resolve) Close() error

Close close resolver.

func (*Resolve) Fetch

func (r *Resolve) Fetch(ctx context.Context) (ins *naming.InstancesInfo, ok bool)

Fetch fetch resolver instance.

func (*Resolve) Watch

func (r *Resolve) Watch() <-chan struct{}

Watch watch instance.

Source Files

Jump to

Keyboard shortcuts

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