Exemple #1
0
func waitFor(cl *doozer.Conn, path string) {
	var rev int64
	for {
		ev, err := cl.Wait(path, rev)
		if err != nil {
			panic(err)
		}
		if ev.IsSet() && len(ev.Body) > 0 {
			break
		}
		rev = ev.Rev + 1
	}
}
Exemple #2
0
func follow(st *store.Store, cl *doozer.Conn, rev int64, stop chan bool) {
	for {
		ev, err := cl.Wait("/**", rev)
		if err != nil {
			panic(err)
		}

		// store.Clobber is okay here because the event
		// has already passed through another store
		mut := store.MustEncodeSet(ev.Path, string(ev.Body), store.Clobber)
		st.Ops <- store.Op{ev.Rev, mut}
		rev = ev.Rev + 1

		select {
		case <-stop:
			return
		default:
		}
	}
}