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
eac5d619
Commit
eac5d619
authored
Sep 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2d71c2ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
wcfs/δbtail.go
wcfs/δbtail.go
+4
-1
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+15
-12
No files found.
wcfs/δbtail.go
View file @
eac5d619
...
...
@@ -285,7 +285,10 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
// path[0] signifies tree root.
// All path elements must be Tree except last one which must be Bucket.
//
// δBtail will also track all keys corresponding to added bucket nodes. XXX
// Besides key (which might point to value or hole), δBtail will also track all
// keys residing in tracked leaf nodes. In particular after request for KeyMax or
// KeyMin to be tracked, δBtail will keep on tracking changes to maximum or
// minimum keys correspondingly.
//
// XXX objects in path must be with .PJar().At() == .head
// XXX path -> []oid ?
...
...
wcfs/δbtail_test.go
View file @
eac5d619
...
...
@@ -270,11 +270,12 @@ func (tg *AllStructsSrv) AllStructs(kv1, kv2 map[Key]string, maxdepth, maxsplit,
}
// RBucket represents Bucket node covering [lo, hi) key range in its Tree.
// 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)
lo
,
hi
Key
kv
map
[
Key
]
string
// bucket's k->v; values were ZBlk objects whose data is loaded instead.
lo
,
hi
_
Key
kv
map
[
Key
]
string
// bucket's k->v; values were ZBlk objects whose data is loaded instead.
}
// RBucketSet represents set of buckets covering whole [-∞,∞) range.
...
...
@@ -284,15 +285,15 @@ type RBucketSet []*RBucket // k↑
// Get returns RBucket which covers key k.
func
(
rbs
RBucketSet
)
Get
(
k
Key
)
*
RBucket
{
i
:=
sort
.
Search
(
len
(
rbs
),
func
(
i
int
)
bool
{
return
k
<
rbs
[
i
]
.
hi
return
k
<
=
rbs
[
i
]
.
hi_
})
if
i
==
len
(
rbs
)
{
panicf
(
"BUG: key %v not covered; coverage: %s"
,
k
,
rbs
.
coverage
())
}
rb
:=
rbs
[
i
]
if
!
(
rb
.
lo
<=
k
&&
k
<
rb
.
hi
)
{
panicf
(
"BUG: get(%v) -> [%v, %v
); coverage: %s"
,
k
,
rb
.
lo
,
rb
.
hi
,
rbs
.
coverage
())
if
!
(
rb
.
lo
<=
k
&&
k
<
=
rb
.
hi_
)
{
panicf
(
"BUG: get(%v) -> [%v, %v
]; coverage: %s"
,
k
,
rb
.
lo
,
rb
.
hi_
,
rbs
.
coverage
())
}
return
rb
...
...
@@ -308,7 +309,7 @@ func (rbs RBucketSet) coverage() string {
if
s
!=
""
{
s
+=
" "
}
s
+=
fmt
.
Sprintf
(
"[%v, %v
)"
,
rb
.
lo
,
rb
.
hi
)
s
+=
fmt
.
Sprintf
(
"[%v, %v
]"
,
rb
.
lo
,
rb
.
hi_
)
}
return
s
}
...
...
@@ -345,7 +346,7 @@ func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) RBucketSet {
}
// 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
))
{
func
xwalkDFS
(
ctx
context
.
Context
,
lo
,
hi
_
Key
,
ztree
*
Tree
,
bvisit
func
(
*
RBucket
))
{
X
:=
exc
.
Raiseif
err
:=
ztree
.
PActivate
(
ctx
);
X
(
err
)
...
...
@@ -357,12 +358,12 @@ func xwalkDFS(ctx context.Context, lo, hi Key, ztree *Tree, bvisit func(*RBucket
// [len(ev)].Key = +∞ ; should be assumed so
ev
:=
ztree
.
Entryv
()
for
i
:=
range
ev
{
xlo
:=
lo
;
if
i
>
0
{
xlo
=
ev
[
i
]
.
Key
()
}
xhi
:=
hi
;
if
i
+
1
<
len
(
ev
)
{
xhi
=
ev
[
i
+
1
]
.
Key
()
}
xlo
:=
lo
;
if
i
>
0
{
xlo
=
ev
[
i
]
.
Key
()
}
xhi
_
:=
hi_
;
if
i
+
1
<
len
(
ev
)
{
xhi_
=
ev
[
i
+
1
]
.
Key
()
-
1
}
tchild
,
ok
:=
ev
[
i
]
.
Child
()
.
(
*
Tree
)
if
ok
{
xwalkDFS
(
ctx
,
xlo
,
xhi
,
tchild
,
bvisit
)
xwalkDFS
(
ctx
,
xlo
,
xhi
_
,
tchild
,
bvisit
)
continue
}
...
...
@@ -386,7 +387,7 @@ func xwalkDFS(ctx context.Context, lo, hi Key, ztree *Tree, bvisit func(*RBucket
}
bvisit
(
&
RBucket
{
xlo
,
xhi
,
bkv
})
bvisit
(
&
RBucket
{
xlo
,
xhi
_
,
bkv
})
}
}
...
...
@@ -459,10 +460,12 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
k1
:=
k
k2
:=
k
/*
if k == kInf { // XXX not needed? - kill?
k1 = maxk1
k2 = maxk2
}
*/
q1
:=
[]
Key
{
k1
}
q2
:=
[]
Key
{
k2
}
...
...
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