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
1e985a6c
Commit
1e985a6c
authored
Jul 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
11c95175
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
19 deletions
+25
-19
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+25
-19
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
1e985a6c
...
...
@@ -67,21 +67,22 @@ type Δstring = xbtreetest.Δstring
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
func
(
rbs
xbtreetest
.
RBucketSet
)
trackSet
(
tracked
setKey
)
blib
.
PPTreeSubSet
{
// XXX was method -> change name?
func
trackSet
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
blib
.
PPTreeSubSet
{
// nil = don't compute keyCover
// (trackSet is called from inside hot inner loop of rebuild test)
trackSet
:=
rbs
.
_trackSetWithCov
(
tracked
,
nil
)
trackSet
:=
_trackSetWithCov
(
rbs
,
tracked
,
nil
)
return
trackSet
}
// trackSetWithCov returns what should be ΔBtail.trackSet and its key coverage for specified tracked key set.
func
(
rbs
xbtreetest
.
RBucketSet
)
trackSetWithCov
(
tracked
setKey
)
(
trackSet
blib
.
PPTreeSubSet
,
keyCover
*
blib
.
RangedKeySet
)
{
func
trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
(
trackSet
blib
.
PPTreeSubSet
,
keyCover
*
blib
.
RangedKeySet
)
{
keyCover
=
&
blib
.
RangedKeySet
{}
trackSet
=
rbs
.
_trackSetWithCov
(
tracked
,
keyCover
)
trackSet
=
_trackSetWithCov
(
rbs
,
tracked
,
keyCover
)
return
trackSet
,
keyCover
}
func
(
rbs
xbtreetest
.
RBucketSet
)
_trackSetWithCov
(
tracked
setKey
,
outKeyCover
*
blib
.
RangedKeySet
)
(
trackSet
blib
.
PPTreeSubSet
)
{
func
_trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
,
outKeyCover
*
blib
.
RangedKeySet
)
(
trackSet
blib
.
PPTreeSubSet
)
{
trackSet
=
blib
.
PPTreeSubSet
{}
for
k
:=
range
tracked
{
kb
:=
rbs
.
Get
(
k
)
...
...
@@ -92,41 +93,46 @@ func (rbs xbtreetest.RBucketSet) _trackSetWithCov(tracked setKey, outKeyCover *b
// embedded buckets all have oid=zodb.InvalidOid and would lead to z
newNode
:=
false
if
kb
.
Oid
!=
zodb
.
InvalidOid
{
track
,
already
:=
trackSet
[
kb
.
oid
]
trackSet
.
AddPath
(
kb
.
Path
())
/*
track, already := trackSet[kb.Oid]
if !already {
track
=
&
nodeInTree
{
parent
:
kb
.
parent
.
oid
,
nchild
:
0
}
trackSet
[
kb
.
o
id
]
=
track
track = &
blib.
nodeInTree{parent: kb.parent.oid, nchild: 0}
trackSet[kb.
O
id] = track
newNode = true
}
if
track
.
parent
!=
kb
.
parent
.
o
id
{
panicf
(
"BUG: %s: B%s -> multiple parents: %s %s"
,
rbs
.
coverage
(),
kb
.
oid
,
track
.
parent
,
kb
.
parent
.
o
id
)
if track.parent != kb.
Parent.O
id {
panicf("BUG: %s: B%s -> multiple parents: %s %s", rbs.coverage(), kb.
Oid, track.parent, kb.Parent.O
id)
}
*/
}
p
:=
kb
.
parent
/*
p := kb.Parent
for p != nil {
ppoid := zodb.InvalidOid // oid of p.parent
if
p
.
p
arent
!=
nil
{
ppoid
=
p
.
parent
.
o
id
if p.
P
arent != nil {
ppoid = p.
Parent.O
id
}
newParent := false
pt
,
already
:=
trackSet
[
p
.
o
id
]
pt, already := trackSet[p.
O
id]
if !already {
pt = &nodeInTree{parent: ppoid, nchild: 0}
trackSet
[
p
.
o
id
]
=
pt
trackSet[p.
O
id] = pt
newParent = true
}
if pt.parent != ppoid {
panicf
(
"BUG: %s: T%s -> multiple parents: %s %s"
,
rbs
.
coverage
(),
p
.
o
id
,
pt
.
parent
,
ppoid
)
panicf("BUG: %s: T%s -> multiple parents: %s %s", rbs.coverage(), p.
O
id, pt.parent, ppoid)
}
if newNode {
pt.nchild++
}
newNode = newParent
p
=
p
.
p
arent
p = p.
P
arent
}
*/
}
return
trackSet
}
...
...
@@ -452,8 +458,8 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// trackSet1 = xkv1[tracked1]
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
trackSet1
,
tkeyCov1
:=
t
1
.
xkv
.
trackSetWithCov
(
initialTrackedKeys
)
trackSet2
,
tkeyCov2
:=
t
2
.
xkv
.
trackSetWithCov
(
initialTrackedKeys
.
Union
(
kadjTrackedδZ
))
trackSet1
,
tkeyCov1
:=
t
rackSetWithCov
(
t1
.
xkv
,
initialTrackedKeys
)
trackSet2
,
tkeyCov2
:=
t
rackSetWithCov
(
t2
.
xkv
,
initialTrackedKeys
.
Union
(
kadjTrackedδZ
))
// verify δbtail.trackSet against @at1
δbtail
.
assertTrack
(
t
,
"1"
,
ø
,
trackSet1
)
...
...
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