Back to godoc.org

Package discovery

v0.3.3
Latest Go to latest

The latest major version is .

Published: Jan 20, 2020 | License: MIT | Module: github.com/bilibili/kratos

Index

Variables

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier