func (t *txn) set() { 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.Set(t.c.p, *t.req.Path, t.req.Value, *t.req.Rev) if ev.Err != nil { t.respondOsError(ev.Err) trace("eunknown") return } t.resp.Rev = &ev.Seqn t.respond() trace("success") }() }
func clearSlot(p consensus.Proposer, g store.Getter, name string) { store.Walk(g, calGlob, func(path, body string, rev int64) bool { if body == name { consensus.Set(p, path, nil, rev) } return false }) }
func Pulse(node string, seqns <-chan int64, p consensus.Proposer, sleep int64) { path := "/ctl/node/" + node + "/applied" for { seqn, ok := <-seqns if !ok { break } e := consensus.Set(p, path, []byte(strconv.FormatInt(seqn, 10)), store.Clobber) if e.Err != nil { log.Println(e.Err) } time.Sleep(time.Duration(sleep)) } }