Commit 1a28466a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 60df26bd
...@@ -379,6 +379,7 @@ class tDB: ...@@ -379,6 +379,7 @@ class tDB:
# buf if head/<zf>[blk] was accessed again after change, and was no longer # buf if head/<zf>[blk] was accessed again after change, and was no longer
# changed, the answer is "yes" # changed, the answer is "yes"
# XXX text # XXX text
# XXX -> _blkLastRevAccessed ? _blkRevLastAccessed ? _blkHeadRevAccessed ?
""" """
def _blkHeadAccessed(t, zf, blk): def _blkHeadAccessed(t, zf, blk):
zfAccessed = t._accessed.get(zf, {}) zfAccessed = t._accessed.get(zf, {})
...@@ -885,14 +886,17 @@ class tSrvReq: ...@@ -885,14 +886,17 @@ class tSrvReq:
# ---- watch setup/adjust ---- # ---- watch setup/adjust ----
# _pinAt returns which blocks needs to be pinned for zf@at. # _pinAt returns which blocks needs to be pinned for zf@at compared to zf@head
# according to wcfs invalidation protocol.
# #
# it does not take into account whether blocks are in cache or not and computes # It does not take into account whether blocks are in cache or not and computes
# pins for all changes. XXX is it desired behaviour? # pins as if all blocks @head were accesses - i.e. considering all file changes
@func(tWatchLink) # in (at, head] range.
def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev #
t = twlink.tdb # The caller has to take cached/not-cached effect into account on its own
# (see tDB._accessed & friends)
@func(tDB)
def _pinAt(t, zf, at): # -> pin = {} blk -> rev
# XXX dup in _blkData # XXX dup in _blkData
# all changes to zf # all changes to zf
...@@ -950,10 +954,10 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ? ...@@ -950,10 +954,10 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
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))
pin_prev = twlink._pinAt(zf, at_prev) pin_prev = t._pinAt(zf, at_prev)
assert w.pinned == pin_prev # XXX & blkHeadAccessedRev > w.at assert w.pinned == pin_prev # XXX & blkHeadAccessedRev > w.at
pin = twlink._pinAt(zf, at) pin = t._pinAt(zf, at)
if at_prev != at and at_prev is not None: if at_prev != at and at_prev is not None:
print('# pin@old: %s\n# pin@new: %s' % (pinstr(pin_prev), pinstr(pin))) print('# pin@old: %s\n# pin@new: %s' % (pinstr(pin_prev), pinstr(pin)))
...@@ -991,7 +995,7 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ? ...@@ -991,7 +995,7 @@ def watch(twlink, zf, at, pinok=None): # XXX -> ?
twlink._watch(zf, at, pinok, "ok") twlink._watch(zf, at, pinok, "ok")
w.at = at w.at = at
assert w.pinned == twlink._pinAt(zf, at) assert w.pinned == t._pinAt(zf, at)
# stop_watch instructs wlink to stop watching the file. # stop_watch instructs wlink to stop watching the file.
......
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