Commit 22cb4a88 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 206b7ceb
......@@ -864,17 +864,6 @@ def watch(twlink, zf, at, pinok=None): # XXX -> tWatch ?
at_from = '(%s ->) ' % t.hat(at_prev)
print('\nC: setup watch f<%s> %s%s' % (h(zf._p_oid), at_from, t.hat(at)))
# pinstr returns human-readable representation for {}blk->rev
def pinstr(pin):
pinv = []
for blk in sorted(pin.keys()):
if pin[blk] is None:
s = 'head'
else:
s = t.hat(pin[blk])
pinv.append('%d: %s' % (blk, s))
return '{%s}' % ', '.join(pinv)
pin_prev = {}
if at_prev is not None:
assert at_prev <= at, 'TODO %s -> %s' % (t.hat(at_prev), t.hat(at))
......@@ -884,7 +873,7 @@ def watch(twlink, zf, at, pinok=None): # XXX -> tWatch ?
pin = t._needPinAt(zf, at)
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' % (t.hpin(pin_prev), t.hpin(pin)))
for blk in set(pin_prev.keys()).union(pin.keys()):
# blk ∉ pin_prev, blk ∉ pin -> cannot happen
......@@ -905,14 +894,14 @@ def watch(twlink, zf, at, pinok=None): # XXX -> tWatch ?
if pin_prev[blk] == pin[blk]:
del pin[blk] # would need to pin to what it is already pinned
#print('-> %s' % pinstr(pin))
#print('-> %s' % t.hpin(pin))
# {} blk -> at that have to be pinned.
# XXX also check that head/file[blk] is in cache - else no need to pin
if pinok is not None:
assert pin == pinok, "computed vs explicit pinok"
pinok = pin
print('# pinok: %s' % pinstr(pinok))
print('# pinok: %s' % t.hpin(pinok))
# send watch request and check that we receive pins for in-cache blocks
# changed > at. FIXME "in-cache" is currently not handled
......@@ -1056,7 +1045,7 @@ def _expectPin(twlink, ctx, zf, expect): # -> []tSrvReq
# ---- infrastructure: helpers to query dFtail/accessed history ----
# _blkDataAt returns expected zf[blk] data and revision as of @at database state.
# _blkDataAt returns expected zf[blk] data and its revision as of @at database state.
#
# If the block is hole - (b'', at0) is returned. XXX -> @z64?
# XXX ret for when the file did not existed at all? blk was after file size?
......@@ -1505,6 +1494,19 @@ def hat(t, at):
return "@" + h(at)
# hpin returns human-readable representation for {}blk->rev.
@func(tDB)
def hpin(t, pin):
pinv = []
for blk in sorted(pin.keys()):
if pin[blk] is None:
s = '@head'
else:
s = t.hat(pin[blk])
pinv.append('%d: %s' % (blk, s))
return '{%s}' % ', '.join(pinv)
# zfiles returns ZBigFiles that were ever changed under t.
@func(tDB)
def zfiles(t):
......
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