Commit 3c9bd064 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0e6afd21
...@@ -31,6 +31,7 @@ from wendelin import wcfs ...@@ -31,6 +31,7 @@ from wendelin import wcfs
import transaction import transaction
from persistent import Persistent from persistent import Persistent
from persistent.timestamp import TimeStamp from persistent.timestamp import TimeStamp
from ZODB.utils import z64
import os, os.path, subprocess, threading import os, os.path, subprocess, threading
from errno import EINVAL from errno import EINVAL
...@@ -305,6 +306,23 @@ class tDB: ...@@ -305,6 +306,23 @@ class tDB:
zfs.add(zf) zfs.add(zf)
return zfs 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. # tFile provides testing environment for one bigfile on wcfs.
# #
...@@ -653,7 +671,7 @@ def watch(w, zf, at): # XXX -> ? ...@@ -653,7 +671,7 @@ def watch(w, zf, at): # XXX -> ?
pin = w._pinAt(zf, at) pin = w._pinAt(zf, at)
if at_prev != at and at_prev is not None: 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()): for blk in set(pin_prev.keys()).union(pin.keys()):
# blk ∉ pin_prev, blk ∉ pin -> cannot happen # blk ∉ pin_prev, blk ∉ pin -> cannot happen
...@@ -825,32 +843,25 @@ def test_wcfs(): ...@@ -825,32 +843,25 @@ def test_wcfs():
print('\n\n inv. protocol \n\n') print('\n\n inv. protocol \n\n')
for zf in t.zfiles(): for zf in t.zfiles():
# watch from scratch # watch going at_i -> at_j -> ...
for dF in t.dFtail: for revv in t.iter_revv():
w = t.openwatch()
w.watch(zf, dF.rev)
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--------') print('\n--------')
#print(' -> '.join([t.hat(_) for _ in revv]))
w = t.openwatch() w = t.openwatch()
w.watch(zf, dF_from.rev) w.watch(zf, revv[0])
w.watch(zf, dF_to.rev) w.watch(zf, revv[0]) # verify at_i -> at_i
for at in revv[1:]:
w.watch(zf, at)
w.close() w.close()
# watch going at1 -> at2 -> at3
print('\n--------')
print() print()
# XXX both from scratch and going e.g. at1 -> at2 -> at3 # XXX invalid requests -> wcfs replies with error
# XXX going not only up, but also down at1 <- at2 <- at3 ? -> forbid # XXX going not only up, but also down at1 <- at2 <- at3 ? -> forbid?
# XXX watched + commit -> receive pin messages
# XXX 2 (or more) opened watch for 1 file at the same time # XXX 2 (or more) opened watch for 1 file at the same time
# XXX watch for 2 files via single watch open # XXX watch for 2 files via single watch open
...@@ -867,8 +878,6 @@ def test_wcfs(): ...@@ -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 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 # XXX blk not initially covered by f.δtail (blk never accessed - f.δtail
# not updated on invalidation). then blk is accessed - what happens with # not updated on invalidation). then blk is accessed - what happens with
# watch that should be triggerring for this blk? # watch that should be triggerring for this blk?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment