Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
d4da2a21
Commit
d4da2a21
authored
Oct 01, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
863312bc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
go/zodb/btree/gen-btree
go/zodb/btree/gen-btree
+1
-1
go/zodb/btree/ziobtree.go
go/zodb/btree/ziobtree.go
+7
-7
go/zodb/btree/zlobtree.go
go/zodb/btree/zlobtree.go
+7
-7
No files found.
go/zodb/btree/gen-btree
View file @
d4da2a21
...
@@ -50,7 +50,7 @@ sed \
...
@@ -50,7 +50,7 @@ sed \
-e
"s/
\b
bucketState
\b
/
${
kind
}
bucketState/g"
\
-e
"s/
\b
bucketState
\b
/
${
kind
}
bucketState/g"
\
-e
"s/
\b
_KeyMin
\b
/_
${
KEYKIND
}
KeyMin/g"
\
-e
"s/
\b
_KeyMin
\b
/_
${
KEYKIND
}
KeyMin/g"
\
-e
"s/
\b
_KeyMax
\b
/_
${
KEYKIND
}
KeyMax/g"
\
-e
"s/
\b
_KeyMax
\b
/_
${
KEYKIND
}
KeyMax/g"
\
-e
"s/
\b
KeyRange
\b
/
_
${
KEYKIND
}
KeyRange/g"
\
-e
"s/
\b
KeyRange
\b
/
${
KEYKIND
}
KeyRange/g"
\
-e
"s/
\b
kmin
\b
/
${
keykind
}
kmin/g"
\
-e
"s/
\b
kmin
\b
/
${
keykind
}
kmin/g"
\
-e
"s/
\b
kmax
\b
/
${
keykind
}
kmax/g"
\
-e
"s/
\b
kmax
\b
/
${
keykind
}
kmax/g"
\
-e
"s/
\b
kstr
\b
/
${
keykind
}
kstr/g"
\
-e
"s/
\b
kstr
\b
/
${
keykind
}
kstr/g"
\
...
...
go/zodb/btree/ziobtree.go
View file @
d4da2a21
...
@@ -174,14 +174,14 @@ func (t *IOBTree) Get(ctx context.Context, key int32) (_ interface{}, _ bool, er
...
@@ -174,14 +174,14 @@ func (t *IOBTree) Get(ctx context.Context, key int32) (_ interface{}, _ bool, er
// VGet is like Get but also calls visit while traversing the tree.
// VGet is like Get but also calls visit while traversing the tree.
//
//
// Visit is called with node being activated.
// Visit is called with node being activated.
func
(
t
*
IOBTree
)
VGet
(
ctx
context
.
Context
,
key
int32
,
visit
func
(
node
IONode
,
keycov
_
IKeyRange
))
(
_
interface
{},
_
bool
,
err
error
)
{
func
(
t
*
IOBTree
)
VGet
(
ctx
context
.
Context
,
key
int32
,
visit
func
(
node
IONode
,
keycov
IKeyRange
))
(
_
interface
{},
_
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"btree(%s): get %v"
,
t
.
POid
(),
key
)
defer
xerr
.
Contextf
(
&
err
,
"btree(%s): get %v"
,
t
.
POid
(),
key
)
err
=
t
.
PActivate
(
ctx
)
err
=
t
.
PActivate
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
keycov
:=
_
IKeyRange
{
Lo
:
_IKeyMin
,
Hi_
:
_IKeyMax
}
keycov
:=
IKeyRange
{
Lo
:
_IKeyMin
,
Hi_
:
_IKeyMax
}
if
visit
!=
nil
{
if
visit
!=
nil
{
visit
(
t
,
keycov
)
visit
(
t
,
keycov
)
}
}
...
@@ -674,19 +674,19 @@ func init() {
...
@@ -674,19 +674,19 @@ func init() {
// XXX place
// XXX place
//
_
IKeyRange represents [lo,hi) key range.
// IKeyRange represents [lo,hi) key range.
type
_
IKeyRange
struct
{
type
IKeyRange
struct
{
Lo
int32
Lo
int32
Hi_
int32
// NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
Hi_
int32
// NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
}
// Has returns whether key k belongs to the range.
// Has returns whether key k belongs to the range.
func
(
r
*
_
IKeyRange
)
Has
(
k
int32
)
bool
{
func
(
r
*
IKeyRange
)
Has
(
k
int32
)
bool
{
return
(
r
.
Lo
<=
k
&&
k
<=
r
.
Hi_
)
return
(
r
.
Lo
<=
k
&&
k
<=
r
.
Hi_
)
}
}
// Empty returns whether key range is empty.
// Empty returns whether key range is empty.
func
(
r
*
_
IKeyRange
)
Empty
()
bool
{
func
(
r
*
IKeyRange
)
Empty
()
bool
{
hi
:=
r
.
Hi_
hi
:=
r
.
Hi_
if
hi
==
_IKeyMax
{
if
hi
==
_IKeyMax
{
// [x,∞] cannot be empty because max x is ∞ and [∞,∞] has one element: ∞
// [x,∞] cannot be empty because max x is ∞ and [∞,∞] has one element: ∞
...
@@ -696,7 +696,7 @@ func (r *_IKeyRange) Empty() bool {
...
@@ -696,7 +696,7 @@ func (r *_IKeyRange) Empty() bool {
return
r
.
Lo
>=
hi
return
r
.
Lo
>=
hi
}
}
func
(
r
_
IKeyRange
)
String
()
string
{
func
(
r
IKeyRange
)
String
()
string
{
var
shi
string
var
shi
string
if
r
.
Hi_
==
_IKeyMax
{
if
r
.
Hi_
==
_IKeyMax
{
shi
=
ikstr
(
r
.
Hi_
)
// ∞
shi
=
ikstr
(
r
.
Hi_
)
// ∞
...
...
go/zodb/btree/zlobtree.go
View file @
d4da2a21
...
@@ -174,14 +174,14 @@ func (t *LOBTree) Get(ctx context.Context, key int64) (_ interface{}, _ bool, er
...
@@ -174,14 +174,14 @@ func (t *LOBTree) Get(ctx context.Context, key int64) (_ interface{}, _ bool, er
// VGet is like Get but also calls visit while traversing the tree.
// VGet is like Get but also calls visit while traversing the tree.
//
//
// Visit is called with node being activated.
// Visit is called with node being activated.
func
(
t
*
LOBTree
)
VGet
(
ctx
context
.
Context
,
key
int64
,
visit
func
(
node
LONode
,
keycov
_
LKeyRange
))
(
_
interface
{},
_
bool
,
err
error
)
{
func
(
t
*
LOBTree
)
VGet
(
ctx
context
.
Context
,
key
int64
,
visit
func
(
node
LONode
,
keycov
LKeyRange
))
(
_
interface
{},
_
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"btree(%s): get %v"
,
t
.
POid
(),
key
)
defer
xerr
.
Contextf
(
&
err
,
"btree(%s): get %v"
,
t
.
POid
(),
key
)
err
=
t
.
PActivate
(
ctx
)
err
=
t
.
PActivate
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
keycov
:=
_
LKeyRange
{
Lo
:
_LKeyMin
,
Hi_
:
_LKeyMax
}
keycov
:=
LKeyRange
{
Lo
:
_LKeyMin
,
Hi_
:
_LKeyMax
}
if
visit
!=
nil
{
if
visit
!=
nil
{
visit
(
t
,
keycov
)
visit
(
t
,
keycov
)
}
}
...
@@ -674,19 +674,19 @@ func init() {
...
@@ -674,19 +674,19 @@ func init() {
// XXX place
// XXX place
//
_
LKeyRange represents [lo,hi) key range.
// LKeyRange represents [lo,hi) key range.
type
_
LKeyRange
struct
{
type
LKeyRange
struct
{
Lo
int64
Lo
int64
Hi_
int64
// NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
Hi_
int64
// NOTE _not_ hi) to avoid overflow at ∞; hi = hi_ + 1
}
}
// Has returns whether key k belongs to the range.
// Has returns whether key k belongs to the range.
func
(
r
*
_
LKeyRange
)
Has
(
k
int64
)
bool
{
func
(
r
*
LKeyRange
)
Has
(
k
int64
)
bool
{
return
(
r
.
Lo
<=
k
&&
k
<=
r
.
Hi_
)
return
(
r
.
Lo
<=
k
&&
k
<=
r
.
Hi_
)
}
}
// Empty returns whether key range is empty.
// Empty returns whether key range is empty.
func
(
r
*
_
LKeyRange
)
Empty
()
bool
{
func
(
r
*
LKeyRange
)
Empty
()
bool
{
hi
:=
r
.
Hi_
hi
:=
r
.
Hi_
if
hi
==
_LKeyMax
{
if
hi
==
_LKeyMax
{
// [x,∞] cannot be empty because max x is ∞ and [∞,∞] has one element: ∞
// [x,∞] cannot be empty because max x is ∞ and [∞,∞] has one element: ∞
...
@@ -696,7 +696,7 @@ func (r *_LKeyRange) Empty() bool {
...
@@ -696,7 +696,7 @@ func (r *_LKeyRange) Empty() bool {
return
r
.
Lo
>=
hi
return
r
.
Lo
>=
hi
}
}
func
(
r
_
LKeyRange
)
String
()
string
{
func
(
r
LKeyRange
)
String
()
string
{
var
shi
string
var
shi
string
if
r
.
Hi_
==
_LKeyMax
{
if
r
.
Hi_
==
_LKeyMax
{
shi
=
lkstr
(
r
.
Hi_
)
// ∞
shi
=
lkstr
(
r
.
Hi_
)
// ∞
...
...
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