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
13dc6ebb
Commit
13dc6ebb
authored
Feb 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
afbec0f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+17
-9
No files found.
t/neo/storage/fs1/filestorage.go
View file @
13dc6ebb
...
...
@@ -103,11 +103,18 @@ func (e *ErrDataRecord) Error() string {
var
ErrVersionNonZero
=
errors
.
New
(
"non-zero version"
)
// flags for TxnHeader.Load
type
TxnLoadFlags
int
const
(
LoadAll
TxnLoadFlags
=
0x00
LoadNoStrings
=
0x01
)
// Load reads and decodes transaction record header from a readerAt
// pos: points to transaction start
// no requirements are made to previous txnh state
// XXX io.ReaderAt -> *os.File (if iface conv costly)
func
(
txnh
*
TxnHeader
)
Load
(
r
io
.
ReaderAt
,
pos
int64
)
error
{
func
(
txnh
*
TxnHeader
)
Load
(
r
io
.
ReaderAt
,
pos
int64
,
flags
TxnLoadFlags
)
error
{
if
cap
(
txnh
.
workMem
)
<
txnXHeaderFixSize
{
txnh
.
workMem
=
make
([]
byte
,
txnXHeaderFixSize
)
// XXX or 0, ... ?
}
...
...
@@ -172,8 +179,9 @@ func (txnh *TxnHeader) Load(r io.ReaderAt, pos int64) error {
txnh
.
Description
=
work
[
luser
:
luser
:
ldesc
]
txnh
.
Extension
=
work
[
luser
+
ldesc
:
luser
+
ldesc
:
lext
]
// XXX make strings loading optional
if
flags
&
LoadNoString
==
0
{
txnh
.
loadString
()
}
return
txnHeaderFixSize
+
lstr
,
nil
}
...
...
@@ -197,18 +205,18 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt) error {
// loadPrev reads and decodes previous transaction record header from a readerAt
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
)
error
{
func
(
txnh
*
TxnHeader
)
LoadPrev
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
if
txnh
.
PrevLen
==
0
{
return
io
.
EOF
}
return
txnh
.
Load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
)
return
txnh
.
Load
(
r
,
txnh
.
Pos
-
txnh
.
PrevLen
,
flags
)
}
// loadNext reads and decodes next transaction record header from a readerAt
// txnh should be already initialized by previous call to load()
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
)
error
{
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
)
func
(
txnh
*
TxnHeader
)
LoadNext
(
r
io
.
ReaderAt
,
flags
TxnLoadFlags
)
error
{
return
txnh
.
Load
(
r
,
txnh
.
Pos
+
txnh
.
Len
,
flags
)
}
...
...
@@ -419,9 +427,9 @@ type forwardIter struct {
TidMax
zodb
.
Tid
// iterate up to tid <= tidMax
}
func
(
fi
*
forwardIter
)
NextTxn
()
error
{
func
(
fi
*
forwardIter
)
NextTxn
(
flags
TxnLoadFlags
)
error
{
// XXX from what we start? how to yield 1st elem?
err
:=
fi
.
Txnh
.
LoadNext
()
err
:=
fi
.
Txnh
.
LoadNext
(
flags
)
if
err
!=
nil
{
return
err
}
...
...
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