Commit 3604f4a5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e1f69447
...@@ -126,19 +126,7 @@ func (S PPTreeSubSet) Path(oid zodb.Oid) (path []zodb.Oid) { ...@@ -126,19 +126,7 @@ func (S PPTreeSubSet) Path(oid zodb.Oid) (path []zodb.Oid) {
return path return path
} }
// XXX doc // AddPath adds path to a node to the set.
func (S PPTreeSubSet) AddNodePath(path []Node) { // XXX Tree|Bucket; path[0] = root
// XXX assert Tree Tree ... Tree Bucket
// root := path[0].(*Tree).POid()
oidv := []zodb.Oid{}
for _, node := range path {
oidv = append(oidv, node.POid())
}
S.AddPath(oidv)
}
// XXX doc
func (S PPTreeSubSet) AddPath(path []zodb.Oid) { func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
S.verify() S.verify()
defer S.verify() defer S.verify()
...@@ -176,7 +164,7 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) { ...@@ -176,7 +164,7 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
// XXX .trackNew += oid // XXX .trackNew += oid
} }
if track.parent != parent { if track.parent != parent {
// XXX -> error (e.g. due to corrupt data in ZODB) // XXX -> error (e.g. due to corrupt data in ZODB) ?
panicf("node %s is reachable from multiple parents: %s %s", panicf("node %s is reachable from multiple parents: %s %s",
oid, track.parent, parent) oid, track.parent, parent)
} }
...@@ -190,6 +178,19 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) { ...@@ -190,6 +178,19 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
} }
} }
// AddNodePath is a convenience wrapper to call AddPath starting from Nodes instead of Oids.
func (S PPTreeSubSet) AddNodePath(path []Node) { // XXX Tree|Bucket; path[0] = root
// XXX assert Tree Tree ... Tree Bucket
// root := path[0].(*Tree).POid()
oidv := []zodb.Oid{}
for _, node := range path {
oidv = append(oidv, node.POid())
}
S.AddPath(oidv)
}
// ---- Union/Difference ---- // ---- Union/Difference ----
......
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