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
5b30965f
Commit
5b30965f
authored
Oct 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
32e85309
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
31 deletions
+45
-31
wcfs/internal/xbtree/blib/rangemap.go.in
wcfs/internal/xbtree/blib/rangemap.go.in
+9
-7
wcfs/internal/xbtree/blib/rangemap_test.go
wcfs/internal/xbtree/blib/rangemap_test.go
+8
-8
wcfs/internal/xbtree/blib/zrangemap_str.go
wcfs/internal/xbtree/blib/zrangemap_str.go
+9
-7
wcfs/internal/xbtree/blib/zrangemap_void.go
wcfs/internal/xbtree/blib/zrangemap_void.go
+9
-7
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+10
-2
No files found.
wcfs/internal/xbtree/blib/rangemap.go.in
View file @
5b30965f
...
...
@@ -46,9 +46,11 @@ type RangedMapEntry struct {
//
Get
returns
value
associated
with
key
k
.
func
(
M
*
RangedMap
)
Get
(
k
Key
)
VALUE
{
v
,
_
:=
M
.
Get_
(
k
)
return
v
//
//
KeyRange
indicates
all
keys
adjacent
to
k
,
that
are
too
mapped
to
the
same
value
.
func
(
M
*
RangedMap
)
Get
(
k
Key
)
(
VALUE
,
KeyRange
)
{
v
,
r
,
_
:=
M
.
Get_
(
k
)
return
v
,
r
}
//
Set
changes
M
to
map
key
k
to
value
v
.
...
...
@@ -63,20 +65,20 @@ func (M *RangedMap) Del(k Key) {
//
Has
returns
whether
key
k
is
present
in
the
map
.
func
(
M
*
RangedMap
)
Has
(
k
Key
)
bool
{
_
,
ok
:=
M
.
Get_
(
k
)
_
,
_
,
ok
:=
M
.
Get_
(
k
)
return
ok
}
//
Get_
is
comma
-
ok
version
of
Get
.
func
(
M
*
RangedMap
)
Get_
(
k
Key
)
(
v
VALUE
,
ok
bool
)
{
func
(
M
*
RangedMap
)
Get_
(
k
Key
)
(
v
VALUE
,
r
KeyRange
,
ok
bool
)
{
if
traceRangeMap
{
fmt
.
Printf
(
"
\n\n
Get_:
\n
"
)
fmt
.
Printf
(
" M: %s
\n
"
,
M
)
fmt
.
Printf
(
" k: %s
\n
"
,
KStr
(
k
))
defer
func
()
{
fmt
.
Printf
(
"->·: %v
, %t
\n
"
,
v
,
ok
)
fmt
.
Printf
(
"->·: %v
%s, %t
\n
"
,
v
,
r
,
ok
)
}()
}
...
...
@@ -99,7 +101,7 @@ func (M *RangedMap) Get_(k Key) (v VALUE, ok bool) {
}
//
found
return
e
.
Value
,
true
return
e
.
Value
,
e
.
KeyRange
,
true
}
//
SetRange
changes
M
to
map
key
range
r
to
value
v
.
...
...
wcfs/internal/xbtree/blib/rangemap_test.go
View file @
5b30965f
...
...
@@ -283,10 +283,10 @@ func verifyGet(t *testing.T, M *RangedMap) {
lo
:=
kmax
(
e
.
Lo
,
Z
.
Lo
)
hi_
:=
kmin
(
e
.
Hi_
,
Z
.
Hi_
)
for
k
:=
lo
;
k
<=
hi_
;
k
++
{
v
,
ok
:=
M
.
Get_
(
k
)
if
!
(
v
==
e
.
Value
&&
ok
)
{
t
.
Errorf
(
"%s
\t
Get(%s):
\n
have: %q
, %t
\n
want: %q
, true"
,
M
,
KStr
(
k
),
v
,
ok
,
e
.
Valu
e
)
v
,
r
,
ok
:=
M
.
Get_
(
k
)
if
!
(
v
==
e
.
Value
&&
r
==
e
.
KeyRange
&&
ok
)
{
t
.
Errorf
(
"%s
\t
Get(%s):
\n
have: %q
%s, %t
\n
want: %q%s
, true"
,
M
,
KStr
(
k
),
v
,
r
,
ok
,
e
.
Value
,
e
.
KeyRang
e
)
}
}
}
...
...
@@ -303,10 +303,10 @@ func verifyGet(t *testing.T, M *RangedMap) {
lo
:=
kmax
(
r
.
Lo
,
Z
.
Lo
)
hi_
:=
kmin
(
r
.
Hi_
,
Z
.
Hi_
)
for
k
:=
lo
;
k
<=
hi_
;
k
++
{
v
,
ok
:=
M
.
Get_
(
k
)
if
!
(
v
==
""
&&
!
ok
)
{
t
.
Errorf
(
"%s
\t
Get(%s):
\n
have: %q
, %t
\n
want: %q
, false"
,
M
,
KStr
(
k
),
v
,
ok
,
""
)
v
,
r_
,
ok
:=
M
.
Get_
(
k
)
if
!
(
v
==
""
&&
r_
.
Empty
()
&&
!
ok
)
{
t
.
Errorf
(
"%s
\t
Get(%s):
\n
have: %q
%s, %t
\n
want: %q[)
, false"
,
M
,
KStr
(
k
),
v
,
r_
,
ok
,
""
)
}
}
}
...
...
wcfs/internal/xbtree/blib/zrangemap_str.go
View file @
5b30965f
...
...
@@ -48,9 +48,11 @@ type _RangedMap_strEntry struct {
// Get returns value associated with key k.
func
(
M
*
_RangedMap_str
)
Get
(
k
Key
)
string
{
v
,
_
:=
M
.
Get_
(
k
)
return
v
//
// KeyRange indicates all keys adjacent to k, that are too mapped to the same value.
func
(
M
*
_RangedMap_str
)
Get
(
k
Key
)
(
string
,
KeyRange
)
{
v
,
r
,
_
:=
M
.
Get_
(
k
)
return
v
,
r
}
// Set changes M to map key k to value v.
...
...
@@ -65,20 +67,20 @@ func (M *_RangedMap_str) Del(k Key) {
// Has returns whether key k is present in the map.
func
(
M
*
_RangedMap_str
)
Has
(
k
Key
)
bool
{
_
,
ok
:=
M
.
Get_
(
k
)
_
,
_
,
ok
:=
M
.
Get_
(
k
)
return
ok
}
// Get_ is comma-ok version of Get.
func
(
M
*
_RangedMap_str
)
Get_
(
k
Key
)
(
v
string
,
ok
bool
)
{
func
(
M
*
_RangedMap_str
)
Get_
(
k
Key
)
(
v
string
,
r
KeyRange
,
ok
bool
)
{
if
trace_RangedMap_str
{
fmt
.
Printf
(
"
\n\n
Get_:
\n
"
)
fmt
.
Printf
(
" M: %s
\n
"
,
M
)
fmt
.
Printf
(
" k: %s
\n
"
,
KStr
(
k
))
defer
func
()
{
fmt
.
Printf
(
"->·: %v
, %t
\n
"
,
v
,
ok
)
fmt
.
Printf
(
"->·: %v
%s, %t
\n
"
,
v
,
r
,
ok
)
}()
}
...
...
@@ -101,7 +103,7 @@ func (M *_RangedMap_str) Get_(k Key) (v string, ok bool) {
}
// found
return
e
.
Value
,
true
return
e
.
Value
,
e
.
KeyRange
,
true
}
// SetRange changes M to map key range r to value v.
...
...
wcfs/internal/xbtree/blib/zrangemap_void.go
View file @
5b30965f
...
...
@@ -48,9 +48,11 @@ type _RangedMap_voidEntry struct {
// Get returns value associated with key k.
func
(
M
*
_RangedMap_void
)
Get
(
k
Key
)
void
{
v
,
_
:=
M
.
Get_
(
k
)
return
v
//
// KeyRange indicates all keys adjacent to k, that are too mapped to the same value.
func
(
M
*
_RangedMap_void
)
Get
(
k
Key
)
(
void
,
KeyRange
)
{
v
,
r
,
_
:=
M
.
Get_
(
k
)
return
v
,
r
}
// Set changes M to map key k to value v.
...
...
@@ -65,20 +67,20 @@ func (M *_RangedMap_void) Del(k Key) {
// Has returns whether key k is present in the map.
func
(
M
*
_RangedMap_void
)
Has
(
k
Key
)
bool
{
_
,
ok
:=
M
.
Get_
(
k
)
_
,
_
,
ok
:=
M
.
Get_
(
k
)
return
ok
}
// Get_ is comma-ok version of Get.
func
(
M
*
_RangedMap_void
)
Get_
(
k
Key
)
(
v
void
,
ok
bool
)
{
func
(
M
*
_RangedMap_void
)
Get_
(
k
Key
)
(
v
void
,
r
KeyRange
,
ok
bool
)
{
if
trace_RangedMap_void
{
fmt
.
Printf
(
"
\n\n
Get_:
\n
"
)
fmt
.
Printf
(
" M: %s
\n
"
,
M
)
fmt
.
Printf
(
" k: %s
\n
"
,
KStr
(
k
))
defer
func
()
{
fmt
.
Printf
(
"->·: %v
, %t
\n
"
,
v
,
ok
)
fmt
.
Printf
(
"->·: %v
%s, %t
\n
"
,
v
,
r
,
ok
)
}()
}
...
...
@@ -101,7 +103,7 @@ func (M *_RangedMap_void) Get_(k Key) (v void, ok bool) {
}
// found
return
e
.
Value
,
true
return
e
.
Value
,
e
.
KeyRange
,
true
}
// SetRange changes M to map key range r to value v.
...
...
wcfs/internal/xbtree/δbtail.go
View file @
5b30965f
...
...
@@ -586,8 +586,10 @@ func (δTtail *_ΔTtail) __rebuild(root zodb.Oid, δBtail *ΔBtail, releaseLock
// krebuildJobs += ktrackNew
for
_
,
r
:=
range
ktrackNew
.
AllRanges
()
{
// assert krebuildJobs ^ r = ø
if
δTtail
.
krebuildJobs
.
IntersectsRange
(
r
)
{
panicf
(
"BUG: rebuild: krebuildJobs ^ ktrackNew != ø:
\n
krebuildJobs: %s
\n
ktrackNew: %s"
,
panicf
(
"BUG: rebuild: prologue: "
+
"krebuildJobs ^ ktrackNew != ø:
\n
krebuildJobs: %s
\n
ktrackNew: %s"
,
δTtail
.
krebuildJobs
,
ktrackNew
)
}
δTtail
.
krebuildJobs
.
SetRange
(
r
,
job
)
...
...
@@ -605,7 +607,13 @@ func (δTtail *_ΔTtail) __rebuild(root zodb.Oid, δBtail *ΔBtail, releaseLock
// krebuildJobs -= ktrackNew
for
_
,
r
:=
range
ktrackNew
.
AllRanges
()
{
// XXX assert krebuildJobs[r] == job
// assert krebuildJobs[r] = job
job_
,
r_
:=
δTtail
.
krebuildJobs
.
Get_
(
r
.
Lo
)
if
!
(
job_
==
job
&&
r_
==
r
)
{
panicf
(
"BUG: rebuild: epilogue: "
+
"krebuildJobs entry mutated:
\n
set in prologue [%s]=%p
\n
got in epilogue: [%s]=%p"
,
r
,
job
,
r_
,
job_
)
}
δTtail
.
krebuildJobs
.
DelRange
(
r
)
}
...
...
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