Пример #1
0
// WriteAddrs writes a ZknsAddres record to a path in Zookeeper.
func WriteAddrs(zconn zk.Conn, zkPath string, addrs *ZknsAddrs) error {
	if !(addrs.IsValidA() || addrs.IsValidCNAME() || addrs.IsValidSRV()) {
		return fmt.Errorf("invalid addrs: %v", zkPath)
	}
	data := toJson(addrs)
	_, err := zk.CreateOrUpdate(zconn, zkPath, data, 0, zookeeper.WorldACL(zk.PERM_FILE), true)
	return err
}
Пример #2
0
func WriteAddrs(zconn zk.Conn, zkPath string, addrs *LegacyZknsAddrs) error {
	data := jscfg.ToJson(addrs)
	_, err := zk.CreateOrUpdate(zconn, zkPath, data, 0, zookeeper.WorldACL(zookeeper.PERM_ALL), true)
	return err
}