discovery

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

Functions

func Build

func Build(id string) naming.Resolver

Build register resolver into default discovery.

func Builder

func Builder() naming.Builder

Builder return default discovery resolver builder.

Types

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 discovery resolver 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 discovery 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.

Jump to

Keyboard shortcuts

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