func (ch Chg) applyData(lfs zx.RWTree, rfs zx.Tree) error { nd := ch.D.UsrAttrs() for _, k := range ignoredPutAttrs { delete(nd, k) } datc := rfs.Get(ch.D["path"], 0, zx.All, "") dc := lfs.Put(ch.D["path"], nd, 0, datc, "") <-dc return cerror(dc) }
// returns true if the caller must poll itself rfs for changes func newInvalQ(tag string, dbgf *bool, rfs zx.Tree) (*invalQ, bool) { iq := &invalQ{ Tag: tag, Dbg: dbgf, cchgc: make(chan bool, 1), rfs: rfs, invalsc: make(chan bool, 1), } go iq.postinvalproc() if rfs == nil { return iq, false } // Use /Chg from rfs or poll rfs it if there's no other way. dc := rfs.Get("/Chg", 0, zx.All, "") msg := <-dc if len(msg) == 0 { dbg.Warn("no invalidations: %s", cerror(dc)) return iq, true } go iq.getinvalproc(dc) return iq, false }