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
3b98998d
Commit
3b98998d
authored
Feb 22, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
adea442b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
15 deletions
+85
-15
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+17
-11
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+6
-4
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+62
-0
No files found.
t/neo/storage/fs1/filestorage_test.go
View file @
3b98998d
...
@@ -12,13 +12,22 @@ import (
...
@@ -12,13 +12,22 @@ import (
// one entry inside transaction
// one entry inside transaction
type
txnEntry
struct
{
type
txnEntry
struct
{
header
DataHeader
Header
DataHeader
data
[]
byte
rawData
[]
byte
// what is on disk, e.g. it can be backpointer
data
[]
byte
// data client should see on load; nil means same as RawData
}
func
(
txe
*
txnEntry
)
Data
()
[]
byte
{
data
:=
txe
.
data
if
data
==
nil
{
data
=
txe
.
rawData
}
return
data
}
}
type
dbEntry
struct
{
type
dbEntry
struct
{
h
eader
TxnHeader
H
eader
TxnHeader
e
ntryv
[]
txnEntry
E
ntryv
[]
txnEntry
}
}
func
TestLoad
(
t
*
testing
.
T
)
{
func
TestLoad
(
t
*
testing
.
T
)
{
...
@@ -28,11 +37,8 @@ func TestLoad(t *testing.T) {
...
@@ -28,11 +37,8 @@ func TestLoad(t *testing.T) {
}
}
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
for
_
,
txe
:=
range
dbe
.
entryv
{
for
_
,
txe
:=
range
dbe
.
Entryv
{
txh
:=
txe
.
header
txh
:=
txe
.
Header
if
txh
.
DataLen
==
0
{
continue
// FIXME skipping backpointers
}
xid
:=
zodb
.
Xid
{
zodb
.
XTid
{
txh
.
Tid
,
false
},
txh
.
Oid
}
// loadSerial
xid
:=
zodb
.
Xid
{
zodb
.
XTid
{
txh
.
Tid
,
false
},
txh
.
Oid
}
// loadSerial
data
,
tid
,
err
:=
fs
.
Load
(
xid
)
data
,
tid
,
err
:=
fs
.
Load
(
xid
)
...
@@ -42,8 +48,8 @@ func TestLoad(t *testing.T) {
...
@@ -42,8 +48,8 @@ func TestLoad(t *testing.T) {
if
tid
!=
txh
.
Tid
{
if
tid
!=
txh
.
Tid
{
t
.
Errorf
(
"load %v: returned tid unexpected: %v"
,
xid
)
t
.
Errorf
(
"load %v: returned tid unexpected: %v"
,
xid
)
}
}
if
!
bytes
.
Equal
(
data
,
txe
.
data
)
{
if
!
bytes
.
Equal
(
data
,
txe
.
Data
()
)
{
t
.
Errorf
(
"load %v: different data:
\n
have: %s
\n
want: %s"
,
xid
,
strconv
.
Quote
(
string
(
data
)),
strconv
.
Quote
(
string
(
txe
.
data
)))
t
.
Errorf
(
"load %v: different data:
\n
have: %s
\n
want: %s"
,
xid
,
strconv
.
Quote
(
string
(
data
)),
strconv
.
Quote
(
string
(
txe
.
Data
()
)))
}
}
}
}
}
}
...
...
t/neo/storage/fs1/py/gen-testdata
View file @
3b98998d
...
@@ -151,7 +151,6 @@ def main():
...
@@ -151,7 +151,6 @@ def main():
emit
(
"
\
t
\
t
\
t
\
t
DataHeader{"
)
emit
(
"
\
t
\
t
\
t
\
t
DataHeader{"
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
Oid:
\
t
%i,"
%
unpack64
(
drec
.
oid
))
emit
(
"
\
t
\
t
\
t
\
t
\
t
Oid:
\
t
%i,"
%
unpack64
(
drec
.
oid
))
emit
(
"
\
t
\
t
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
emit
(
"
\
t
\
t
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
# drec: .data .prev (=prev_txn)
emit
(
"
\
t
\
t
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
dh
.
prev
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
dh
.
prev
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
TxnPos:
\
t
%i,"
%
txn
.
_tpos
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
TxnPos:
\
t
%i,"
%
txn
.
_tpos
)
...
@@ -160,11 +159,14 @@ def main():
...
@@ -160,11 +159,14 @@ def main():
emit
(
"
\
t
\
t
\
t
\
t
},"
)
emit
(
"
\
t
\
t
\
t
\
t
},"
)
plen
=
dh
.
plen
plen
=
dh
.
plen
if
plen
==
0
:
if
plen
==
0
:
data
=
p64
(
dh
.
back
)
# back-pointer or 0 (= delete)
rawdata
=
p64
(
dh
.
back
)
# back-pointer or 0 (= delete)
data
=
"[]byte(%s)"
%
escapeqq
(
drec
.
data
)
# XXX vs .data = None ?
else
:
else
:
data
=
drec
.
data
rawdata
=
drec
.
data
data
=
"nil"
emit
(
"
\
t
\
t
\
t
\
t
[]byte(%s),"
%
escapeqq
(
data
))
emit
(
"
\
t
\
t
\
t
\
t
[]byte(%s),"
%
escapeqq
(
rawdata
))
emit
(
"
\
t
\
t
\
t
\
t
%s /* same as ^^^ */,"
%
data
)
emit
(
"
\
t
\
t
\
t
},"
)
emit
(
"
\
t
\
t
\
t
},"
)
emit
(
"
\
t
\
t
},"
)
emit
(
"
\
t
\
t
},"
)
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
3b98998d
This diff is collapsed.
Click to expand it.
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