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
ddf5e478
Commit
ddf5e478
authored
Feb 22, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
11ecd687
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
12 deletions
+151
-12
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+27
-12
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+124
-0
No files found.
t/neo/storage/fs1/py/gen-testdata
View file @
ddf5e478
...
...
@@ -85,6 +85,8 @@ def main():
u"undo %i.%i
\
n
more detailed description
\
n
\
n
zzz ..."
%
(
i
,
j
)
+
"
\
t
"
*
(
i
+
j
),
{
"x-generator"
:
"zodb/py2 (undo %s)"
%
ul
[
"id"
]})
# TODO delete an object
conn
.
close
()
db
.
close
()
stor
.
close
()
...
...
@@ -105,44 +107,57 @@ def main():
# database records
stor
=
FileStorage
(
outfs
,
read_only
=
True
)
oidPrevPos
=
{}
# oid -> pos of last drec(oid)
#
oidPrevPos = {} # oid -> pos of last drec(oid)
emit
(
"
\
n
var _1fs_dbEntryv = [...]dbEntry{"
)
for
txn
in
stor
.
iterator
():
# txn is TransactionRecord
# txn.extension is already depickled dict - we want to put raw data from file
# also we need to access txn record legth which is not provided by higher-level iterator
# do deep-dive into FileStorage
h
=
stor
.
_read_txn_header
(
txn
.
_tpos
)
assert
h
.
tid
==
txn
.
tid
assert
h
.
tlen
==
txn
.
_tend
-
txn
.
_tpos
t
h
=
stor
.
_read_txn_header
(
txn
.
_tpos
)
assert
t
h
.
tid
==
txn
.
tid
assert
t
h
.
tlen
==
txn
.
_tend
-
txn
.
_tpos
# -> TxnHeader
emit
(
"
\
t
TxnHeader{"
)
emit
(
"
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
txn
.
tid
))
emit
(
"
\
t
\
t
RecLenm8:
\
t
%i,"
%
h
.
tlen
)
emit
(
"
\
t
\
t
RecLenm8:
\
t
%i,"
%
t
h
.
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
\
"
),"
%
h
.
ext
.
encode
(
'string_escape'
))
# txn: ._pos ._tend ._tpos
emit
(
"
\
t
\
t
Extension:
\
t
[]byte(
\
"
%s
\
"
),"
%
th
.
ext
.
encode
(
'string_escape'
))
# -> DataHeader + payload
for
drec
in
txn
:
# drec is itemof(TransactionRecordIterator) = Record
# same as with txn - not everything is possible to get via
# higher-level api
dh
=
stor
.
_read_data_header
(
drec
.
pos
)
assert
dh
.
oid
==
drec
.
oid
assert
dh
.
tid
==
drec
.
tid
assert
dh
.
tloc
==
txn
.
_tpos
emit
(
"
\
n
\
t
\
t
DataHeader{"
)
emit
(
"
\
t
\
t
\
t
Oid:
\
t
%i,"
%
unpack64
(
drec
.
oid
))
emit
(
"
\
t
\
t
\
t
Tid:
\
t
%s,"
%
hex64
(
drec
.
tid
))
# drec: .data .prev (=prev_txn)
.pos
# drec: .data .prev (=prev_txn)
emit
(
"
\
t
\
t
\
t
PrevDataRecPos:
\
t
%i,"
%
oidPrevPos
.
get
(
drec
.
oid
,
0
))
#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
==
''
# DataLen
emit
(
"
\
t
\
t
\
t
DataLen:
\
t
%i,"
%
dh
.
plen
)
plen
=
dh
.
plen
if
plen
==
0
:
data
=
p64
(
dh
.
back
)
# back-pointer or 0 (= delete)
else
:
data
=
drec
.
data
emit
(
"
\
t
\
t
\
t
Data:
\
t
[]byte(
\
"
%s
\
"
),"
%
data
.
encode
(
'string_escape'
))
#.data .data_txn
emit
(
"
\
t
\
t
},"
)
oidPrevPos
[
drec
.
oid
]
=
drec
.
pos
#
oidPrevPos[drec.oid] = drec.pos
emit
(
"
\
t
},"
)
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
ddf5e478
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