Commit f125140a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f64ed714
...@@ -377,9 +377,10 @@ class tDB: ...@@ -377,9 +377,10 @@ class tDB:
yield ([dF.rev] + tail) yield ([dF.rev] + tail)
# _blkData returns expected zf[blk] data and revision as of @at database state. # _blkData returns expected zf[blk] data and revision as of @at database state.
# XXX ret for blk does not exists? #
# XXX kill at=None? # If the block is hole (b'', at0) is returned. XXX -> @z64?
def _blkData(t, zf, blk, at=None): # -> (data, rev) # XXX ret for when the file did not existed at all? blk was after file size?
def _blkData(t, zf, blk, at): # -> (data, rev)
if at is None: if at is None:
at = t.head at = t.head
...@@ -393,7 +394,7 @@ class tDB: ...@@ -393,7 +394,7 @@ class tDB:
if len(blkhistoryat) == 0: if len(blkhistoryat) == 0:
# blk did not existed @at # XXX verify whether file was existing at all # blk did not existed @at # XXX verify whether file was existing at all
data = b'' data = b''
rev = None rev = t._headv[0] # was hole - at0 XXX -> pin to z64
else: else:
_ = blkhistoryat[-1] _ = blkhistoryat[-1]
data = _.ddata[blk] data = _.ddata[blk]
...@@ -402,7 +403,7 @@ class tDB: ...@@ -402,7 +403,7 @@ class tDB:
return data, rev return data, rev
# _blkRev returns expected zf[blk] revision as of @at database state? # _blkRev returns expected zf[blk] revision as of @at database state.
def _blkRev(t, zf, blk, at): # -> rev def _blkRev(t, zf, blk, at): # -> rev
_, rev = t._blkData(zf, blk, at) _, rev = t._blkData(zf, blk, at)
return rev return rev
...@@ -864,6 +865,8 @@ class tSrvReq: ...@@ -864,6 +865,8 @@ class tSrvReq:
def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev
t = twlink.tdb t = twlink.tdb
# XXX dup in _blkData
# all changes to zf # all changes to zf
vdf = [_.byfile[zf] for _ in t.dFtail if zf in _.byfile] vdf = [_.byfile[zf] for _ in t.dFtail if zf in _.byfile]
...@@ -876,7 +879,7 @@ def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev ...@@ -876,7 +879,7 @@ def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev
# history of blk changes <= at # history of blk changes <= at
blkhistoryat = [_.rev for _ in vdf if blk in _.ddata and _.rev <= at] blkhistoryat = [_.rev for _ in vdf if blk in _.ddata and _.rev <= at]
if len(blkhistoryat) == 0: if len(blkhistoryat) == 0:
pinrev = t._headv[0] # was hole - at0 XXX -> pin to @00? pinrev = t._headv[0] # was hole - at0 XXX -> pin to z64?
else: else:
pinrev = blkhistoryat[-1] pinrev = blkhistoryat[-1]
assert pinrev <= at assert pinrev <= at
......
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