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
6e933964
Commit
6e933964
authored
Sep 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fab28d10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
+31
-5
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+31
-5
No files found.
wcfs/δbtail_test.go
View file @
6e933964
...
...
@@ -269,11 +269,18 @@ func (tg *AllStructsSrv) AllStructs(kv1, kv2 map[Key]string, maxdepth, maxsplit,
}
// RTree represents Tree node covering [lo, hi_] key range in its parent tree.
type
RTree
struct
{
oid
Oid
parent
*
RTree
// XXX +children?
}
// RBucket represents Bucket node covering [lo, hi_] key range in its Tree.
// NOTE it is not [lo,hi) but [lo,hi_] instead to avoid overflow at KeyMax.
type
RBucket
struct
{
// XXX +oid, +parent (RTree)
oid
Oid
parent
*
RTree
lo
,
hi_
Key
kv
map
[
Key
]
string
// bucket's k->v; values were ZBlk objects whose data is loaded instead.
}
...
...
@@ -340,18 +347,34 @@ func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) RBucketSet {
rbucketv
=
append
(
rbucketv
,
rb
)
})
if
len
(
rbucketv
)
==
0
{
// empty tree -> [-∞, ∞){}
rbucketv
=
RBucketSet
{
&
RBucket
{
-
kInf
,
kInf
,
map
[
Key
]
string
{}}}
etree
:=
&
RTree
{
oid
:
zodb
.
InvalidOid
,
parent
:
nil
,
}
ebucket
:=
&
RBucket
{
oid
:
zodb
.
InvalidOid
,
parent
:
etree
,
lo
:
-
kInf
,
hi_
:
kInf
,
kv
:
map
[
Key
]
string
{},
}
rbucketv
=
RBucketSet
{
ebucket
}
}
return
rbucketv
}
// xwalkDFS walks ztree in depth-first order emitting bvisit callback on visited bucket nodes.
func
xwalkDFS
(
ctx
context
.
Context
,
lo
,
hi_
Key
,
ztree
*
Tree
,
bvisit
func
(
*
RBucket
))
{
_xwalkDFS
(
ctx
,
lo
,
hi_
,
ztree
,
/*rparent*/
nil
,
bvisit
)
}
func
_xwalkDFS
(
ctx
context
.
Context
,
lo
,
hi_
Key
,
ztree
*
Tree
,
rparent
*
RTree
,
bvisit
func
(
*
RBucket
))
{
X
:=
exc
.
Raiseif
err
:=
ztree
.
PActivate
(
ctx
);
X
(
err
)
defer
ztree
.
PDeactivate
()
rtree
:=
&
RTree
{
oid
:
ztree
.
POid
(),
parent
:
rparent
}
// [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([]))
//
// [0].Key = -∞ ; always returned so
...
...
@@ -363,7 +386,7 @@ func xwalkDFS(ctx context.Context, lo, hi_ Key, ztree *Tree, bvisit func(*RBucke
tchild
,
ok
:=
ev
[
i
]
.
Child
()
.
(
*
Tree
)
if
ok
{
xwalkDFS
(
ctx
,
xlo
,
xhi_
,
tchild
,
bvisit
)
_xwalkDFS
(
ctx
,
xlo
,
xhi_
,
tchild
,
rparent
,
bvisit
)
continue
}
...
...
@@ -387,7 +410,8 @@ func xwalkDFS(ctx context.Context, lo, hi_ Key, ztree *Tree, bvisit func(*RBucke
}
bvisit
(
&
RBucket
{
xlo
,
xhi_
,
bkv
})
b
:=
&
RBucket
{
oid
:
zbucket
.
POid
(),
parent
:
rtree
,
lo
:
xlo
,
hi_
:
xhi_
,
kv
:
bkv
}
bvisit
(
b
)
}
}
...
...
@@ -603,7 +627,9 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
badf
(
"δbtail.holeIdx1 wrong ; holeIdx=%v holeIdxOK=%v"
,
δbtail
.
holeIdx
,
holes1
)
}
// XXX verify δbtail trackIdx against @at1
// verify δbtail.trackIdx against @at1
// tracked1 = ... XXX
// δB <- δZ
δB
,
err
:=
δbtail
.
Update
(
δZ
);
X
(
err
)
...
...
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