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
ecd23f2f
Commit
ecd23f2f
authored
Jun 02, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4e1a25df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
wcfs/internal/xbtree/rangeset.go
wcfs/internal/xbtree/rangeset.go
+13
-2
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+1
-1
No files found.
wcfs/internal/xbtree/rangeset.go
View file @
ecd23f2f
...
...
@@ -20,6 +20,10 @@
package
xbtree
// set of [lo,hi) Key ranges.
import
(
"fmt"
)
// Range represents [lo,hi) Key range.
type
Range
struct
{
lo
Key
...
...
@@ -69,12 +73,19 @@ func (A *RangeSet) Difference(B *RangeSet) *RangeSet {
// --------
// Clone returns copy of the set.
func
(
orig
*
RangeSet
)
Clone
()
*
RangeSet
{
klon
:=
&
RangeSet
{}
klon
.
rangev
=
append
(
klon
.
rangev
,
orig
.
rangev
...
)
return
klon
}
// XXX RangeSet.verify to check ranges are not overlapping and ↑
func
(
r
Range
)
String
()
string
{
slo
:=
"-∞"
;
if
r
n
.
lo
>
KeyMin
{
slo
=
fmt
.
Sprintf
(
"%v"
,
rn
.
lo
)
}
shi
:=
"∞"
;
if
r
n
.
hi_
<
KeyMax
{
shi
=
fmt
.
Sprintf
(
"%v"
,
rn
.
hi_
+
1
)
}
slo
:=
"-∞"
;
if
r
.
lo
>
KeyMin
{
slo
=
fmt
.
Sprintf
(
"%v"
,
r
.
lo
)
}
shi
:=
"∞"
;
if
r
.
hi_
<
KeyMax
{
shi
=
fmt
.
Sprintf
(
"%v"
,
r
.
hi_
+
1
)
}
return
fmt
.
Sprintf
(
"[%s,%s)"
,
slo
,
shi
)
}
...
...
wcfs/internal/xbtree/δbtail.go
View file @
ecd23f2f
...
...
@@ -172,7 +172,7 @@ func (orig *ΔBtail) clone() *ΔBtail {
klon
.
byRoot
=
make
(
map
[
zodb
.
Oid
]
*
ΔTtail
,
len
(
orig
.
byRoot
))
for
root
,
origΔTtail
:=
range
orig
.
byRoot
{
klonΔTtail
:=
&
ΔTtail
{}
klonΔTtail
.
vδT
=
append
(
klonΔTtail
.
vδT
,
origΔTtail
.
vδT
...
)
klonΔTtail
.
vδT
=
append
(
nil
,
origΔTtail
.
vδT
...
)
klonΔTtail
.
KVAtTail
=
make
(
map
[
Key
]
Value
,
len
(
origΔTtail
.
KVAtTail
))
for
k
,
v
:=
range
origΔTtail
.
KVAtTail
{
klonΔTtail
.
KVAtTail
[
k
]
=
v
...
...
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