feat: use robot to migrate code

Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
This commit is contained in:
kubbot & kubecub
2023-06-30 09:45:02 +08:00
parent 2d41819008
commit 539e0fdfb6
529 changed files with 64588 additions and 54413 deletions
+27
View File
@@ -0,0 +1,27 @@
package zookeeper
import (
"github.com/go-zookeeper/zk"
)
func (s *ZkClient) RegisterConf2Registry(key string, conf []byte) error {
exists, _, err := s.conn.Exists(s.getPath(key))
if err != nil {
return err
}
if exists {
if err := s.conn.Delete(s.getPath(key), 0); err != nil {
return err
}
}
_, err = s.conn.Create(s.getPath(key), conf, 0, zk.WorldACL(zk.PermAll))
if err != zk.ErrNodeExists {
return err
}
return nil
}
func (s *ZkClient) GetConfFromRegistry(key string) ([]byte, error) {
bytes, _, err := s.conn.Get(s.getPath(key))
return bytes, err
}