kratos: github.com/bilibili/kratos/pkg/naming/discovery Index | Files

package discovery

import "github.com/bilibili/kratos/pkg/naming/discovery"

Index

Package Files

discovery.go

Variables

var (

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

func Build Uses

func Build(id string) naming.Resolver

Build register resolver into default discovery.

func Builder Uses

func Builder() naming.Builder

Builder return default discvoery resolver builder.

type Config Uses

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

Config discovery configures.

type Discovery Uses

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

Discovery is discovery client.

func New Uses

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

New new a discovery client.

func (*Discovery) Build Uses

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

Build disovery resovler builder.

func (*Discovery) Close Uses

func (d *Discovery) Close() error

Close stop all running process including discovery and register

func (*Discovery) Register Uses

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 Uses

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

Reload reload the config

func (*Discovery) Scheme Uses

func (d *Discovery) Scheme() string

Scheme return discovery's scheme

func (*Discovery) Set Uses

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

Set set ins status and metadata.

type Resolve Uses

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

Resolve discveory resolver.

func (*Resolve) Close Uses

func (r *Resolve) Close() error

Close close resolver.

func (*Resolve) Fetch Uses

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

Fetch fetch resolver instance.

func (*Resolve) Watch Uses

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

Watch watch instance.

Package discovery imports 17 packages (graph) and is imported by 1 packages. Updated 2019-11-06. Refresh now. Tools for package owners.