etcdv3

package
v0.0.0-...-530387d Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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。

func (*EtcdRegister) Stop

func (r *EtcdRegister) Stop()

Stop registe process

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

Build returns itself for resolver, because it's both a builder and a resolver.

func (*EtcdResolver) Close

func (r *EtcdResolver) Close()

Close is a noop for resolver.

func (*EtcdResolver) NewAddress

func (r *EtcdResolver) NewAddress(addrs []resolver.Address)

NewAddress to update cc

func (*EtcdResolver) Print

func (r *EtcdResolver) Print(name string)

Print just for usedForTest

func (*EtcdResolver) ResolveNow

func (r *EtcdResolver) ResolveNow(o resolver.ResolveNowOption)

ResolveNow is a noop for resolver.

func (*EtcdResolver) Scheme

func (r *EtcdResolver) Scheme() string

Scheme returns the scheme.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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