Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
89d48dfc
Commit
89d48dfc
authored
Jun 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
805c4b8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+21
-21
No files found.
wcfs/wcfs_test.py
View file @
89d48dfc
...
@@ -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
code
path) 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.
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment