Exemple #1
0
func (t *txn) del() {
	trace := t.instrumentVerb()

	if !t.c.waccess {
		t.respondOsError(syscall.EACCES)
		trace("eacces")
		return
	}

	if !t.c.canWrite {
		t.respondErrCode(Response_READONLY)
		trace("ereadonly")
		return
	}

	if t.req.Path == nil || t.req.Rev == nil {
		t.respondErrCode(Response_MISSING_ARG)
		trace("emissingarg")
		return
	}

	go func() {
		ev := consensus.Del(t.c.p, *t.req.Path, *t.req.Rev)
		if ev.Err != nil {
			t.respondOsError(ev.Err)
			trace("eunknown")
			return
		}
		t.respond()
		trace("success")
	}()
}
Exemple #2
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
	})
}