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
afbec0f4
Commit
afbec0f4
authored
Feb 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
68f80523
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
9 deletions
+40
-9
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+40
-9
No files found.
t/neo/storage/fs1/filestorage.go
View file @
afbec0f4
...
...
@@ -275,15 +275,21 @@ func OpenFileStorage(path string) (*FileStorage, error) {
// read tidMin/tidMax
// FIXME support empty file case
var
txnhMin
,
txnhMax
TxnHeader
_
,
err
=
txnhMin
.
Decode
(
f
,
4
)
err
=
txnhMin
.
Load
(
f
,
4
)
if
err
!=
nil
{
return
nil
,
err
// XXX +context
}
_
,
_
,
err
=
txnhMax
.
DecodePrev
(
f
,
topPos
)
err
=
txnhMax
.
Load
(
f
,
topPos
)
// XXX expect EOF but .PrevLen must be good
if
err
!=
nil
{
return
nil
,
err
// XXX +context
}
err
=
txhhMax
.
LoadPrev
(
f
)
if
err
!=
nil
{
// XXX
}
return
&
FileStorage
{
f
:
f
,
...
...
@@ -406,10 +412,33 @@ func (fs *FileStorage) StorageName() string {
}
type
FileStorageIterato
r
struct
{
txnPos
int64
// current (?)
transaction position
type
forwardIte
r
struct
{
//Pos int64 // current
transaction position
tidMin
,
tidMax
zodb
.
Tid
// iteration range: [tidMin, tidMax]
Txnh
TxnHeader
// current transaction information
TidMax
zodb
.
Tid
// iterate up to tid <= tidMax
}
func
(
fi
*
forwardIter
)
NextTxn
()
error
{
// XXX from what we start? how to yield 1st elem?
err
:=
fi
.
Txnh
.
LoadNext
()
if
err
!=
nil
{
return
err
}
// how to make sure last good txnh is preserved?
if
fi
.
Txnh
.
Tid
>
fi
.
TidMax
{
return
io
.
EOF
}
return
nil
}
// TODO backwardIter
type
FileStorageIterator
struct
{
forwardIter
tidMin
zodb
.
Tid
// iteration range: [tidMin, tidMax]
}
func
(
fsi
*
FileStorageIterator
)
NextTxn
(
txnInfo
*
zodb
.
TxnInfo
)
(
dataIter
zodb
.
IStorageRecordIterator
,
stop
bool
,
err
error
)
{
...
...
@@ -425,11 +454,14 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
// -> XXX empty
}
/*
(
tidMin
-
fs
.
TidMin
)
vs
(
fs
.
TidMax
-
tidMin
)
// if forward
iter := forwardIter{4, tidMin}
if
forward
{
iter
=
forwardIter
{
4
,
tidMin
}
}
else
{
iter
=
backwardIter
{
fs
.
topPos
,
tidMin
}
}
for
{
iter
.
NextTxn
(
txnh
,
...
)
}
...
...
@@ -437,7 +469,6 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
// txnh should have .Tid <= tidMin but next txn's .Tid is > tidMin
posStart
:=
iter
.
txnPos
if
t
*/
return
&
FileStorageIterator
{
-
1
,
tidMin
,
tidMax
}
// XXX -1 ok ?
}
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