Commit 6fa72a36 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6f4c288b
......@@ -633,6 +633,12 @@ def watch(w, zf, at): # XXX -> ?
at_from = '(%s ->) ' % t.hat(at_prev)
print('\nC: setup watch f<%s> %s%s' % (h(zf._p_oid), at_from, t.hat(at)))
# pinstr returns human-readable representation for {}blk->rev
def pinstr(pin):
pinv = ['%d: %s' % (blk, t.hat(pin[blk])) for blk in sorted(pin.keys())]
return '{%s}' % ', '.join(pinv)
pin_prev = {}
if at_prev is not None:
assert at_prev <= at, 'TODO %s -> %s' % (t.hat(at_prev), t.hat(at))
......@@ -640,7 +646,8 @@ def watch(w, zf, at): # XXX -> ?
pin = w._pinAt(zf, at)
print('\n%s\n%s' % (pin_prev, pin))
if at_prev != at and at_prev is not None:
print('\n%s\n%s' % (pinstr(pin_prev), pinstr(pin)))
for blk in set(pin_prev.keys()).union(pin.keys()):
# blk ∉ pin_prev, blk ∉ pin -> cannot happen
......@@ -661,13 +668,12 @@ def watch(w, zf, at): # XXX -> ?
if pin_prev[blk] == pin[blk]:
del pin[blk] # would need to pin to what it is already pinned
print('-> %s' % pin)
print('-> %s' % pinstr(pin))
# {} blk -> at that have to be pinned
# XXX also check that head/file[blk] is in cache - else no need to pin
pinok = pin
pinokv = ['%d: %s' % (blk, t.hat(pinok[blk])) for blk in sorted(pinok.keys())]
print('# pinok: {%s}' % ', '.join(pinokv))
print('# pinok: %s' % pinstr(pinok))
# send watch request and check that we receive pins for in-cache blocks
# changed > at.
......@@ -816,12 +822,12 @@ def test_wcfs():
w.close()
# watch going at_i -> at_j
print('\n--------')
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)
......
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