Documentation ¶
Overview ¶
Package registry registers servers. A server report itself on start.
Index ¶
Constants ¶
View Source
const GracefulRestart = EventType(iota)
GracefulRestart represents the hot restart event.
Variables ¶
View Source
var ErrNotImplement = errors.New("not implement")
ErrNotImplement is the not implemented error.
Functions ¶
func SetDefaultRegistry ¶
func SetDefaultRegistry(r Registry)
SetDefaultRegistry sets the default registry.
Types ¶
type Node ¶
type Node struct { ServiceName string // 服务名 ContainerName string // 容器名 Address string // 目标地址 ip:port Network string // 网络层协议 tcp/udp Protocol string // 业务协议 trpc/http SetName string // 节点 Set 名 Weight int // 权重 CostTime time.Duration // 当次请求耗时 EnvKey string // 透传的环境信息 Metadata map[string]interface{} // ParseAddr should be used to convert Node to net.Addr if it's not nil. // See test case TestSelectorRemoteAddrUseUserProvidedParser in client package. ParseAddr func(network, address string) net.Addr }
Node is the information of a node.
type NoopRegistry ¶
type NoopRegistry struct{}
NoopRegistry is the noop registry.
func (*NoopRegistry) Deregister ¶
func (noop *NoopRegistry) Deregister(service string) error
Deregister always return ErrNotImplement.
type Option ¶
type Option func(*Options)
Option modifies the Options.
func WithAddress ¶
WithAddress returns an Option which sets the server address. The format of address is "IP:Port" or just ":Port".
Click to show internal directories.
Click to hide internal directories.