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
7e364c72
Commit
7e364c72
authored
Feb 22, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ddf5e478
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+11
-9
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+1
-1
No files found.
t/neo/storage/fs1/py/gen-testdata
View file @
7e364c72
...
...
@@ -23,6 +23,13 @@ def unpack64(packed):
def
hex64
(
packed
):
return
'0x%016x'
%
unpack64
(
packed
)
# escape string into valid "..." string
def
escapeqq
(
s
):
# this escape almost everything except " character
q
=
s
.
encode
(
"string_escape"
)
q
=
q
.
replace
(
'"'
,
r'\"'
)
return
'"'
+
q
+
'"'
# make time.time() predictable
_xtime
=
time
.
mktime
(
time
.
strptime
(
"04 Jan 1979"
,
"%d %b %Y"
))
def
xtime
():
...
...
@@ -107,7 +114,6 @@ def main():
# database records
stor
=
FileStorage
(
outfs
,
read_only
=
True
)
#oidPrevPos = {} # oid -> pos of last drec(oid)
emit
(
"
\
n
var _1fs_dbEntryv = [...]dbEntry{"
)
for
txn
in
stor
.
iterator
():
# txn is TransactionRecord
...
...
@@ -123,9 +129,9 @@ def main():
emit
(
"
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
txn
.
tid
))
emit
(
"
\
t
\
t
RecLenm8:
\
t
%i,"
%
th
.
tlen
)
emit
(
"
\
t
\
t
Status:
\
t
'%s',"
%
txn
.
status
)
emit
(
"
\
t
\
t
User:
\
t
\
t
[]byte(
\
"
%s
\
"
),"
%
txn
.
user
.
encode
(
'string_escape'
))
emit
(
"
\
t
\
t
Description:
\
t
[]byte(
\
"
%s
\
"
),"
%
txn
.
description
.
encode
(
'string_escape'
))
emit
(
"
\
t
\
t
Extension:
\
t
[]byte(
\
"
%s
\
"
),"
%
th
.
ext
.
encode
(
'string_escape'
))
emit
(
"
\
t
\
t
User:
\
t
\
t
[]byte(
%s),"
%
escapeqq
(
txn
.
user
))
emit
(
"
\
t
\
t
Description:
\
t
[]byte(
%s),"
%
escapeqq
(
txn
.
description
))
emit
(
"
\
t
\
t
Extension:
\
t
[]byte(
%s),"
%
escapeqq
(
th
.
ext
))
# -> DataHeader + payload
for
drec
in
txn
:
# drec is itemof(TransactionRecordIterator) = Record
...
...
@@ -141,7 +147,6 @@ def main():
emit
(
"
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
# drec: .data .prev (=prev_txn)
#emit("\t\t\tPrevDataRecPos:\t%i," % oidPrevPos.get(drec.oid, 0))
emit
(
"
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
dh
.
prev
)
emit
(
"
\
t
\
t
\
t
TxnPos:
\
t
%i,"
%
txn
.
_tpos
)
assert
drec
.
version
==
''
...
...
@@ -152,14 +157,11 @@ def main():
else
:
data
=
drec
.
data
emit
(
"
\
t
\
t
\
t
Data:
\
t
[]byte(
\
"
%s
\
"
),"
%
data
.
encode
(
'string_escape'
))
emit
(
"
\
t
\
t
\
t
Data:
\
t
[]byte(
%s),"
%
escapeqq
(
data
))
#.data .data_txn
emit
(
"
\
t
\
t
},"
)
#oidPrevPos[drec.oid] = drec.pos
emit
(
"
\
t
},"
)
emit
(
"}"
)
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
7e364c72
...
...
@@ -1009,7 +1009,7 @@ var _1fs_dbEntryv = [...]dbEntry{
PrevDataRecPos
:
9498
,
TxnPos
:
9774
,
DataLen
:
0
,
Data
:
[]
byte
(
"
\x00\x00\x00\x00\x00\x00
"
\
xb2
"),
Data
:
[]
byte
(
"
\x00\x00\x00\x00\x00\x00
\
"\xb2
"
),
},
},
}
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