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
fd9e0bfe
Commit
fd9e0bfe
authored
Mar 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d972be0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
t/neo/storage/fs1/index.go
t/neo/storage/fs1/index.go
+19
-4
t/neo/zodb/cmd/zodbdump/zodbdump.go
t/neo/zodb/cmd/zodbdump/zodbdump.go
+3
-1
No files found.
t/neo/storage/fs1/index.go
View file @
fd9e0bfe
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"encoding/binary"
"encoding/binary"
"fmt"
"fmt"
"io"
"io"
"math/big"
"net"
"net"
"os"
"os"
"strconv"
"strconv"
...
@@ -68,7 +69,7 @@ const (
...
@@ -68,7 +69,7 @@ const (
// IndexSaveError is the error type returned by index save routines
// IndexSaveError is the error type returned by index save routines
type
IndexSaveError
struct
{
type
IndexSaveError
struct
{
Err
error
// error that occured during the operation
Err
error
// error that occur
r
ed during the operation
}
}
func
(
e
*
IndexSaveError
)
Error
()
string
{
func
(
e
*
IndexSaveError
)
Error
()
string
{
...
@@ -190,6 +191,20 @@ func (e *IndexLoadError) Error() string {
...
@@ -190,6 +191,20 @@ func (e *IndexLoadError) Error() string {
return
s
return
s
}
}
// xint64 tries to convert unpickled value to int64
func
xint64
(
xv
interface
{})
(
v
int64
,
ok
bool
)
{
switch
v
:=
xv
.
(
type
)
{
case
int64
:
return
v
,
true
case
*
big
.
Int
:
if
v
.
IsInt64
()
{
return
v
.
Int64
(),
true
}
}
return
0
,
false
}
// LoadIndex loads index from a reader
// LoadIndex loads index from a reader
func
LoadIndex
(
r
io
.
Reader
)
(
topPos
int64
,
fsi
*
fsIndex
,
err
error
)
{
func
LoadIndex
(
r
io
.
Reader
)
(
topPos
int64
,
fsi
*
fsIndex
,
err
error
)
{
var
picklePos
int64
var
picklePos
int64
...
@@ -207,9 +222,9 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) {
...
@@ -207,9 +222,9 @@ func LoadIndex(r io.Reader) (topPos int64, fsi *fsIndex, err error) {
if
err
!=
nil
{
if
err
!=
nil
{
goto
out
goto
out
}
}
topPos
,
ok
=
x
topPos
.
(
int64
)
topPos
,
ok
=
x
int64
(
xtopPos
)
if
!
ok
{
if
!
ok
{
err
=
fmt
.
Errorf
(
"topPos is %T
(expected int64)"
,
xtopPos
)
err
=
fmt
.
Errorf
(
"topPos is %T
:%v (expected int64)"
,
xtopPos
,
xtopPos
)
goto
out
goto
out
}
}
...
@@ -366,7 +381,7 @@ func (r *BufReader) InputOffset() int64 {
...
@@ -366,7 +381,7 @@ func (r *BufReader) InputOffset() int64 {
}
}
// IOName returns a "filename" associated with io.Reader, io.Writer, net.Conn, ...
// IOName returns a "filename" associated with io.Reader, io.Writer, net.Conn, ...
// if name cannot be deterined - "" is returned.
// if name cannot be deter
m
ined - "" is returned.
func
IOName
(
f
interface
{})
string
{
func
IOName
(
f
interface
{})
string
{
switch
f
:=
f
.
(
type
)
{
switch
f
:=
f
.
(
type
)
{
case
*
os
.
File
:
case
*
os
.
File
:
...
...
t/neo/zodb/cmd/zodbdump/zodbdump.go
View file @
fd9e0bfe
...
@@ -103,6 +103,8 @@ out:
...
@@ -103,6 +103,8 @@ out:
// DumpTxn dumps one transaction record
// DumpTxn dumps one transaction record
func
(
d
*
dumper
)
DumpTxn
(
txni
*
zodb
.
TxnInfo
,
dataIter
zodb
.
IStorageRecordIterator
)
error
{
func
(
d
*
dumper
)
DumpTxn
(
txni
*
zodb
.
TxnInfo
,
dataIter
zodb
.
IStorageRecordIterator
)
error
{
var
datai
*
zodb
.
StorageRecordInformation
// LF in-between txn records
// LF in-between txn records
vskip
:=
"
\n
"
vskip
:=
"
\n
"
if
!
d
.
afterFirst
{
if
!
d
.
afterFirst
{
...
@@ -118,7 +120,7 @@ func (d *dumper) DumpTxn(txni *zodb.TxnInfo, dataIter zodb.IStorageRecordIterato
...
@@ -118,7 +120,7 @@ func (d *dumper) DumpTxn(txni *zodb.TxnInfo, dataIter zodb.IStorageRecordIterato
// data records
// data records
for
{
for
{
datai
,
err
:
=
dataIter
.
NextData
()
datai
,
err
=
dataIter
.
NextData
()
if
err
!=
nil
{
if
err
!=
nil
{
if
err
==
io
.
EOF
{
if
err
==
io
.
EOF
{
err
=
nil
// XXX -> okEOF ?
err
=
nil
// XXX -> okEOF ?
...
...
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