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
21bd85f5
Commit
21bd85f5
authored
Jun 03, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9b023909
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
61 deletions
+89
-61
wcfs/internal/xbtree/rangeset.go
wcfs/internal/xbtree/rangeset.go
+6
-0
wcfs/internal/xbtree/rangeset_test.go
wcfs/internal/xbtree/rangeset_test.go
+9
-9
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+74
-52
No files found.
wcfs/internal/xbtree/rangeset.go
View file @
21bd85f5
...
@@ -377,6 +377,12 @@ func (S *RangedKeySet) Clear() {
...
@@ -377,6 +377,12 @@ func (S *RangedKeySet) Clear() {
S
.
rangev
=
nil
S
.
rangev
=
nil
}
}
// AllRanges returns slice of all key ranges in the set.
// XXX -> iter?
func
(
S
*
RangedKeySet
)
AllRanges
()
/*readonly*/
[]
KeyRange
{
return
S
.
rangev
}
func
(
S
RangedKeySet
)
String
()
string
{
func
(
S
RangedKeySet
)
String
()
string
{
s
:=
"{"
s
:=
"{"
for
i
,
r
:=
range
S
.
rangev
{
for
i
,
r
:=
range
S
.
rangev
{
...
...
wcfs/internal/xbtree/rangeset_test.go
View file @
21bd85f5
...
@@ -129,18 +129,18 @@ func TestRangedKeySet(t *testing.T) {
...
@@ -129,18 +129,18 @@ func TestRangedKeySet(t *testing.T) {
t
.
Errorf
(
"Difference:
\n
A: %s
\n
B: %s
\n
->d: %s
\n
okD: %s
\n
"
,
tt
.
A
,
tt
.
B
,
D
,
tt
.
Difference
)
t
.
Errorf
(
"Difference:
\n
A: %s
\n
B: %s
\n
->d: %s
\n
okD: %s
\n
"
,
tt
.
A
,
tt
.
B
,
D
,
tt
.
Difference
)
}
}
// HasRange
XXX use AllRanges instead of direct .rangev access
// HasRange
assertHasRange
(
t
,
A
.
rangev
,
A
,
true
)
assertHasRange
(
t
,
A
.
AllRanges
()
,
A
,
true
)
assertHasRange
(
t
,
B
.
rangev
,
B
,
true
)
assertHasRange
(
t
,
B
.
AllRanges
()
,
B
,
true
)
assertHasRange
(
t
,
A
.
rangev
,
U
,
true
)
assertHasRange
(
t
,
A
.
AllRanges
()
,
U
,
true
)
assertHasRange
(
t
,
B
.
rangev
,
U
,
true
)
assertHasRange
(
t
,
B
.
AllRanges
()
,
U
,
true
)
Dab
:=
D
Dab
:=
D
Dba
:=
B
.
Difference
(
A
)
Dba
:=
B
.
Difference
(
A
)
assertHasRange
(
t
,
Dab
.
rangev
,
A
,
true
)
assertHasRange
(
t
,
Dab
.
AllRanges
()
,
A
,
true
)
assertHasRange
(
t
,
Dab
.
rangev
,
B
,
false
)
assertHasRange
(
t
,
Dab
.
AllRanges
()
,
B
,
false
)
assertHasRange
(
t
,
Dba
.
rangev
,
B
,
true
)
assertHasRange
(
t
,
Dba
.
AllRanges
()
,
B
,
true
)
assertHasRange
(
t
,
Dba
.
rangev
,
A
,
false
)
assertHasRange
(
t
,
Dba
.
AllRanges
()
,
A
,
false
)
}
}
}
}
...
...
wcfs/internal/xbtree/treediff.go
View file @
21bd85f5
...
@@ -714,9 +714,12 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -714,9 +714,12 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
break
break
}
}
for
k
:=
range
Bkqueue
{
// for k := range Bkqueue {
b
,
err
:=
Bv
.
GetToLeaf
(
ctx
,
k
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
for
_
,
r
:=
range
Bkqueue
.
AllRanges
()
{
tracef
(
" B k%d -> %s
\n
"
,
k
,
b
)
lo
:=
r
.
lo
for
{
b
,
err
:=
Bv
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
tracef
(
" B k%d -> %s
\n
"
,
lo
,
b
)
// +bucket if that bucket is reached for the first time
// +bucket if that bucket is reached for the first time
if
!
b
.
done
{
if
!
b
.
done
{
var
δB
map
[
Key
]
ΔValue
var
δB
map
[
Key
]
ΔValue
...
@@ -743,15 +746,26 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -743,15 +746,26 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
b
.
done
=
true
b
.
done
=
true
}
}
// stop if r coverage is complete
if
r
.
hi_
<=
b
.
hi_
{
break
}
// continue with next right bucket
lo
=
b
.
hi_
+
1
}
// XXX k is not there -> hole XXX test XXX <- kill?
// XXX k is not there -> hole XXX test XXX <- kill?
}
}
Bkqueue
.
Clear
()
Bkqueue
.
Clear
()
tracef
(
"
\n
"
)
tracef
(
"
\n
"
)
tracef
(
" Akq: %s
\n
"
,
Akqueue
)
tracef
(
" Akq: %s
\n
"
,
Akqueue
)
for
k
:=
range
Akqueue
{
// for k := range Akqueue {
a
,
err
:=
Av
.
GetToLeaf
(
ctx
,
k
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
for
_
,
r
:=
range
Akqueue
.
AllRanges
()
{
tracef
(
" A k%d -> %s
\n
"
,
k
,
a
)
lo
:=
r
.
lo
for
{
a
,
err
:=
Av
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
tracef
(
" A k%d -> %s
\n
"
,
lo
,
a
)
// -bucket if that bucket is reached for the first time
// -bucket if that bucket is reached for the first time
if
!
a
.
done
{
if
!
a
.
done
{
var
δA
map
[
Key
]
ΔValue
var
δA
map
[
Key
]
ΔValue
...
@@ -782,6 +796,14 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -782,6 +796,14 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
a
.
done
=
true
a
.
done
=
true
}
}
// stop if r coverage is complete
if
r
.
hi_
<=
a
.
hi_
{
break
}
// continue with next right bucket
lo
=
a
.
hi_
+
1
}
}
}
Akqueue
.
Clear
()
Akqueue
.
Clear
()
}
}
...
...
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