goProject/.svn/pristine/ab/ab7a8ced9853c6bb1976f4980b12660cf0d17d13.svn-base
2025-01-06 16:21:36 +08:00

28 lines
553 B
Plaintext

package zooKeeperMgr
import (
"strings"
"time"
)
// ZooKeeper配置对象
type ZooKeeperConfig struct {
// ZooKeeper的服务器地址(如果有多个地址,则用,分隔)
Servers string
// 起始节点路径
StartPath string
// 会话超时时间(单位:秒)
SessionTimeout time.Duration
}
// 获取所有的ZooKeeper服务器列表
func (this *ZooKeeperConfig) GetServerList() []string {
return strings.Split(this.Servers, ",")
}
func (this *ZooKeeperConfig) Parse() {
this.SessionTimeout = this.SessionTimeout * time.Second
}