Example #1
0
func (t *txn) del() {
	if !t.c.waccess {
		t.respondOsError(syscall.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()
	}()
}
Example #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
	})
}