Commit 7ffbe6ae authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 798f7dc6
......@@ -45,7 +45,7 @@ import (
//
// XXX ΔPPTreeSubSet
//
// Every node in the set also has .parent pointer.
// Every node in the set also has .parent pointer. XXX
type PPTreeSubSet map[zodb.Oid]*nodeInTree
// nodeInTree represents tracking information about a node.
......@@ -116,8 +116,8 @@ func (δ *ΔPPTreeSubSet) Reverse() {
}
// verify verifies internal consistency of tidx.
func (tidx PPTreeSubSet) verify() {
// verify checks internal consistency of S.
func (S PPTreeSubSet) verify() {
// XXX !debug -> return
var badv []string
......@@ -126,18 +126,18 @@ func (tidx PPTreeSubSet) verify() {
}
defer func() {
if badv != nil {
emsg := fmt.Sprintf("tidx.verify: fail:\n\n")
emsg := fmt.Sprintf("S.verify: fail:\n\n")
for _, bad := range badv {
emsg += fmt.Sprintf("- %s\n", bad)
}
emsg += fmt.Sprintf("\ntidx: %s\n", tidx)
emsg += fmt.Sprintf("\nS: %s\n", S)
panic(emsg)
}
}()
// recompute {} oid -> children and verify .nchild against it
children := map[zodb.Oid]SetOid{}
for oid, t := range tidx {
for oid, t := range S {
if t.parent != zodb.InvalidOid {
cc, ok := children[t.parent]
if !ok {
......@@ -148,16 +148,16 @@ func (tidx PPTreeSubSet) verify() {
}
}
for oid, t := range tidx {
for oid, t := range S {
cc := children[oid]
if t.nchild != len(cc) {
badf("[%s].nchild=%d children: %s", oid, t.nchild, cc)
}
}
// verify that all pointed-to parents are present in tidx
// verify that all pointed-to parents are present in the set (= PP-connected)
for oid := range children {
_, ok := tidx[oid]
_, ok := S[oid]
if !ok {
badf("oid %s is pointed to via some .parent, but is not present in the set", oid)
}
......
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