示例#1
0
func getAddrs(g store.Getter, cals []string) (a []string) {
	a = make([]string, len(cals))
	for i, id := range cals {
		a[i] = store.GetString(g, "/ctl/node/"+id+"/addr")
	}
	return
}
示例#2
0
文件: member.go 项目: kr/doozer
func getName(addr string, g store.Getter) string {
	for _, name := range store.Getdir(g, "/ctl/node") {
		if store.GetString(g, "/ctl/node/"+name+"/addr") == addr {
			return name
		}
	}
	return ""
}
示例#3
0
func (cl *cleaner) getCals(seqn uint64) []string {
	slots := store.GetDir(cl.st, "/doozer/slot")
	cals := make([]string, len(slots))
	for i, slot := range slots {
		cals[i] = store.GetString(cl.st, "/doozer/slot/"+slot)
	}
	return cals
}
示例#4
0
文件: run.go 项目: foamdino/doozerd
func getAddrs(g store.Getter) map[string]bool {
	// TODO include only CALs, once followers use TCP for updates.

	ids := store.Getdir(g, "/ctl/node")
	addrs := make(map[string]bool)

	for _, id := range ids {
		addrs[store.GetString(g, "/ctl/node/"+id+"/addr")] = true
	}

	return addrs
}
示例#5
0
func getAddrs(g store.Getter, cals []string) (a []*net.UDPAddr) {
	a = make([]*net.UDPAddr, len(cals))
	var i int
	var err error
	for _, id := range cals {
		s := store.GetString(g, "/ctl/node/"+id+"/addr")
		a[i], err = net.ResolveUDPAddr("udp", s)
		if err != nil {
			log.Println(err)
		} else {
			i++
		}
	}
	return a[:i]
}
示例#6
0
func getCals(g store.Getter) []string {
	ents := store.Getdir(g, "/ctl/cal")
	cals := make([]string, len(ents))

	i := 0
	for _, cal := range ents {
		id := store.GetString(g, "/ctl/cal/"+cal)
		if id != "" {
			cals[i] = id
			i++
		}
	}

	cals = cals[0:i]
	sort.Strings(cals)

	return cals
}
示例#7
0
func (mon *monitor) lookupParam(id, param string) string {
	return store.GetString(mon.st, defDir+id+"/"+param)
}
示例#8
0
func sget(c *conn, _ uint, data interface{}) interface{} {
	r := data.(*proto.ReqGet)
	return store.GetString(c.s.St.SyncPath(r.Path), r.Path)
}