1 Star 0 Fork 0

zhuchance / kubernetes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
types.go 1006 Bytes
一键复制 编辑 原始数据 按行查看 历史
package zoo
import (
"github.com/samuel/go-zookeeper/zk"
)
// Connector Interface to facade zk.Conn type
// since github.com/samuel/go-zookeeper/zk does not provide an interface
// for the zk.Conn object, this allows for mocking and easier testing.
type Connector interface {
Close()
Children(string) ([]string, *zk.Stat, error)
ChildrenW(string) ([]string, *zk.Stat, <-chan zk.Event, error)
Get(string) ([]byte, *zk.Stat, error)
}
// interface for handling watcher event when zk.EventNodeChildrenChanged.
type ChildWatcher func(*Client, string)
// interface for handling errors (session and watch related).
type ErrorHandler func(*Client, error)
//Factory is an adapter to trap the creation of zk.Conn instances
//since the official zk API does not expose an interface for zk.Conn.
type Factory interface {
create() (Connector, <-chan zk.Event, error)
}
type asFactory func() (Connector, <-chan zk.Event, error)
func (f asFactory) create() (Connector, <-chan zk.Event, error) {
return f()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/meoom/kubernetes.git
git@gitee.com:meoom/kubernetes.git
meoom
kubernetes
kubernetes
v0.20.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891