Commit 41a21d20 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0c3f0e6a
......@@ -1307,16 +1307,39 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
return fmt.Errorf("at is too far away back from head/at")
}
toPin := SetI64{} // f's blocks that have been changed after at
toPin := map[int64]zodb.Tid // blk -> @rev
// XXX f.δtail.Head() not neccessarily = head.At()
// (if f was not changed by a txn, f.δtail stays not updated) XXX correct?
f.δtail.SliceByRev(at, f.δtail.Head())
//
// FIXME (!!!) since f.δtail does not have all changes to f, here we
// can be missing some pins we should be sending. (see wcfs_test.py for details)
for _, δ := range f.δtail.SliceByRev(at, f.δtail.Head()) {
for _, blk := range δ.Changev {
_, already := toPin[blk]
if already {
continue
}
// FIXME (!!!) again f.δtail can miss some entries
toPin[blk], _ = f.δtail.LastRevOf(blk, at)
}
}
wg, ctx := errgroup.WithContext(ctx)
for blk, rev := range toPin {
blk := blk
rev := rev
wg.Go(func() error {
return wlink.pin(ctx, blk, rev)
})
}
err = wg.Wait()
if err != nil {
panic(err) // XXX
}
panic("TODO")
// XXX something else?
}
// Open serves /head/watch opens.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment