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
a22223af
Commit
a22223af
authored
Jun 03, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fc9b4d85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
wcfs/internal/xbtree/rangeset.go
wcfs/internal/xbtree/rangeset.go
+9
-1
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+10
-10
No files found.
wcfs/internal/xbtree/rangeset.go
View file @
a22223af
...
...
@@ -29,13 +29,16 @@ const traceRangeSet = false
const
debugRangeSet
=
false
// Range represents [lo,hi) Key range.
// XXX -> KeyRange?
type
Range
struct
{
lo
Key
hi_
Key
// NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
// RangeSet is set of Keys with adjacent keys coaleced into Ranges.
// XXX -> RangedSet ?
//
// Zero value represents empty set.
// XXX -> RangedSet ? RangedKeySet ? RangeKeySet?
type
RangeSet
struct
{
// TODO rework to use BTree lo->hi_ instead if in practice in treediff,
// and other usage places, N(ranges) turns out to be not small
...
...
@@ -347,6 +350,11 @@ func (orig *RangeSet) Clone() *RangeSet {
return
klon
}
// Empty returns whether the set is empty.
func
(
S
*
RangeSet
)
Empty
()
bool
{
return
len
(
S
.
rangev
)
==
0
}
// Equal returns whether A == B.
func
(
A
*
RangeSet
)
Equal
(
B
*
RangeSet
)
bool
{
if
len
(
A
.
rangev
)
!=
len
(
B
.
rangev
)
{
...
...
wcfs/internal/xbtree/treediff.go
View file @
a22223af
...
...
@@ -520,25 +520,25 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
Bv
:=
rangeSplit
{
btop
}
// nodes expanded from B
// for phase 2:
Akqueue
:=
SetKey
{}
// queue for keys in A to be processed for δ- XXX -> KeyRangeSet
Bkqueue
:=
SetKey
{}
// ----//---- in B for δ+ XXX ----//----
Akdone
:=
SetKey
{}
// already processed keys in A XXX ----//----
Bkdone
:=
SetKey
{}
// ----//---- in B XXX ----//----
Akqueue
:=
&
RangeSet
{}
// queue for keys in A to be processed for δ-
Bkqueue
:=
&
RangeSet
{}
// ----//---- in B for δ+
Akdone
:=
&
RangeSet
{}
// already processed keys in A
Bkdone
:=
&
RangeSet
{}
// ----//---- in B
Aktodo
:=
func
(
k
Key
)
{
if
!
Akdone
.
Has
(
k
)
{
tracef
(
" Akq <- %d
\n
"
,
k
)
Akqueue
.
Add
(
k
)
}
}
Bktodo
:=
func
(
lo
,
hi_
Key
)
{
// XXX func(r KeyRange)
panic
(
"TODO"
)
/* XXX reenable
Bktodo
:=
func
(
lo
,
hi_
Key
)
{
// XXX -> func(r Range)
r
:=
Range
{
lo
,
hi_
}
if
!
Bkdone
.
HasRange
(
r
)
{
δtodo := r.Difference(Bkdone) // XXX name
δtodo
:=
&
RangeSet
{}
δtodo
.
AddRange
(
r
)
δtodo
.
DifferenceInplace
(
Bkdone
)
tracef
(
" Bkq <- %s
\n
"
,
δtodo
)
Bkqueue
.
UnionInplace
(
δtodo
)
}
*/
/* XXX kill
if !Bkdone.Has(k) {
tracef(" Bkq <- %d\n", k)
...
...
@@ -702,7 +702,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
tracef
(
"
\n
"
)
tracef
(
" Bkq: %s
\n
"
,
Bkqueue
)
if
len
(
Bkqueue
)
==
0
{
if
Bkqueue
.
Empty
()
{
break
}
...
...
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