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
6108dadf
Commit
6108dadf
authored
Mar 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6320d7fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
23 deletions
+26
-23
t/neo/storage/fs1/filestorage.go
t/neo/storage/fs1/filestorage.go
+21
-21
t/neo/zodb/cmd/zodbdump/zodbdump.go
t/neo/zodb/cmd/zodbdump/zodbdump.go
+5
-2
No files found.
t/neo/storage/fs1/filestorage.go
View file @
6108dadf
...
@@ -148,21 +148,21 @@ func bug(e xerr, format string, a ...interface{}) {
...
@@ -148,21 +148,21 @@ func bug(e xerr, format string, a ...interface{}) {
}
}
// noEOF returns err, but changes io.EOF -> io.ErrUnexpectedEOF
//
//
noEOF returns err, but changes io.EOF -> io.ErrUnexpectedEOF
func
n
oEOF
(
err
error
)
error
{
// func N
oEOF(err error) error {
if
err
==
io
.
EOF
{
//
if err == io.EOF {
err
=
io
.
ErrUnexpectedEOF
//
err = io.ErrUnexpectedEOF
}
//
}
return
err
//
return err
}
//
}
//
// okEOF returns err, but changes io.EOF -> nil
//
//
okEOF returns err, but changes io.EOF -> nil
func
okEOF
(
err
error
)
error
{
//
func okEOF(err error) error {
if
err
==
io
.
EOF
{
//
if err == io.EOF {
err
=
nil
//
err = nil
}
//
}
return
err
//
return err
}
//
}
// --- Transaction record ---
// --- Transaction record ---
...
@@ -268,7 +268,7 @@ func (txnh *TxnHeader) Load(r io.ReaderAt /* *os.File */, pos int64, flags TxnLo
...
@@ -268,7 +268,7 @@ func (txnh *TxnHeader) Load(r io.ReaderAt /* *os.File */, pos int64, flags TxnLo
// EOF after txn header is not good - because at least
// EOF after txn header is not good - because at least
// redundant length should be also there
// redundant length should be also there
return
txnh
.
err
(
"read"
,
n
oEOF
(
err
))
return
txnh
.
err
(
"read"
,
xio
.
N
oEOF
(
err
))
}
}
txnh
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
work
[
8
+
0
:
]))
txnh
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
work
[
8
+
0
:
]))
...
@@ -327,7 +327,7 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt /* *os.File */) error {
...
@@ -327,7 +327,7 @@ func (txnh *TxnHeader) loadStrings(r io.ReaderAt /* *os.File */) error {
// we rely on Load leaving len(workMem) = sum of all strings length ...
// we rely on Load leaving len(workMem) = sum of all strings length ...
_
,
err
:=
r
.
ReadAt
(
txnh
.
workMem
,
txnh
.
Pos
+
TxnHeaderFixSize
)
_
,
err
:=
r
.
ReadAt
(
txnh
.
workMem
,
txnh
.
Pos
+
TxnHeaderFixSize
)
if
err
!=
nil
{
if
err
!=
nil
{
return
txnh
.
err
(
"read strings"
,
noEOF
(
err
))
return
txnh
.
err
(
"read strings"
,
xio
.
noEOF
(
err
))
}
}
// ... and presetting x to point to appropriate places in .workMem .
// ... and presetting x to point to appropriate places in .workMem .
...
@@ -418,7 +418,7 @@ func (dh *DataHeader) load(r io.ReaderAt /* *os.File */, pos int64, tmpBuf *[Dat
...
@@ -418,7 +418,7 @@ func (dh *DataHeader) load(r io.ReaderAt /* *os.File */, pos int64, tmpBuf *[Dat
_
,
err
:=
r
.
ReadAt
(
tmpBuf
[
:
],
pos
)
_
,
err
:=
r
.
ReadAt
(
tmpBuf
[
:
],
pos
)
if
err
!=
nil
{
if
err
!=
nil
{
return
dh
.
err
(
"read"
,
noEOF
(
err
))
return
dh
.
err
(
"read"
,
xio
.
noEOF
(
err
))
}
}
// XXX also check oid.Valid() ?
// XXX also check oid.Valid() ?
...
@@ -518,7 +518,7 @@ func (dh *DataHeader) LoadBack(r io.ReaderAt /* *os.File */) error {
...
@@ -518,7 +518,7 @@ func (dh *DataHeader) LoadBack(r io.ReaderAt /* *os.File */) error {
var
xxx
[
8
]
byte
// XXX escapes ?
var
xxx
[
8
]
byte
// XXX escapes ?
_
,
err
:=
r
.
ReadAt
(
xxx
[
:
],
dh
.
Pos
+
DataHeaderSize
)
_
,
err
:=
r
.
ReadAt
(
xxx
[
:
],
dh
.
Pos
+
DataHeaderSize
)
if
err
!=
nil
{
if
err
!=
nil
{
return
dh
.
err
(
"read data"
,
noEOF
(
err
))
return
dh
.
err
(
"read data"
,
xio
.
noEOF
(
err
))
}
}
backPos
:=
int64
(
binary
.
BigEndian
.
Uint64
(
xxx
[
:
]))
backPos
:=
int64
(
binary
.
BigEndian
.
Uint64
(
xxx
[
:
]))
...
@@ -627,7 +627,7 @@ func (dh *DataHeader) LoadData(r io.ReaderAt /* *os.File */, buf *[]byte) error
...
@@ -627,7 +627,7 @@ func (dh *DataHeader) LoadData(r io.ReaderAt /* *os.File */, buf *[]byte) error
}
}
_
,
err
:=
r
.
ReadAt
(
*
buf
,
dh
.
Pos
+
DataHeaderSize
)
_
,
err
:=
r
.
ReadAt
(
*
buf
,
dh
.
Pos
+
DataHeaderSize
)
if
err
!=
nil
{
if
err
!=
nil
{
return
dh
.
err
(
"read data"
,
noEOF
(
err
))
// XXX recheck
return
dh
.
err
(
"read data"
,
xio
.
noEOF
(
err
))
// XXX recheck
}
}
return
nil
return
nil
...
@@ -921,7 +921,7 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
...
@@ -921,7 +921,7 @@ func (fs *FileStorage) Iterate(tidMin, tidMax zodb.Tid) zodb.IStorageIterator {
for
{
for
{
err
=
iter
.
NextTxn
(
LoadNoStrings
)
err
=
iter
.
NextTxn
(
LoadNoStrings
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
o
kEOF
(
err
)
err
=
xio
.
O
kEOF
(
err
)
break
break
}
}
}
}
...
...
t/neo/zodb/cmd/zodbdump/zodbdump.go
View file @
6108dadf
...
@@ -40,6 +40,7 @@ import (
...
@@ -40,6 +40,7 @@ import (
"../../../zodb"
"../../../zodb"
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/xio"
)
)
func
zodbDump
(
w
io
.
Writer
,
stor
zodb
.
IStorage
,
tidMin
,
tidMax
zodb
.
Tid
,
hashOnly
bool
)
error
{
func
zodbDump
(
w
io
.
Writer
,
stor
zodb
.
IStorage
,
tidMin
,
tidMax
zodb
.
Tid
,
hashOnly
bool
)
error
{
...
@@ -48,7 +49,7 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
...
@@ -48,7 +49,7 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
for
{
for
{
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
if
err
!=
nil
{
if
err
!=
nil
{
err
=
o
kEOF
(
err
)
err
=
xio
.
O
kEOF
(
err
)
break
break
}
}
...
@@ -64,7 +65,7 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
...
@@ -64,7 +65,7 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
for
{
for
{
datai
,
err
:=
dataIter
.
NextData
()
datai
,
err
:=
dataIter
.
NextData
()
if
err
!=
nil
{
if
err
!=
nil
{
err
=
o
kEOF
(
err
)
err
=
xio
.
O
kEOF
(
err
)
break
break
}
}
...
@@ -102,6 +103,8 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
...
@@ -102,6 +103,8 @@ func zodbDump(w io.Writer, stor zodb.IStorage, tidMin, tidMax zodb.Tid, hashOnly
}
}
// XXX check err
// XXX check err
return
nil
}
}
func
usage
()
{
func
usage
()
{
...
...
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