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
3c9bd064
Commit
3c9bd064
authored
May 21, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0e6afd21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+31
-22
No files found.
wcfs/wcfs_test.py
View file @
3c9bd064
...
...
@@ -31,6 +31,7 @@ from wendelin import wcfs
import
transaction
from
persistent
import
Persistent
from
persistent.timestamp
import
TimeStamp
from
ZODB.utils
import
z64
import
os
,
os
.
path
,
subprocess
,
threading
from
errno
import
EINVAL
...
...
@@ -305,6 +306,23 @@ class tDB:
zfs
.
add
(
zf
)
return
zfs
# iter_revv iterates through all possible at_i -> at_j -> at_k ... sequences.
# at_i < at_j
# XXX all sequences go till head.
def
iter_revv
(
t
,
start
=
z64
,
level
=
0
):
dFtail
=
[
_
for
_
in
t
.
dFtail
if
_
.
rev
>
start
]
#print(' '*level, 'iter_revv', t.hat(start), [t.hat(_.rev) for _ in dFtail])
if
len
(
dFtail
)
==
0
:
yield
[]
return
for
dF
in
dFtail
:
#print(' '*level, 'QQQ', t.hat(dF.rev))
for
tail
in
t
.
iter_revv
(
start
=
dF
.
rev
,
level
=
level
+
1
):
#print(' '*level, 'zzz', tail)
yield
([
dF
.
rev
]
+
tail
)
# tFile provides testing environment for one bigfile on wcfs.
#
...
...
@@ -653,7 +671,7 @@ def watch(w, zf, at): # XXX -> ?
pin
=
w
.
_pinAt
(
zf
,
at
)
if
at_prev
!=
at
and
at_prev
is
not
None
:
print
(
'
\
n
%s
\
n
%s'
%
(
pinstr
(
pin_prev
),
pinstr
(
pin
)))
print
(
'
# pin@old: %s
\
n
# pin@new:
%s'
%
(
pinstr
(
pin_prev
),
pinstr
(
pin
)))
for
blk
in
set
(
pin_prev
.
keys
()).
union
(
pin
.
keys
()):
# blk ∉ pin_prev, blk ∉ pin -> cannot happen
...
...
@@ -825,32 +843,25 @@ def test_wcfs():
print
(
'
\
n
\
n
inv. protocol
\
n
\
n
'
)
for
zf
in
t
.
zfiles
():
# watch from scratch
for
dF
in
t
.
dFtail
:
# watch going at_i -> at_j -> ...
for
revv
in
t
.
iter_revv
():
print
(
'
\
n
--------'
)
#print(' -> '.join([t.hat(_) for _ in revv]))
w
=
t
.
openwatch
()
w
.
watch
(
zf
,
dF
.
rev
)
w
.
watch
(
zf
,
revv
[
0
])
w
.
watch
(
zf
,
revv
[
0
])
# verify at_i -> at_i
for
at
in
revv
[
1
:]:
w
.
watch
(
zf
,
at
)
w
.
close
()
# watch going at_i -> at_j
for
dF_from
in
t
.
dFtail
:
for
dF_to
in
t
.
dFtail
:
if
not
(
dF_from
.
rev
<=
dF_to
.
rev
):
continue
# FIXME TODO test all directions
print
(
'
\
n
--------'
)
w
=
t
.
openwatch
()
w
.
watch
(
zf
,
dF_from
.
rev
)
w
.
watch
(
zf
,
dF_to
.
rev
)
w
.
close
()
print
()
# watch going at1 -> at2 -> at3
print
(
'
\
n
--------'
)
print
()
# XXX invalid requests -> wcfs replies with error
# XXX going not only up, but also down at1 <- at2 <- at3 ? -> forbid?
# XXX watched + commit -> receive pin messages
# XXX both from scratch and going e.g. at1 -> at2 -> at3
# XXX going not only up, but also down at1 <- at2 <- at3 ? -> forbid
# XXX 2 (or more) opened watch for 1 file at the same time
# XXX watch for 2 files via single watch open
...
...
@@ -867,8 +878,6 @@ def test_wcfs():
# XXX new watch request while previous watch request is in progress (over the same /head/watch handle)
# XXX invalid requests -> wcfs replies with error
# XXX blk not initially covered by f.δtail (blk never accessed - f.δtail
# not updated on invalidation). then blk is accessed - what happens with
# watch that should be triggerring for this blk?
...
...
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