Commit d2552d96 authored by wangwx's avatar wangwx

move client struct to client.go

parent fde1b715
...@@ -44,6 +44,24 @@ var ( ...@@ -44,6 +44,24 @@ var (
once sync.Once once sync.Once
) )
// ZookeeperClient represents zookeeper Client Configuration
type ZookeeperClient struct {
name string
ZkAddrs []string
sync.RWMutex // for conn
Conn *zk.Conn
activeNumber uint32
Timeout time.Duration
Wait sync.WaitGroup
valid uint32
share bool
reconnectCh chan struct{}
eventRegistry map[string][]*chan struct{}
eventRegistryLock sync.RWMutex
zkEventHandler ZkEventHandler
Session <-chan zk.Event
}
type zookeeperClientPool struct { type zookeeperClientPool struct {
sync.Mutex sync.Mutex
zkClient map[string]*ZookeeperClient zkClient map[string]*ZookeeperClient
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package gxzookeeper package gxzookeeper
import ( import (
"sync"
"time" "time"
) )
...@@ -43,24 +42,6 @@ func WithZkName(name string) Option { ...@@ -43,24 +42,6 @@ func WithZkName(name string) Option {
} }
} }
// ZookeeperClient represents zookeeper Client Configuration
type ZookeeperClient struct {
name string
ZkAddrs []string
sync.RWMutex // for conn
Conn *zk.Conn
activeNumber uint32
Timeout time.Duration
Wait sync.WaitGroup
valid uint32
share bool
reconnectCh chan struct{}
eventRegistry map[string][]*chan struct{}
eventRegistryLock sync.RWMutex
zkEventHandler ZkEventHandler
Session <-chan zk.Event
}
type zkClientOption func(*ZookeeperClient) type zkClientOption func(*ZookeeperClient)
// WithZkEventHandler sets zk Client event // WithZkEventHandler sets zk Client event
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment