Commit 8ebcb0bb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ace9b05b
...@@ -238,15 +238,20 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -238,15 +238,20 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
δBtail.δZtail.Append(δZ.Tid, δZ.Changev) δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
// {} root -> []oid changed under that root in tracked set // {} root -> {oid} changed under that root in tracked set
δZByRoot := map[zodb.Oid][]zodb.Oid{} // XXX -> map[*Tree]SetOid ? δZByRoot := map[zodb.Oid]SetOid{}
for _, oid := range δZ.Changev { for _, oid := range δZ.Changev {
roots, ok := δBtail.trackIdx[oid] roots, ok := δBtail.trackIdx[oid]
if !ok { if !ok {
continue continue
} }
for root := range roots { for root := range roots {
δZByRoot[root] = append(δZByRoot[root], oid) δZT, ok := δZByRoot[root]
if !ok {
δZT = SetOid{}
δZByRoot[root] = δZT
}
δZT.Add(oid)
} }
} }
...@@ -270,17 +275,15 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -270,17 +275,15 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
return ΔB{}, err return ΔB{}, err
} }
_ = zconnOld for root, δZT := range δZByRoot {
_ = zconnNew δT, err := δBtail.treediff(ctx, root, δZT, zconnOld, zconnNew)
if err != nil {
return ΔB{}, err
}
for root := range δZByRoot { if len(δT) > 0 { // an object might be resaved without change
δT, ok := δB.ByRoot[root]
if !ok {
δT = map[Key]Value{}
δB.ByRoot[root] = δT δB.ByRoot[root] = δT
} }
// XXX stub to get file.size invalidation working
// TODO update δT
} }
return δB, nil return δB, nil
...@@ -304,6 +307,16 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -304,6 +307,16 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
*/ */
} }
// treediff computes δT for tree specified by root in between old..new.
//
// XXX only for tracked
// δZT is δZ/T - subset of δZ touching nodes of T.
func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNew *zodb.Connection) (δT map[Key]Value, err error) {
defer xerr.Contextf(&err, "treediff %s", root)
return nil, nil // XXX stub
}
func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) { func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
......
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