Commit 78c54e48 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b10e08f4
...@@ -849,7 +849,7 @@ class tSrvReq: ...@@ -849,7 +849,7 @@ class tSrvReq:
# watch sets up or adjusts a watch for file@at. # watch sets up or adjusts a watch for file@at.
# #
# During setup it verifies that wcfs sends correct initial pins. # During setup it verifies that wcfs sends correct initial/update pins.
# #
# pinok: {} blk -> rev # pinok: {} blk -> rev
# pinok can be omitted - in that case it is computed automatically. # pinok can be omitted - in that case it is computed automatically.
...@@ -857,11 +857,11 @@ class tSrvReq: ...@@ -857,11 +857,11 @@ class tSrvReq:
# The automatic computation of pinok is verified against explicitly provided # The automatic computation of pinok is verified against explicitly provided
# pinok when it is present. # pinok when it is present.
# #
# Criteria for when blk must be pinned: # Criteria for when blk must be pinned as of @at view:
# #
# blk ∈ pin(at) <=> ∃ r = rev(blk): # blk ∈ pinned(at) <=> ∃ r = rev(blk):
# 1) at < r ; block was changed after at # 1) at < r ; block was changed after at
# 2) r ≤ headOfAccess(blk) ; block revision changed after at was accessed # 2) r ≤ headOfAccess(blk) ; block revision changed after at was accessed
@func(tWatchLink) @func(tWatchLink)
def watch(twlink, zf, at, pinok=None): # -> tWatch def watch(twlink, zf, at, pinok=None): # -> tWatch
t = twlink.tdb t = twlink.tdb
...@@ -940,7 +940,10 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch ...@@ -940,7 +940,10 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
twlink._watch(zf, at, pinok, "ok") twlink._watch(zf, at, pinok, "ok")
w.at = at w.at = at
# `watch ... -> at_i -> at_j` must be the same as `watch ø -> at_j`
assert w.pinned == t._needPinAt(zf, at) # XXX & headOfBlkAccess assert w.pinned == t._needPinAt(zf, at) # XXX & headOfBlkAccess
return w return w
...@@ -1327,18 +1330,10 @@ def test_wcfs(): ...@@ -1327,18 +1330,10 @@ def test_wcfs():
print('\n--------') print('\n--------')
print(' -> '.join([t.hat(_) for _ in revv])) print(' -> '.join([t.hat(_) for _ in revv]))
wl = t.openwatch() wl = t.openwatch()
w = wl.watch(zf, revv[0]) wl.watch(zf, revv[0])
wl.watch(zf, revv[0]) # verify at_i -> at_i wl.watch(zf, revv[0]) # verify at_i -> at_i
for at in revv[1:]: for at in revv[1:]:
wl.watch(zf, at) 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() wl.close()
# """ # """
......
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