Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
7ffbe6ae
Commit
7ffbe6ae
authored
May 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
798f7dc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
wcfs/pptreesubset.go
wcfs/pptreesubset.go
+9
-9
No files found.
wcfs/pptreesubset.go
View file @
7ffbe6ae
...
@@ -45,7 +45,7 @@ import (
...
@@ -45,7 +45,7 @@ import (
//
//
// XXX ΔPPTreeSubSet
// 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
type
PPTreeSubSet
map
[
zodb
.
Oid
]
*
nodeInTree
// nodeInTree represents tracking information about a node.
// nodeInTree represents tracking information about a node.
...
@@ -116,8 +116,8 @@ func (δ *ΔPPTreeSubSet) Reverse() {
...
@@ -116,8 +116,8 @@ func (δ *ΔPPTreeSubSet) Reverse() {
}
}
// verify
verifies internal consistency of tidx
.
// verify
checks internal consistency of S
.
func
(
tidx
PPTreeSubSet
)
verify
()
{
func
(
S
PPTreeSubSet
)
verify
()
{
// XXX !debug -> return
// XXX !debug -> return
var
badv
[]
string
var
badv
[]
string
...
@@ -126,18 +126,18 @@ func (tidx PPTreeSubSet) verify() {
...
@@ -126,18 +126,18 @@ func (tidx PPTreeSubSet) verify() {
}
}
defer
func
()
{
defer
func
()
{
if
badv
!=
nil
{
if
badv
!=
nil
{
emsg
:=
fmt
.
Sprintf
(
"
tidx
.verify: fail:
\n\n
"
)
emsg
:=
fmt
.
Sprintf
(
"
S
.verify: fail:
\n\n
"
)
for
_
,
bad
:=
range
badv
{
for
_
,
bad
:=
range
badv
{
emsg
+=
fmt
.
Sprintf
(
"- %s
\n
"
,
bad
)
emsg
+=
fmt
.
Sprintf
(
"- %s
\n
"
,
bad
)
}
}
emsg
+=
fmt
.
Sprintf
(
"
\n
tidx: %s
\n
"
,
tidx
)
emsg
+=
fmt
.
Sprintf
(
"
\n
S: %s
\n
"
,
S
)
panic
(
emsg
)
panic
(
emsg
)
}
}
}()
}()
// recompute {} oid -> children and verify .nchild against it
// recompute {} oid -> children and verify .nchild against it
children
:=
map
[
zodb
.
Oid
]
SetOid
{}
children
:=
map
[
zodb
.
Oid
]
SetOid
{}
for
oid
,
t
:=
range
tidx
{
for
oid
,
t
:=
range
S
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
cc
,
ok
:=
children
[
t
.
parent
]
cc
,
ok
:=
children
[
t
.
parent
]
if
!
ok
{
if
!
ok
{
...
@@ -148,16 +148,16 @@ func (tidx PPTreeSubSet) verify() {
...
@@ -148,16 +148,16 @@ func (tidx PPTreeSubSet) verify() {
}
}
}
}
for
oid
,
t
:=
range
tidx
{
for
oid
,
t
:=
range
S
{
cc
:=
children
[
oid
]
cc
:=
children
[
oid
]
if
t
.
nchild
!=
len
(
cc
)
{
if
t
.
nchild
!=
len
(
cc
)
{
badf
(
"[%s].nchild=%d children: %s"
,
oid
,
t
.
nchild
,
cc
)
badf
(
"[%s].nchild=%d children: %s"
,
oid
,
t
.
nchild
,
cc
)
}
}
}
}
// verify that all pointed-to parents are present in t
idx
// verify that all pointed-to parents are present in t
he set (= PP-connected)
for
oid
:=
range
children
{
for
oid
:=
range
children
{
_
,
ok
:=
tidx
[
oid
]
_
,
ok
:=
S
[
oid
]
if
!
ok
{
if
!
ok
{
badf
(
"oid %s is pointed to via some .parent, but is not present in the set"
,
oid
)
badf
(
"oid %s is pointed to via some .parent, but is not present in the set"
,
oid
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment