Commit d1650e46 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3e488c7a
......@@ -857,7 +857,7 @@ class tSrvReq:
# The automatic computation of pinok is verified against explicitly provided
# pinok when it is present.
@func(tWatchLink)
def watch(twlink, zf, at, pinok=None): # XXX -> tWatch ?
def watch(twlink, zf, at, pinok=None): # -> tWatch
t = twlink.tdb
w = twlink._watching.get(zf)
if w is None:
......@@ -929,6 +929,7 @@ def watch(twlink, zf, at, pinok=None): # XXX -> tWatch ?
w.at = at
assert w.pinned == t._needPinAt(zf, at) # XXX & headOfBlkAccess
return w
# stop_watch instructs wlink to stop watching the file.
......@@ -1099,6 +1100,7 @@ def _blkRevAt(t, zf, blk, at): # -> rev
_, rev = t._blkDataAt(zf, blk, at)
return rev
# XXX kill
# XXX vvv -> not what we need, think again
# _blkHeadAccessed returns whether block state corresponding to zf[blk] at
# current head was accessed.
......@@ -1115,6 +1117,7 @@ def _blkHeadAccessed(t, zf, blk):
zfAccessed.get(blk) vs t._blkRevAt(zf, blk, t.head)
"""
# XXX -> _pinDeltaAt ?
# _needPinAt returns which blocks needs to be pinned for zf@at compared to zf@head
# according to wcfs invalidation protocol.
#
......@@ -1312,10 +1315,18 @@ def test_wcfs():
print('\n--------')
print(' -> '.join([t.hat(_) for _ in revv]))
wl = t.openwatch()
wl.watch(zf, revv[0])
w = wl.watch(zf, revv[0])
wl.watch(zf, revv[0]) # verify at_i -> at_i
for at in revv[1:]:
wl.watch(zf, at)
# at_i -> at_j -> at_k must be the same as ø -> at_k
wl_ = t.openwatch()
w_ = wl_.watch(zf, at)
assert w.at == w_.at
assert w.pinned == w_.pinned
wl_.close()
wl.close()
# """
......@@ -1326,21 +1337,15 @@ def test_wcfs():
#
# 5(f) is kept not accessed to check later how wcfs.go handles δFtail
# rebuild after it sees not yet accessed ZBlk that has change history.
wl3 = t.openwatch(); wl3.watch(zf, at3); assert at3 == t.head
assert set(wl3._watching.keys()) == {zf}
w3 = wl3._watching[zf]
wl3 = t.openwatch(); w3 = wl3.watch(zf, at3); assert at3 == t.head
assert w3.at == at3
assert w3.pinned == {}
wl3_ = t.openwatch(); wl3_.watch(zf, at3)
assert set(wl3_._watching.keys()) == {zf}
w3_ = wl3_._watching[zf]
wl3_ = t.openwatch(); w3_ = wl3_.watch(zf, at3)
assert w3_.at == at3
assert w3_.pinned == {}
wl2 = t.openwatch(); wl2.watch(zf, at2)
assert set(wl2._watching.keys()) == {zf}
w2 = wl2._watching[zf]
wl2 = t.openwatch(); w2 = wl2.watch(zf, at2)
assert w2.at == at2
assert w2.pinned == {2: at2}
......
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