Exemple #1
0
func bgDel(p consensus.Proposer, k string, c int64) chan store.Event {
	ch := make(chan store.Event)
	go func() {
		ch <- consensus.Del(p, k, c)
	}()
	return ch
}
Exemple #2
0
func (t *txn) del() {
	if t.c.access == false {
		t.respondOsError(os.EACCES)
		return
	}

	if !t.c.canWrite {
		t.respondErrCode(response_READONLY)
		return
	}

	if t.req.Path == nil || t.req.Rev == nil {
		t.respondErrCode(response_MISSING_ARG)
		return
	}

	go func() {
		ev := consensus.Del(t.c.p, *t.req.Path, *t.req.Rev)
		if ev.Err != nil {
			t.respondOsError(ev.Err)
			return
		}
		t.respond()
	}()
}
Exemple #3
0
func removeInfo(p consensus.Proposer, g store.Getter, name string) {
	glob, err := store.CompileGlob("/ctl/node/" + name + "/**")
	if err != nil {
		log.Println(err)
		return
	}
	store.Walk(g, glob, func(path, _ string, rev int64) bool {
		consensus.Del(p, path, rev)
		return false
	})
}
Exemple #4
0
func Clean(p consensus.Proposer, ch <-chan store.Event) {
	for ev := range ch {
		if ev.IsDel() {
			name := ev.Path[len(SessDir)+1:]

			store.Walk(ev, locks, func(path, body string, rev int64) bool {
				if body == name {
					go consensus.Del(p, path, rev)
				}
				return false
			})
		}
	}
}