Commit 048843cf authored by wangwx's avatar wangwx

change explanation

parent e060257c
...@@ -52,7 +52,7 @@ type ZkEventHandler interface { ...@@ -52,7 +52,7 @@ type ZkEventHandler interface {
type DefaultHandler struct { type DefaultHandler struct {
} }
// nolint // StateToString will transfer zk state to string
func StateToString(state zk.State) string { func StateToString(state zk.State) string {
switch state { switch state {
case zk.StateDisconnected: case zk.StateDisconnected:
...@@ -86,6 +86,7 @@ func initZookeeperClientPool() { ...@@ -86,6 +86,7 @@ func initZookeeperClientPool() {
zkClientPool.zkClient = make(map[string]*ZookeeperClient) zkClientPool.zkClient = make(map[string]*ZookeeperClient)
} }
//NewZookeeperClient will create a ZookeeperClient
func NewZookeeperClient(name string, zkAddrs []string, share bool, opts ...ZkClientOption) (*ZookeeperClient, error) { func NewZookeeperClient(name string, zkAddrs []string, share bool, opts ...ZkClientOption) (*ZookeeperClient, error) {
if share { if share {
once.Do(initZookeeperClientPool) once.Do(initZookeeperClientPool)
...@@ -346,7 +347,7 @@ func (z *ZookeeperClient) CreateTempWithValue(basePath string, value []byte) err ...@@ -346,7 +347,7 @@ func (z *ZookeeperClient) CreateTempWithValue(basePath string, value []byte) err
return nil return nil
} }
// nolint //Delete will delete basePath
func (z *ZookeeperClient) Delete(basePath string) error { func (z *ZookeeperClient) Delete(basePath string) error {
err := ErrNilZkClientConn err := ErrNilZkClientConn
conn := z.getConn() conn := z.getConn()
...@@ -495,7 +496,7 @@ func (z *ZookeeperClient) GetContent(zkPath string) ([]byte, *zk.Stat, error) { ...@@ -495,7 +496,7 @@ func (z *ZookeeperClient) GetContent(zkPath string) ([]byte, *zk.Stat, error) {
return z.Conn.Get(zkPath) return z.Conn.Get(zkPath)
} }
// nolint //SetContent set content of zkPath
func (z *ZookeeperClient) SetContent(zkPath string, content []byte, version int32) (*zk.Stat, error) { func (z *ZookeeperClient) SetContent(zkPath string, content []byte, version int32) (*zk.Stat, error) {
return z.Conn.Set(zkPath, content, version) return z.Conn.Set(zkPath, content, version)
} }
...@@ -520,7 +521,6 @@ func (z *ZookeeperClient) GetEventHandler() ZkEventHandler { ...@@ -520,7 +521,6 @@ func (z *ZookeeperClient) GetEventHandler() ZkEventHandler {
return z.zkEventHandler return z.zkEventHandler
} }
// In my opinion, this method should never called by user, here just for lint
func (z *ZookeeperClient) Close() { func (z *ZookeeperClient) Close() {
if z.share { if z.share {
zkClientPool.Lock() zkClientPool.Lock()
......
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