Documentation ¶
Index ¶
Constants ¶
View Source
const ( TTLSec = 15 * time.Second TTLInt = 15 RevoteSec = 10 * time.Second TokenLength = 16 EtcdClientDialTimeout = 5 * time.Second )
View Source
const (
UpdateSvrDefIntervalSec = 5 // Sec
)
Variables ¶
View Source
var ( DefaultEtcdCfg = clientv3.Config{ DialTimeout: EtcdClientDialTimeout, } )
Functions ¶
This section is empty.
Types ¶
type Discover ¶
type DiscoverImpl ¶
type DiscoverImpl struct { Cfg clientv3.Config Str2SvrDef map[string]*SvrDef // 初始化的时候必须要设置 Env string // contains filtered or unexported fields }
func (*DiscoverImpl) GetAllAddrs ¶
func (di *DiscoverImpl) GetAllAddrs(servername string) (addrs []string, err error)
func (*DiscoverImpl) GetRandomAddr ¶
func (di *DiscoverImpl) GetRandomAddr(servername string) (addr string, err error)
func (*DiscoverImpl) Init ¶
func (di *DiscoverImpl) Init() (err error)
type RegisterImpl ¶
type RegisterImpl struct { ServerName string Env string Addr string Token string Cfg clientv3.Config // contains filtered or unexported fields }
func (*RegisterImpl) Init ¶
func (ri *RegisterImpl) Init(servername, addr, env string, cfg clientv3.Config) (err error)
func (*RegisterImpl) Serve ¶
func (ri *RegisterImpl) Serve()
Click to show internal directories.
Click to hide internal directories.