registry

package
v0.0.0-...-d08609b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func Addrs

func Addrs(addrs ...string) Option

Addrs is the registry addresses to use

func Secure

func Secure(b bool) Option

Secure communication with the registry

func TLSConfig

func TLSConfig(t *tls.Config) Option

Specify TLS Config

func Timeout

func Timeout(t time.Duration) Option

type Options

type Options struct {
	Addrs     []string
	Timeout   time.Duration
	Secure    bool
	TLSConfig *tls.Config

	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

type RegisterOptions

type RegisterOptions struct {
	TTL time.Duration
	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

type Registry

type Registry interface {
	//Register(*ServiceInfo) error
	//Init(...Option) error
	//Init(*ServiceInfo, ...Option) error
	Init(*ServiceInfo) error
	Register() error
	Deregister() error
	//服务选择
	//Selector(string) (string, error)
	//GetService(string, ...GetOption) ([]*Service, error)
	//GetServices(string, string) ([]ServiceInfo, error)
	//SelectorService(string) ([]registry.ServiceInfo, error)
	SelectorService(string, string) (*ServiceInfo, error)

	GetSid() string
}

type ServiceInfo

type ServiceInfo struct {
	ID       string
	Name     string
	Port     int
	Address  string
	Tags     []string
	Version  string //具体信息在consul中记录在tags中
	Active   bool   //是否有效
	UseCount int64  //客户调用次数
}

type WatchOptions

type WatchOptions struct {
	// Specify a service to watch
	// If blank, the watch is for all services
	Service string
	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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