Documentation ¶
Index ¶
- type EtcdRegister
- type EtcdResolver
- func (r *EtcdResolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error)
- func (r *EtcdResolver) Close()
- func (r *EtcdResolver) NewAddress(addrs []resolver.Address)
- func (r *EtcdResolver) Print(name string)
- func (r *EtcdResolver) ResolveNow(o resolver.ResolveNowOption)
- func (r *EtcdResolver) Scheme() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcdRegister ¶
type EtcdRegister struct { EtcdAddrs []string DialTimeout int // contains filtered or unexported fields }
EtcdRegister ...
func NewEtcdRegister ¶
func NewEtcdRegister(etcdAddrs []string) *EtcdRegister
NewEtcdRegister return a EtcdRegister, param: etcd endpoints addrs. Just for simple use
func (*EtcdRegister) GetServiceInfo ¶
func (r *EtcdRegister) GetServiceInfo() (common.ServerNodeInfo, error)
GetServiceInfo used get service info from etcd. Used for TEST
func (*EtcdRegister) Register ¶
func (r *EtcdRegister) Register(srvInfo common.ServerNodeInfo, ttl int64) (chan<- struct{}, error)
Register a service base on ServerNodeInfo。
type EtcdResolver ¶
type EtcdResolver struct { EtcdAddrs []string // Etcd 集群地址 DialTimeout int // Etcd 集群连接超时时间 SrvName string // 服务名称 SrvVersion string // 服务版本 SrvTTL int64 // 服务 TLL 时间,默认为秒 // contains filtered or unexported fields }
EtcdResolver for grpc client loadbalance From "google.golang.org/grpc/resolver/manual"
func NewEtcdResolver ¶
func NewEtcdResolver(etcdAddrs []string, srvName, srvVersion string, ttl int64) *EtcdResolver
NewEtcdResolver return a new grpc Resolver based on etcd
func (*EtcdResolver) Build ¶
func (r *EtcdResolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error)
Build returns itself for resolver, because it's both a builder and a resolver.
func (*EtcdResolver) NewAddress ¶
func (r *EtcdResolver) NewAddress(addrs []resolver.Address)
NewAddress to update cc
func (*EtcdResolver) ResolveNow ¶
func (r *EtcdResolver) ResolveNow(o resolver.ResolveNowOption)
ResolveNow is a noop for resolver.
Click to show internal directories.
Click to hide internal directories.