Commit f80b498d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d9c07dff
...@@ -730,11 +730,13 @@ def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev ...@@ -730,11 +730,13 @@ def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev
return pin return pin
# watch sets up a watch for file@at. # watch sets up or adjusts a watch for file@at.
# XXX and verifies that wcfs sends correct initial pins? #
# XXX or adjusts # During setup it verifies that wcfs sends correct initial pins.
#
# pinok can be None - in that case it is computed automatically.
@func(tWatchLink) @func(tWatchLink)
def watch(twlink, zf, at): # XXX -> ? def watch(twlink, zf, at, pinok=None): # XXX -> ?
t = twlink.tdb t = twlink.tdb
at_prev = twlink._watching.get(zf) # we were previously watching zf @at_prev at_prev = twlink._watching.get(zf) # we were previously watching zf @at_prev
at_from = '' at_from = ''
...@@ -786,6 +788,8 @@ def watch(twlink, zf, at): # XXX -> ? ...@@ -786,6 +788,8 @@ def watch(twlink, zf, at): # XXX -> ?
# {} 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
if pinok is not None:
assert pinok == pin, "explicit pinok != computed pinok"
pinok = pin pinok = pin
print('# pinok: %s' % pinstr(pinok)) print('# pinok: %s' % pinstr(pinok))
...@@ -952,7 +956,7 @@ def test_wcfs(): ...@@ -952,7 +956,7 @@ def test_wcfs():
# f @at2 # f @at2
f2.assertCache([0,0,1,0]) f2.assertCache([0,0,1,0])
f2.assertData (['','','2c','2d']) # XXX mtime=at2 f2.assertData (['','','2c','2d']) # XXX mtime=at2?
# f @at1 # f @at1
f1.assertCache([1,1,1]) f1.assertCache([1,1,1])
...@@ -968,7 +972,7 @@ def test_wcfs(): ...@@ -968,7 +972,7 @@ def test_wcfs():
# >>> XXX commit data to not yet accessed f part - nothing happens # >>> XXX commit data to not yet accessed f part - nothing happens
""" # """
# >>> invalidation protocol # >>> invalidation protocol
print('\n\n inv. protocol \n\n') print('\n\n inv. protocol \n\n')
...@@ -996,7 +1000,10 @@ def test_wcfs(): ...@@ -996,7 +1000,10 @@ def test_wcfs():
" head/at (@%s); …" % (h(zf._p_oid), h(atpast), h(t.head))) " head/at (@%s); …" % (h(zf._p_oid), h(atpast), h(t.head)))
wl.close() wl.close()
# valid watch requests going at_i -> at_j -> ... # some watch requests with explicit pinok
# XXX
# valid watch requests going at_i -> at_j -> ... with automatic pinok
for zf in t.zfiles(): for zf in t.zfiles():
for revv in t.iter_revv(): for revv in t.iter_revv():
print('\n--------') print('\n--------')
...@@ -1007,7 +1014,7 @@ def test_wcfs(): ...@@ -1007,7 +1014,7 @@ def test_wcfs():
for at in revv[1:]: for at in revv[1:]:
wl.watch(zf, at) wl.watch(zf, at)
wl.close() wl.close()
""" # """
print('\n\n\n\nWATCH+COMMIT\n\n\n\n') print('\n\n\n\nWATCH+COMMIT\n\n\n\n')
......
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