goProject/trunk/framework/zooKeeperMgr/zooKeeperConfig.go

28 lines
553 B
Go
Raw Normal View History

2025-01-06 16:01:02 +08:00
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
}