Documentation ¶
Index ¶
- Variables
- type ClientPool
- func (p *ClientPool) AllClient() map[string]*c3.Client
- func (p *ClientPool) Close()
- func (p *ClientPool) Init() error
- func (p *ClientPool) NewClientv3(endpoints []string) (*c3.Client, error)
- func (p *ClientPool) Select() (c *c3.Client)
- func (p *ClientPool) SelectWithNotify() (c *c3.Client, errc chan error)
- type PoolConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTimeout when waching wait timeout ErrTimeout = errors.New("watching wait timeout") )
Functions ¶
This section is empty.
Types ¶
type ClientPool ¶
type ClientPool struct { *PoolConfig // contains filtered or unexported fields }
ClientPool of etcd clientv3, allways choose leader
func NewClientPool ¶
func NewClientPool(config *PoolConfig) (*ClientPool, error)
NewClientPool return a new etcdc3 pool
func (*ClientPool) AllClient ¶
func (p *ClientPool) AllClient() map[string]*c3.Client
AllClient return all client's
func (*ClientPool) Init ¶
func (p *ClientPool) Init() error
Init start health check, connect pool to each etcd member
func (*ClientPool) NewClientv3 ¶
func (p *ClientPool) NewClientv3(endpoints []string) (*c3.Client, error)
NewClientv3 return a new v3 client, DON't forget to close it
func (*ClientPool) SelectWithNotify ¶
func (p *ClientPool) SelectWithNotify() (c *c3.Client, errc chan error)
SelectWithNotify return client with err notify
type PoolConfig ¶
type PoolConfig struct { Ctx context.Context TestKey string // for health tick HealthTick time.Duration // etcd Endpoints Endpoints []string // store Endpoints TLS *tls.Config // Username/Password Username string Password string // dail to etcd DialTimeout time.Duration DialKeepAliveTime time.Duration }
PoolConfig config etcd pool
Click to show internal directories.
Click to hide internal directories.