Commit 488ce5e1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 47fbed49
...@@ -719,7 +719,6 @@ def watch(twlink, zf, at): # XXX -> ? ...@@ -719,7 +719,6 @@ def watch(twlink, zf, at): # XXX -> ?
pinv.append('%d: %s' % (blk, s)) pinv.append('%d: %s' % (blk, s))
return '{%s}' % ', '.join(pinv) return '{%s}' % ', '.join(pinv)
pin_prev = {} pin_prev = {}
if at_prev is not None: if at_prev is not None:
assert at_prev <= at, 'TODO %s -> %s' % (t.hat(at_prev), t.hat(at)) assert at_prev <= at, 'TODO %s -> %s' % (t.hat(at_prev), t.hat(at))
...@@ -751,11 +750,19 @@ def watch(twlink, zf, at): # XXX -> ? ...@@ -751,11 +750,19 @@ def watch(twlink, zf, at): # XXX -> ?
#print('-> %s' % pinstr(pin)) #print('-> %s' % pinstr(pin))
# {} blk -> at that have to be pinned # {} blk -> at that have to be pinned.
# XXX also check that head/file[blk] is in cache - else no need to pin # XXX also check that head/file[blk] is in cache - else no need to pin
pinok = pin pinok = pin
print('# pinok: %s' % pinstr(pinok)) print('# pinok: %s' % pinstr(pinok))
twlink._watch(zf, at, pinok, "ok")
# _watch sends watch request for zf@at, expects initial pins specified by pinok, and finaly reply.
#
# pinok: {} blk -> at that have to be pinned.
@func(tWatchLink)
def _watch(twlink, zf, at, pinok, reply):
# send watch request and check that we receive pins for in-cache blocks # send watch request and check that we receive pins for in-cache blocks
# changed > at. Use timeout to detect wcfs replying less pins than expected. # changed > at. Use timeout to detect wcfs replying less pins than expected.
# #
...@@ -781,7 +788,7 @@ def watch(twlink, zf, at): # XXX -> ? ...@@ -781,7 +788,7 @@ def watch(twlink, zf, at): # XXX -> ?
wg.go(_) wg.go(_)
def _(ctx): def _(ctx):
assert twlink.sendReq(ctx, b"watch %s @%s" % (h(zf._p_oid), h(at))) == "ok" assert twlink.sendReq(ctx, b"watch %s @%s" % (h(zf._p_oid), h(at))) == reply
# cancel _expectPin waiting upon receiving "ok" from wcfs # cancel _expectPin waiting upon receiving "ok" from wcfs
# -> error that missed pins were not received. # -> error that missed pins were not received.
cancel() cancel()
...@@ -918,8 +925,7 @@ def test_wcfs(): ...@@ -918,8 +925,7 @@ def test_wcfs():
# watch with @at < δtail.tail -> rejected # watch with @at < δtail.tail -> rejected
print('\n\nAAA\n\n') print('\n\nAAA\n\n')
wl = t.openwatch() wl = t.openwatch()
assert wl.sendReq(timeout(), b"watch %s @%s" % (h(zf._p_oid), h(p64(u64(at0)-1)))) == \ wl._watch(zf, p64(u64(at0)-1), {}, "errXXX")
"XXX"
wl.close() wl.close()
return # XXX return # XXX
......
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