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
bb27d8c8
Commit
bb27d8c8
authored
Dec 18, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
702c62e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
go/zodb/storage/fs1/py/gen-testdata
go/zodb/storage/fs1/py/gen-testdata
+36
-1
go/zodb/storage/fs1/testdata/1voted.tail
go/zodb/storage/fs1/testdata/1voted.tail
+0
-0
No files found.
go/zodb/storage/fs1/py/gen-testdata
View file @
bb27d8c8
...
...
@@ -21,7 +21,10 @@
"""generate reference fs1 database and index for tests"""
from
ZODB.FileStorage
import
FileStorage
from
zodbtools.test.gen_testdata
import
gen_testdb
from
ZODB
import
DB
from
zodbtools.test.gen_testdata
import
gen_testdb
,
precommit
from
os
import
stat
,
remove
from
shutil
import
copyfile
from
golang.gcompat
import
qq
import
struct
...
...
@@ -133,6 +136,38 @@ def main():
emit
(
"
\
t
\
t
},"
)
emit
(
"
\
t
},"
)
emit
(
"}"
)
stor
.
close
()
# prepare file with voted (not fully committed) tail
voted
=
"testdata/1voted.fs"
copyfile
(
outfs
,
voted
)
vstor
=
FileStorage
(
voted
)
vdb
=
DB
(
vstor
)
vconn
=
vdb
.
open
()
vroot
=
vconn
.
root
()
vroot
.
_p_activate
()
# to know its current serial
txn
=
precommit
(
u"author"
,
u"description"
,
{
'aaa'
:
'bbb'
})
vstor
.
tpc_begin
(
txn
)
vstor
.
store
(
vroot
.
_p_oid
,
vroot
.
_p_serial
,
'000 data 000'
,
''
,
txn
)
vstor
.
tpc_vote
(
txn
)
# NO tpc_finish here so that status remain 'c' (voted) instead of ' ' (committed)
st
=
stat
(
outfs
)
l
=
st
.
st_size
vf
=
open
(
voted
,
'rb'
)
vf
.
seek
(
l
)
voted_tail
=
vf
.
read
()
assert
voted_tail
[
-
1
+
8
+
8
+
1
]
==
'c'
# voted, not finished (' ')
with
open
(
"testdata/1voted.tail"
,
"wb"
)
as
vt
:
vt
.
write
(
voted_tail
)
remove
(
voted
)
remove
(
voted
+
".index"
)
remove
(
voted
+
".tmp"
)
remove
(
voted
+
".lock"
)
if
__name__
==
'__main__'
:
...
...
go/zodb/storage/fs1/testdata/1voted.tail
0 → 100644
View file @
bb27d8c8
File added
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