Commit 5eb50c5f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6d77591b
......@@ -257,7 +257,9 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
panicf("node %s is reachable from multiple parents: %s %s",
oid, track.parent, parent)
}
if track.trackedKeys != nil { // root always covers [-∞, ∞)
track.trackedKeys.Add(key)
}
parent = oid
}
......@@ -297,13 +299,26 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
fmt.Printf("trackIdx: %v\n", δBtail.trackIdx)
// {} root -> {oid} changed under that root in tracked set
rootOf := func(node zodb.Oid) (root zodb.Oid, ok bool) {
track, ok := δBtail.trackIdx[node]
if !ok {
return zodb.InvalidOid, false
}
for track.parent != zodb.InvalidOid {
node = track.parent
track = δBtail.trackIdx[node] // must be present
}
return node, true
}
δZByRoot := map[zodb.Oid]SetOid{}
for _, oid := range δZ.Changev {
roots, ok := δBtail.trackIdx[oid]
root, ok := rootOf(oid)
if !ok {
continue
}
for root := range roots {
δZT, ok := δZByRoot[root]
if !ok {
δZT = SetOid{}
......@@ -311,7 +326,6 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
}
δZT.Add(oid)
}
}
fmt.Println("δZByRoot:", δZByRoot)
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]ΔValue)}
......
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