Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
1146656d
Commit
1146656d
authored
Jun 19, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9d00163b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+8
-9
No files found.
wcfs/wcfs_test.py
View file @
1146656d
...
...
@@ -202,7 +202,7 @@ class tDB:
tf
.
close
()
for
tw
in
t
.
_wlinks
.
copy
():
tw
.
close
()
assert
len
(
t
.
_files
)
==
0
assert
len
(
t
.
_files
)
==
0
assert
len
(
t
.
_wlinks
)
==
0
t
.
_wc_zheadfh
.
close
()
t
.
wc
.
close
()
...
...
@@ -220,7 +220,7 @@ class tDB:
# change schedules zf to be changed according changeDelta at commit.
#
# changeDelta
is
{} blk -> data.
# changeDelta
:
{} blk -> data.
# data can be both bytes and unicode.
def
change
(
t
,
zf
,
changeDelta
):
assert
isinstance
(
zf
,
ZBigFile
)
...
...
@@ -233,7 +233,7 @@ class tDB:
# commit commits transaction and makes sure wcfs is synchronized to it.
#
# It
remembers/
returns committed transaction ID.
# It
updates .dFtail and
returns committed transaction ID.
def
commit
(
t
):
# perform modifications scheduled by change.
# use !wcfs mode so that we prepare data independently of wcfs code paths.
...
...
@@ -248,11 +248,10 @@ class tDB:
memcpy
(
vma
,
data
)
dF
.
byfile
[
zf
]
=
dfile
#
NOTE there is no clean way to retrieve tid of just committed transaction
#
we use last._p_serial as workaround.
#
perform the commit. NOTE there is no clean way to retrieve tid of
#
just committed transaction -
we use last._p_serial as workaround.
t
.
root
[
'_last'
]
=
last
=
Persistent
()
last
.
_p_changed
=
1
transaction
.
commit
()
head
=
last
.
_p_serial
...
...
@@ -260,15 +259,15 @@ class tDB:
for
dfile
in
dF
.
byfile
.
values
():
dfile
.
rev
=
head
t
.
dFtail
.
append
(
dF
)
assert
t
.
head
==
head
# self-check
print
(
'
\
n
M: commit -> %s'
%
t
.
hat
(
head
))
for
zf
,
zfDelta
in
t
.
_changed
.
items
():
print
(
'M: f<%s>
\
t
%s'
%
(
h
(
zf
.
_p_oid
),
sorted
(
zfDelta
.
keys
())))
t
.
_changed
=
{}
# synchronize wcfs to db
# synchronize wcfs to db
, and we are done
t
.
_wcsync
()
return
head
# _blkaccess marks head/zf[blk] accessed.
...
...
@@ -1140,7 +1139,7 @@ def test_wcfs():
t
.
root
[
'!file'
]
=
nonfile
=
Persistent
()
t
.
root
[
'zfile'
]
=
zf
=
ZBigFile
(
blksize
)
at0
=
t
.
commit
()
at0
=
t
.
commit
()
# >>> lookup non-BigFile -> must be rejected
with
raises
(
OSError
)
as
exc
:
...
...
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