Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
cbd8f5fc
Commit
cbd8f5fc
authored
Mar 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1540d347
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+11
-9
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+4
-2
No files found.
t/neo/storage/fs1/filestorage.go
View file @
cbd8f5fc
...
...
@@ -772,13 +772,13 @@ const (
func
(
ti
*
txnIter
)
NextTxn
(
flags
TxnLoadFlags
)
error
{
switch
{
case
ti
.
Flags
&
iterEOF
!=
0
:
println
(
"already eof"
)
//
println("already eof")
return
io
.
EOF
case
ti
.
Flags
&
iterPreloaded
!=
0
:
// first element is already there - preloaded by who initialized txnIter
ti
.
Flags
&=
^
iterPreloaded
fmt
.
Println
(
"preloaded:"
,
ti
.
Txnh
.
Tid
)
//
fmt.Println("preloaded:", ti.Txnh.Tid)
default
:
var
err
error
...
...
@@ -789,7 +789,7 @@ func (ti *txnIter) NextTxn(flags TxnLoadFlags) error {
}
// XXX EOF ^^^ is not expected (range pre-cut to valid tids) ?
fmt
.
Println
(
"loaded:"
,
ti
.
Txnh
.
Tid
)
//
fmt.Println("loaded:", ti.Txnh.Tid)
if
err
!=
nil
{
return
err
...
...
@@ -799,7 +799,7 @@ func (ti *txnIter) NextTxn(flags TxnLoadFlags) error {
// XXX how to make sure last good txnh is preserved?
if
(
ti
.
Flags
&
iterDir
!=
0
&&
ti
.
Txnh
.
Tid
>
ti
.
TidStop
)
||
(
ti
.
Flags
&
iterDir
==
0
&&
ti
.
Txnh
.
Tid
<
ti
.
TidStop
)
{
println
(
"-> EOF"
)
//
println("-> EOF")
ti
.
Flags
|=
iterEOF
return
io
.
EOF
}
...
...
@@ -865,7 +865,7 @@ func (fsi *Iterator) NextTxn() (*zodb.TxnInfo, zodb.IStorageRecordIterator, erro
}
func
(
fs
*
FileStorage
)
Iterate
(
tidMin
,
tidMax
zodb
.
Tid
)
zodb
.
IStorageIterator
{
fmt
.
Printf
(
"
\n
I
terate %v..%v
\n
"
,
tidMin
,
tidMax
)
fmt
.
Printf
(
"
i
terate %v..%v
\n
"
,
tidMin
,
tidMax
)
// FIXME case when only 0 or 1 txn present
if
tidMin
<
fs
.
txnhMin
.
Tid
{
tidMin
=
fs
.
txnhMin
.
Tid
...
...
@@ -873,9 +873,6 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
if
tidMax
>
fs
.
txnhMax
.
Tid
{
tidMax
=
fs
.
txnhMax
.
Tid
}
if
tidMin
>
tidMax
{
// -> XXX empty
}
// XXX naming
Iter
:=
Iterator
{}
...
...
@@ -883,6 +880,11 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
Iter
.
dataIter
.
fs
=
fs
Iter
.
dataIter
.
Txnh
=
&
Iter
.
txnIter
.
Txnh
if
tidMin
>
tidMax
{
Iter
.
txnIter
.
Flags
|=
iterEOF
// empty
return
&
Iter
}
// scan either from file start or end, depending which way it is likely closer, to tidMin
// XXX put iter into ptr to Iter ^^^
iter
:=
&
Iter
.
txnIter
...
...
@@ -913,7 +915,7 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
panic
(
err
)
// XXX
}
fmt
.
Printf
(
"tidRange: %v..%v -> found %v @%v
\n
"
,
tidMin
,
tidMax
,
iter
.
Txnh
.
Tid
,
iter
.
Txnh
.
Pos
)
//
fmt.Printf("tidRange: %v..%v -> found %v @%v\n", tidMin, tidMax, iter.Txnh.Tid, iter.Txnh.Pos)
// where to start around tidMin found - let's reinitialize iter to
// iterate appropriately forward up to tidMax
...
...
t/neo/storage/fs1/filestorage_test.go
View file @
cbd8f5fc
...
...
@@ -124,8 +124,6 @@ func TestLoad(t *testing.T) {
for
ii
,
tmin
:=
range
minv
{
for
jj
,
tmax
:=
range
maxv
{
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
// expected number of iteration steps
nsteps
:=
j
-
i
+
1
nsteps
-=
ii
/
2
// one less point for tidMin+1
...
...
@@ -134,7 +132,11 @@ func TestLoad(t *testing.T) {
nsteps
=
0
// j < i and j == i and ii/jj
}
println
()
println
(
len
(
tidv
))
fmt
.
Printf
(
"%d%+d .. %d%+d
\t
-> %d steps
\n
"
,
i
,
ii
-
1
,
j
,
jj
-
1
,
nsteps
)
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
for
k
:=
0
;
;
k
++
{
subj
:=
fmt
.
Sprintf
(
"iterating %v..%v: step %v/%v"
,
tmin
,
tmax
,
k
+
1
,
nsteps
)
...
...
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