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
a3553578
Commit
a3553578
authored
Feb 22, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7e364c72
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1308 additions
and
941 deletions
+1308
-941
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+15
-0
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+22
-14
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+1271
-927
No files found.
t/neo/storage/fs1/filestorage_test.go
0 → 100644
View file @
a3553578
// XXX license/copyright
package
fs1
// one entry inside transaction
type
txnEntry
struct
{
header
DataHeader
data
[]
byte
}
type
dbEntry
struct
{
header
TxnHeader
// TODO user, desc, ext
Recordv
[]
txnEntry
}
t/neo/storage/fs1/py/gen-testdata
View file @
a3553578
...
@@ -124,16 +124,21 @@ def main():
...
@@ -124,16 +124,21 @@ def main():
assert
th
.
tid
==
txn
.
tid
assert
th
.
tid
==
txn
.
tid
assert
th
.
tlen
==
txn
.
_tend
-
txn
.
_tpos
assert
th
.
tlen
==
txn
.
_tend
-
txn
.
_tpos
emit
(
"
\
t
{"
)
# -> TxnHeader
# -> TxnHeader
emit
(
"
\
t
TxnHeader{"
)
emit
(
"
\
t
\
t
TxnHeader{"
)
emit
(
"
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
txn
.
tid
))
emit
(
"
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
txn
.
tid
))
emit
(
"
\
t
\
t
RecLenm8:
\
t
%i,"
%
th
.
tlen
)
emit
(
"
\
t
\
t
\
t
RecLenm8:
\
t
%i,"
%
th
.
tlen
)
emit
(
"
\
t
\
t
Status:
\
t
'%s',"
%
txn
.
status
)
emit
(
"
\
t
\
t
\
t
Status:
\
t
'%s',"
%
txn
.
status
)
emit
(
"
\
t
\
t
User:
\
t
\
t
[]byte(%s),"
%
escapeqq
(
txn
.
user
))
emit
(
"
\
t
\
t
\
t
User:
\
t
\
t
[]byte(%s),"
%
escapeqq
(
txn
.
user
))
emit
(
"
\
t
\
t
Description:
\
t
[]byte(%s),"
%
escapeqq
(
txn
.
description
))
emit
(
"
\
t
\
t
\
t
Description:
\
t
[]byte(%s),"
%
escapeqq
(
txn
.
description
))
emit
(
"
\
t
\
t
Extension:
\
t
[]byte(%s),"
%
escapeqq
(
th
.
ext
))
emit
(
"
\
t
\
t
\
t
Extension:
\
t
[]byte(%s),"
%
escapeqq
(
th
.
ext
))
emit
(
"
\
t
\
t
},"
)
# -> DataHeader + payload
# -> DataHeader + payload
emit
(
"
\
n
\
t
\
t
[]txnEntry{"
)
for
drec
in
txn
:
# drec is itemof(TransactionRecordIterator) = Record
for
drec
in
txn
:
# drec is itemof(TransactionRecordIterator) = Record
# same as with txn - not everything is possible to get via
# same as with txn - not everything is possible to get via
# higher-level api
# higher-level api
...
@@ -142,22 +147,25 @@ def main():
...
@@ -142,22 +147,25 @@ def main():
assert
dh
.
tid
==
drec
.
tid
assert
dh
.
tid
==
drec
.
tid
assert
dh
.
tloc
==
txn
.
_tpos
assert
dh
.
tloc
==
txn
.
_tpos
emit
(
"
\
n
\
t
\
t
DataHeader{"
)
emit
(
"
\
t
\
t
\
t
{"
)
emit
(
"
\
t
\
t
\
t
Oid:
\
t
%i,"
%
unpack64
(
drec
.
oid
))
emit
(
"
\
t
\
t
\
t
\
t
DataHeader{"
)
emit
(
"
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
emit
(
"
\
t
\
t
\
t
\
t
\
t
Oid:
\
t
%i,"
%
unpack64
(
drec
.
oid
))
emit
(
"
\
t
\
t
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
# drec: .data .prev (=prev_txn)
# drec: .data .prev (=prev_txn)
emit
(
"
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
dh
.
prev
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
dh
.
prev
)
emit
(
"
\
t
\
t
\
t
TxnPos:
\
t
%i,"
%
txn
.
_tpos
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
TxnPos:
\
t
%i,"
%
txn
.
_tpos
)
assert
drec
.
version
==
''
assert
drec
.
version
==
''
emit
(
"
\
t
\
t
\
t
DataLen:
\
t
%i,"
%
dh
.
plen
)
emit
(
"
\
t
\
t
\
t
\
t
\
t
DataLen:
\
t
%i,"
%
dh
.
plen
)
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)
data
=
p64
(
dh
.
back
)
# back-pointer or 0 (= delete)
else
:
else
:
data
=
drec
.
data
data
=
drec
.
data
emit
(
"
\
t
\
t
\
t
Data:
\
t
[]byte(%s),"
%
escapeqq
(
data
))
emit
(
"
\
t
\
t
\
t
\
t
Data:
\
t
[]byte(%s),"
%
escapeqq
(
data
))
emit
(
"
\
t
\
t
\
t
},"
)
#.data .data_txn
#.data .data_txn
emit
(
"
\
t
\
t
},"
)
emit
(
"
\
t
\
t
},"
)
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
a3553578
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