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
82fd3e37
Commit
82fd3e37
authored
Jun 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
115a4866
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
10 deletions
+37
-10
wcfs/δbtail.go
wcfs/δbtail.go
+37
-10
No files found.
wcfs/δbtail.go
View file @
82fd3e37
...
...
@@ -542,7 +542,7 @@ func (rs rangeSplit) Get_(k Key) (rnode *nodeInRange, ok bool) {
// rnode.node must be tree.
// rnode.node must be aleady activated.
//
// inserted children is also return for convenience.
// inserted children is also return
ed
for convenience.
func
(
prs
*
rangeSplit
)
Expand
(
rnode
*
nodeInRange
)
(
children
rangeSplit
)
{
rs
:=
*
prs
i
:=
sort
.
Search
(
len
(
rs
),
func
(
i
int
)
bool
{
...
...
@@ -577,6 +577,33 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
return
children
}
// GetToBucket returns bucket corresponding to key k.
// While reaching to that bucket, it expands step-by-step trees that are leading to that bucket.
// XXX also return path?
func
(
prs
*
rangeSplit
)
GetToBucket
(
ctx
,
k
)
(
rbucket
*
nodeInRange
,
bool
ok
,
err
error
)
{
rnode
,
ok
:=
prs
.
Get_
(
k
)
if
!
ok
{
return
nil
,
false
,
nil
// key not covered
}
for
{
switch
rnode
.
node
.
(
type
)
{
case
*
Bucket
:
return
rnode
,
true
,
nil
}
// it's tree
err
=
rnode
.
node
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
nil
,
false
,
err
}
defer
rnode
.
node
.
PDeactivate
()
children
:=
prs
.
Expand
(
rnode
)
rnode
=
children
.
Get
(
k
)
// k must be there
}
}
func
(
rs
rangeSplit
)
String
()
string
{
s
:=
""
for
_
,
rn
:=
range
rs
{
...
...
@@ -749,21 +776,21 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
btop
:=
&
nodeInRange
{
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
b
}
// [-∞, ∞)
bv
=
rangeSplit
{
btop
}
}
bq
:=
[]
*
nodeInRange
{
...
}
for
k
:=
range
Bkeysq
{
b
node
,
ok
:=
bv
.
Get_
(
k
)
b
bucket
,
ok
,
err
:=
bv
.
GetToBucket
(
ctx
,
k
)
if
!
ok
{
continue
// key not covered
}
for
{
switch
bnode
.
node
.
(
type
)
{
case
*
Tree
:
err
:=
bnode
.
node
.
PActivate
(
ctx
);
X
(
err
)
defer
bnode
.
node
.
PDeactivate
()
bbucket
.
node
.
(
*
Bucket
)
δB
,
err
:=
diffB
(
ctx
,
nil
,
bbucket
.
node
.
(
*
Bucket
))
if
err
!=
nil
{
return
nil
,
err
}
case
*
Bucket
:
btree
,
ok
:=
bnode
.
node
.
(
*
Tree
// XXX δ <- δB
for
k
,
δv
:=
range
δ
{
//
}
}
...
...
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