Commit bc1b465f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 57b00793
......@@ -233,6 +233,11 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
panic("empty path")
}
treeRoot := path[0].(*Tree)
var leafBucket *Bucket
if l := len(path); l > 1 {
leafBucket = path[l-1].(*Bucket)
}
// XXX assert Tree Tree ... Tree Bucket
root := treeRoot.POid()
......@@ -241,11 +246,13 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
fmt.Printf("Track %v\n", oidv)
parent := zodb.InvalidOid
var track nodeTrack
var oldTrack bool
for _, node := range path {
oid := node.POid()
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
track, ok := δBtail.trackIdx[oid]
if !ok {
track, oldTrack = δBtail.trackIdx[oid]
if !oldTrack {
track = nodeTrack{parent: parent, trackedKeys: SetKey{}}
δBtail.trackIdx[oid] = track
// XXX .trackNew += oid
......@@ -256,12 +263,27 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
oid, track.parent, parent)
}
if track.trackedKeys != nil { // root always covers [-∞, ∞)
// XXX add all keys of leaf bucket XXX for bucket _and_ back for parents
track.trackedKeys.Add(key)
}
parent = oid
}
// tracked += all keys of leaf bucket for every node up to the root
if !oldTrack && leafBucket != nil {
bkeys := SetKey{}
for _, __ := range leafBucket.Entryv() {
bkeys.Add(__.Key())
}
for {
track.trackedKeys.Update(bkeys)
if track.parent == zodb.InvalidOid {
break
}
track = δBtail.trackIdx[track.parent]
}
}
_, ok := δBtail.byRoot[root]
if !ok {
δBtail.byRoot[root] = newΔTtail()
......
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