Documentation
¶
Index ¶
Constants ¶
View Source
const Scheme = "etcd"
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Dial 创建基于 etcd 服务发现的 gRPC 客户端连接
func InitEtcdResolver ¶
func InitEtcdResolver(discovery *Discovery)
Types ¶
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
func NewDiscovery ¶
func (*Discovery) GetServices ¶
func (d *Discovery) GetServices(serviceName string) []*ServiceInfo
type EtcdResolverBuilder ¶
type EtcdResolverBuilder struct {
// contains filtered or unexported fields
}
func (*EtcdResolverBuilder) Build ¶
func (b *EtcdResolverBuilder) Build( target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions, ) (resolver.Resolver, error)
func (*EtcdResolverBuilder) Scheme ¶
func (b *EtcdResolverBuilder) Scheme() string
type Options ¶
type Options struct {
// etcd 客户端配置
Endpoints []string
Username string
Password string
DialTimeout time.Duration
// 服务注册配置
ServiceName string
ServiceAddr string
ServiceID string
TTL int64 // 租约时间(秒)
Version string
// 元数据
Metadata map[string]string
}
func DefaultOptions ¶
func DefaultOptions() *Options
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
Click to show internal directories.
Click to hide internal directories.