xregistry

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyFormat

func KeyFormat(target resolver.Target) string

func UpdateAddress

func UpdateAddress(i []Instance, conn resolver.ClientConn)

Types

type Discovery

type Discovery interface {
	Discover(target string) (<-chan []Instance, error)
	Close()
}

服务发现接口

type Instance

type Instance struct {
	ServiceName string      `json:"servicename"`
	Address     string      `json:"address"`
	Metadata    metadata.MD `json:"metadata"`
}

type NoopResolver

type NoopResolver struct{}

func (*NoopResolver) Close

func (r *NoopResolver) Close()

func (*NoopResolver) ResolveNow

func (r *NoopResolver) ResolveNow(resolver.ResolveNowOptions)

type Option

type Option func(*Options)

func Address

func Address(address string) Option

func Metadata

func Metadata(m metadata.MD) Option

func RegisterInterval

func RegisterInterval(interval time.Duration) Option

func RegisterTTL

func RegisterTTL(ttl time.Duration) Option

func ServiceName

func ServiceName(name string) Option

func ServiceNamespaces

func ServiceNamespaces(namespaces string) Option

type Options

type Options struct {
	ServiceName string      `json:"servicename"`
	Namespaces  string      `json:"namespaces"`
	Address     string      `json:"address"`
	Metadata    metadata.MD `json:"metadata"`
	// 服务有效时长
	RegisterTTL      time.Duration `json:"-"` // time to live, 服务失活一段时间后自动从注册中心删除
	RegisterInterval time.Duration `json:"-"` // 注册间隔时长,也可不要 默认为RegisterTTL/3
}

Registry Options

type Registry

type Registry interface {
	Register(ops ...Option)
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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