Commit 89d48dfc authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 805c4b8f
...@@ -168,7 +168,7 @@ class DFile: ...@@ -168,7 +168,7 @@ class DFile:
# A BigFile opened under tDB is represented as tFile - see .open for details. # A BigFile opened under tDB is represented as tFile - see .open for details.
# A Watch opened under tDB is represented as tWatchLink - see .openwatch for details. # A Watch opened under tDB is represented as tWatchLink - see .openwatch for details.
# #
# The database can be mutated (via !wcfs path) with .change + .commit . # The database can be mutated (via !wcfs codepath) with .change + .commit .
# Current database head is represented by .head . # Current database head is represented by .head .
# The history of the changes is kept in .dFtail . # The history of the changes is kept in .dFtail .
# There are various helpers to query history (.iter_revv, _blkData, _pinAt, ...) # There are various helpers to query history (.iter_revv, _blkData, _pinAt, ...)
...@@ -190,14 +190,14 @@ class tDB: ...@@ -190,14 +190,14 @@ class tDB:
t.tail = t.root._p_jar.db().storage.lastTransaction() t.tail = t.root._p_jar.db().storage.lastTransaction()
t.dFtail = [] # of DF; head = dFtail[-1].rev t.dFtail = [] # of DF; head = dFtail[-1].rev
# when ZBigFile(s) blocks were last accessed via wcfs.
# this is updated only explicitly via ._blkaccess() .
t._accessed = {} # ZBigFile -> {} blk -> head(when accessed)
# fh(.wcfs/zhead) + history of zhead read from there # fh(.wcfs/zhead) + history of zhead read from there
t._wc_zheadfh = open(t.wc.mountpoint + "/.wcfs/zhead") t._wc_zheadfh = open(t.wc.mountpoint + "/.wcfs/zhead")
t._wc_zheadv = [] t._wc_zheadv = []
# when ZBigFile(s) blocks were last accessed via wcfs.
# this is updated only explicitly via ._blkaccess() .
t._accessed = {} # ZBigFile -> {} blk -> head(when accessed)
# tracked opened tFiles & tWatches # tracked opened tFiles & tWatches
t._files = set() t._files = set()
t._wlinks = set() t._wlinks = set()
...@@ -296,27 +296,11 @@ class tDB: ...@@ -296,27 +296,11 @@ class tDB:
assert t._read("head/at") == h(t.head) assert t._read("head/at") == h(t.head)
# _blkaccess marks head/zf[blk] accessed. # _blkaccess marks head/zf[blk] accessed.
# XXX place=? -> history query
def _blkaccess(t, zf, blk): def _blkaccess(t, zf, blk):
# XXX locking? # XXX locking?
zfAccessed = t._accessed.setdefault(zf, {}) zfAccessed = t._accessed.setdefault(zf, {})
zfAccessed[blk] = t.head zfAccessed[blk] = t.head
# XXX vvv -> not what we need, think again
# _blkHeadAccessed returns whether block state corresponding to zf[blk] at
# current head was accessed.
#
# for example - if head/<zf>[blk] was accessed and later changed, the answer is "no".
# buf if head/<zf>[blk] was accessed again after change, and was no longer
# changed, the answer is "yes"
# XXX text
# XXX -> _blkLastRevAccessed ? _blkRevLastAccessed ? _blkHeadRevAccessed ?
"""
def _blkHeadAccessed(t, zf, blk):
zfAccessed = t._accessed.get(zf, {})
zfAccessed.get(blk) vs t._blkRev(zf, blk, t.head)
"""
# _path returns path for object on wcfs. # _path returns path for object on wcfs.
# - str: wcfs root + obj; # - str: wcfs root + obj;
# - Persistent: wcfs root + (head|@<at>)/bigfile/obj # - Persistent: wcfs root + (head|@<at>)/bigfile/obj
...@@ -897,6 +881,22 @@ def _blkRev(t, zf, blk, at): # -> rev ...@@ -897,6 +881,22 @@ def _blkRev(t, zf, blk, at): # -> rev
_, rev = t._blkData(zf, blk, at) _, rev = t._blkData(zf, blk, at)
return rev return rev
# XXX vvv -> not what we need, think again
# _blkHeadAccessed returns whether block state corresponding to zf[blk] at
# current head was accessed.
#
# for example - if head/<zf>[blk] was accessed and later changed, the answer is "no".
# buf if head/<zf>[blk] was accessed again after change, and was no longer
# changed, the answer is "yes"
# XXX text
# XXX -> _blkLastRevAccessed ? _blkRevLastAccessed ? _blkHeadRevAccessed ?
"""
@func(tDB)
def _blkHeadAccessed(t, zf, blk):
zfAccessed = t._accessed.get(zf, {})
zfAccessed.get(blk) vs t._blkRev(zf, blk, t.head)
"""
# _pinAt returns which blocks needs to be pinned for zf@at compared to zf@head # _pinAt returns which blocks needs to be pinned for zf@at compared to zf@head
# according to wcfs invalidation protocol. # according to wcfs invalidation protocol.
# #
......
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