func Clean(s *store.Store, p paxos.Proposer) { timer := timer.New("/session/**", timer.OneSecond, s) for tick := range timer.C { _, cas := s.Get(tick.Path) paxos.Del(p, tick.Path, cas) } }
func removeMember(p paxos.Proposer, g store.Getter, name string) { k := "/doozer/members/" + name _, cas := g.Get(k) if cas != store.Missing { paxos.Del(p, k, cas) } }
func del(c *conn, _ uint, data interface{}) interface{} { r := data.(*proto.ReqDel) err := paxos.Del(c.s.Mg, r.Path, r.Cas) if err != nil { return err } return Ok }
func removeInfo(p paxos.Proposer, g store.Getter, name string) { ch, err := store.Walk(g, "/doozer/info/"+name+"/**") if err != nil { panic(err) } for ev := range ch { paxos.Del(p, ev.Path, ev.Cas) } }
func Clean(st *store.Store, pp paxos.Proposer) { logger := util.NewLogger("lock") for ev := range st.Watch("/session/*") { if !ev.IsDel() { continue } parts := strings.Split(ev.Path, "/", 3) name := parts[2] logger.Printf("lost session %s", name) ch, err := store.Walk(ev, "/lock/**") if err != nil { continue } for ev := range ch { if ev.Body == name { paxos.Del(pp, ev.Path, ev.Cas) } } } }