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
820f4ac4
Commit
820f4ac4
authored
Feb 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
666f6df1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
t/neo/storage/fs1/b/fsbtree.go
t/neo/storage/fs1/b/fsbtree.go
+24
-23
t/neo/storage/fs1/b/gen-fsbtree
t/neo/storage/fs1/b/gen-fsbtree
+6
-2
No files found.
t/neo/storage/fs1/b/fsbtree.go
View file @
820f4ac4
// DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from github.com/cznic/b bcff30a)
// KEY=Oid VALUE=uint64
// KEY=
zodb.
Oid VALUE=uint64
// ---- 8< ----
// Copyright 2014 The b Authors. All rights reserved.
...
...
@@ -7,6 +7,7 @@
// license that can be found in the LICENSE file.
package
b
import
"zodb"
import
(
"fmt"
...
...
@@ -46,7 +47,7 @@ func (p *btTpool) get(cmp Cmp) *Tree {
type
btEpool
struct
{
sync
.
Pool
}
func
(
p
*
btEpool
)
get
(
err
error
,
hit
bool
,
i
int
,
k
Oid
,
q
*
d
,
t
*
Tree
,
ver
int64
)
*
Enumerator
{
func
(
p
*
btEpool
)
get
(
err
error
,
hit
bool
,
i
int
,
k
zodb
.
Oid
,
q
*
d
,
t
*
Tree
,
ver
int64
)
*
Enumerator
{
x
:=
p
.
Get
()
.
(
*
Enumerator
)
x
.
err
,
x
.
hit
,
x
.
i
,
x
.
k
,
x
.
q
,
x
.
t
,
x
.
ver
=
err
,
hit
,
i
,
k
,
q
,
t
,
ver
return
x
...
...
@@ -59,7 +60,7 @@ type (
// 0 if a == b
// > 0 if a > b
//
Cmp
func
(
a
,
b
Oid
)
int
Cmp
func
(
a
,
b
zodb
.
Oid
)
int
d
struct
{
// data page
c
int
...
...
@@ -69,7 +70,7 @@ type (
}
de
struct
{
// d element
k
Oid
k
zodb
.
Oid
v
uint64
}
...
...
@@ -85,7 +86,7 @@ type (
err
error
hit
bool
i
int
k
Oid
k
zodb
.
Oid
q
*
d
t
*
Tree
ver
int64
...
...
@@ -103,7 +104,7 @@ type (
xe
struct
{
// x element
ch
interface
{}
k
Oid
k
zodb
.
Oid
}
x
struct
{
// index page
...
...
@@ -116,7 +117,7 @@ var ( // R/O zero values
zd
d
zde
de
ze
Enumerator
zk
Oid
zk
zodb
.
Oid
zt
Tree
zx
x
zxe
xe
...
...
@@ -154,7 +155,7 @@ func (q *x) extract(i int) {
}
}
func
(
q
*
x
)
insert
(
i
int
,
k
Oid
,
ch
interface
{})
*
x
{
func
(
q
*
x
)
insert
(
i
int
,
k
zodb
.
Oid
,
ch
interface
{})
*
x
{
c
:=
q
.
c
if
i
<
c
{
q
.
x
[
c
+
1
]
.
ch
=
q
.
x
[
c
]
.
ch
...
...
@@ -285,7 +286,7 @@ func (t *Tree) catX(p, q, r *x, pi int) {
// Delete removes the k's KV pair, if it exists, in which case Delete returns
// true.
func
(
t
*
Tree
)
Delete
(
k
Oid
)
(
ok
bool
)
{
func
(
t
*
Tree
)
Delete
(
k
zodb
.
Oid
)
(
ok
bool
)
{
pi
:=
-
1
var
p
*
x
q
:=
t
.
r
...
...
@@ -348,8 +349,8 @@ func (t *Tree) extract(q *d, i int) { // (r uint64) {
return
}
func
(
t
*
Tree
)
find
(
q
interface
{},
k
Oid
)
(
i
int
,
ok
bool
)
{
var
mk
Oid
func
(
t
*
Tree
)
find
(
q
interface
{},
k
zodb
.
Oid
)
(
i
int
,
ok
bool
)
{
var
mk
zodb
.
Oid
l
:=
0
switch
x
:=
q
.
(
type
)
{
case
*
x
:
...
...
@@ -386,7 +387,7 @@ func (t *Tree) find(q interface{}, k Oid) (i int, ok bool) {
// First returns the first item of the tree in the key collating order, or
// (zero-value, zero-value) if the tree is empty.
func
(
t
*
Tree
)
First
()
(
k
Oid
,
v
uint64
)
{
func
(
t
*
Tree
)
First
()
(
k
zodb
.
Oid
,
v
uint64
)
{
if
q
:=
t
.
first
;
q
!=
nil
{
q
:=
&
q
.
d
[
0
]
k
,
v
=
q
.
k
,
q
.
v
...
...
@@ -396,7 +397,7 @@ func (t *Tree) First() (k Oid, v uint64) {
// Get returns the value associated with k and true if it exists. Otherwise Get
// returns (zero-value, false).
func
(
t
*
Tree
)
Get
(
k
Oid
)
(
v
uint64
,
ok
bool
)
{
func
(
t
*
Tree
)
Get
(
k
zodb
.
Oid
)
(
v
uint64
,
ok
bool
)
{
q
:=
t
.
r
if
q
==
nil
{
return
...
...
@@ -422,7 +423,7 @@ func (t *Tree) Get(k Oid) (v uint64, ok bool) {
}
}
func
(
t
*
Tree
)
insert
(
q
*
d
,
i
int
,
k
Oid
,
v
uint64
)
*
d
{
func
(
t
*
Tree
)
insert
(
q
*
d
,
i
int
,
k
zodb
.
Oid
,
v
uint64
)
*
d
{
t
.
ver
++
c
:=
q
.
c
if
i
<
c
{
...
...
@@ -437,7 +438,7 @@ func (t *Tree) insert(q *d, i int, k Oid, v uint64) *d {
// Last returns the last item of the tree in the key collating order, or
// (zero-value, zero-value) if the tree is empty.
func
(
t
*
Tree
)
Last
()
(
k
Oid
,
v
uint64
)
{
func
(
t
*
Tree
)
Last
()
(
k
zodb
.
Oid
,
v
uint64
)
{
if
q
:=
t
.
last
;
q
!=
nil
{
q
:=
&
q
.
d
[
q
.
c
-
1
]
k
,
v
=
q
.
k
,
q
.
v
...
...
@@ -450,7 +451,7 @@ func (t *Tree) Len() int {
return
t
.
c
}
func
(
t
*
Tree
)
overflow
(
p
*
x
,
q
*
d
,
pi
,
i
int
,
k
Oid
,
v
uint64
)
{
func
(
t
*
Tree
)
overflow
(
p
*
x
,
q
*
d
,
pi
,
i
int
,
k
zodb
.
Oid
,
v
uint64
)
{
t
.
ver
++
l
,
r
:=
p
.
siblings
(
pi
)
...
...
@@ -480,7 +481,7 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k Oid, v uint64) {
// Seek returns an Enumerator positioned on an item such that k >= item's key.
// ok reports if k == item.key The Enumerator's position is possibly after the
// last item in the tree.
func
(
t
*
Tree
)
Seek
(
k
Oid
)
(
e
*
Enumerator
,
ok
bool
)
{
func
(
t
*
Tree
)
Seek
(
k
zodb
.
Oid
)
(
e
*
Enumerator
,
ok
bool
)
{
q
:=
t
.
r
if
q
==
nil
{
e
=
btEPool
.
get
(
nil
,
false
,
0
,
k
,
nil
,
t
,
t
.
ver
)
...
...
@@ -531,7 +532,7 @@ func (t *Tree) SeekLast() (e *Enumerator, err error) {
}
// Set sets the value associated with k.
func
(
t
*
Tree
)
Set
(
k
Oid
,
v
uint64
)
{
func
(
t
*
Tree
)
Set
(
k
zodb
.
Oid
,
v
uint64
)
{
//dbg("--- PRE Set(%v, %v)\n%s", k, v, t.dump())
//defer func() {
// dbg("--- POST\n%s\n====\n", t.dump())
...
...
@@ -593,10 +594,10 @@ func (t *Tree) Set(k Oid, v uint64) {
//
// tree.Set(k, v) call conceptually equals calling
//
// tree.Put(k, func(Oid, bool){ return v, true })
// tree.Put(k, func(
zodb.
Oid, bool){ return v, true })
//
// modulo the differing return values.
func
(
t
*
Tree
)
Put
(
k
Oid
,
upd
func
(
oldV
uint64
,
exists
bool
)
(
newV
uint64
,
write
bool
))
(
oldV
uint64
,
written
bool
)
{
func
(
t
*
Tree
)
Put
(
k
zodb
.
Oid
,
upd
func
(
oldV
uint64
,
exists
bool
)
(
newV
uint64
,
write
bool
))
(
oldV
uint64
,
written
bool
)
{
pi
:=
-
1
var
p
*
x
q
:=
t
.
r
...
...
@@ -662,7 +663,7 @@ func (t *Tree) Put(k Oid, upd func(oldV uint64, exists bool) (newV uint64, write
}
}
func
(
t
*
Tree
)
split
(
p
*
x
,
q
*
d
,
pi
,
i
int
,
k
Oid
,
v
uint64
)
{
func
(
t
*
Tree
)
split
(
p
*
x
,
q
*
d
,
pi
,
i
int
,
k
zodb
.
Oid
,
v
uint64
)
{
t
.
ver
++
r
:=
btDPool
.
Get
()
.
(
*
d
)
if
q
.
n
!=
nil
{
...
...
@@ -824,7 +825,7 @@ func (e *Enumerator) Close() {
// Next returns the currently enumerated item, if it exists and moves to the
// next item in the key collation order. If there is no item to return, err ==
// io.EOF is returned.
func
(
e
*
Enumerator
)
Next
()
(
k
Oid
,
v
uint64
,
err
error
)
{
func
(
e
*
Enumerator
)
Next
()
(
k
zodb
.
Oid
,
v
uint64
,
err
error
)
{
if
err
=
e
.
err
;
err
!=
nil
{
return
}
...
...
@@ -878,7 +879,7 @@ func (e *Enumerator) next() error {
// Prev returns the currently enumerated item, if it exists and moves to the
// previous item in the key collation order. If there is no item to return, err
// == io.EOF is returned.
func
(
e
*
Enumerator
)
Prev
()
(
k
Oid
,
v
uint64
,
err
error
)
{
func
(
e
*
Enumerator
)
Prev
()
(
k
zodb
.
Oid
,
v
uint64
,
err
error
)
{
if
err
=
e
.
err
;
err
!=
nil
{
return
}
...
...
t/neo/storage/fs1/b/gen-fsbtree
View file @
820f4ac4
...
...
@@ -5,11 +5,15 @@ Bdir=`go list -f '{{.Dir}}' $b`
Brev
=
`
cd
$Bdir
&&
git describe
--always
`
out
=
fsbtree.go
KEY
=
Oid
KEY
=
zodb.
Oid
VALUE
=
uint64
echo
"// DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from
$b
$Brev
)"
>
$out
echo
"// KEY=
$KEY
VALUE=
$VALUE
"
>>
$out
echo
"// ---- 8< ----"
>>
$out
echo
>>
$out
make
-s
-C
$Bdir
generic |sed
-e
's/KEY/Oid/g'
-e
's/VALUE/uint64/g'
>>
$out
make
-s
-C
$Bdir
generic |sed
\
-e
'/package b/a import "zodb"'
\
-e
"s/KEY/
$KEY
/g"
\
-e
"s/VALUE/
$VALUE
/g"
\
>>
$out
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