Commit d4848186 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1a0cfd54
......@@ -44,9 +44,7 @@ const debugPPSet = false
// Nodes can be added into the set via AddPath. Path is reverse operation - it
// returns path to tree node given node oid.
//
// XXX ΔPPTreeSubSet
//
// Every node in the set also has .parent pointer. XXX
// Every node in the set comes with .parent pointer.
type PPTreeSubSet map[zodb.Oid]*nodeInTree
// nodeInTree represents tracking information about a node.
......@@ -57,7 +55,7 @@ type nodeInTree struct {
}
// Path returns path leading to node specified by oid.
// Path returns path leading to the node specified by oid.
//
// The node must be in the set.
func (S PPTreeSubSet) Path(oid zodb.Oid) (path []zodb.Oid) {
......@@ -96,37 +94,29 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
}
parent := zodb.InvalidOid
var ptrack *nodeInTree = nil
var track *nodeInTree // XXX kill here
var oldTrack bool
var pt *nodeInTree = nil
for _, oid := range path {
if oid == zodb.InvalidOid {
panicf("path has node with invalid oid: %v", path)
}
track, oldTrack = S[oid]
if !oldTrack {
track = &nodeInTree{parent: parent, nchild: 0} // XXX
/*
if i == l-1 { // leaf
track.holes = SetKey{}
}
*/
S[oid] = track
// XXX .trackNew += oid
t, already := S[oid]
if !already {
t = &nodeInTree{parent: parent, nchild: 0}
S[oid] = t
}
if track.parent != parent {
if t.parent != parent {
// XXX -> error (e.g. due to corrupt data in ZODB) ?
panicf("node %s is reachable from multiple parents: %s %s",
oid, track.parent, parent)
oid, t.parent, parent)
}
if ptrack != nil && !oldTrack {
ptrack.nchild++
if pt != nil && !already {
pt.nchild++
}
parent = oid
ptrack = track
pt = t
}
}
......
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