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
948b0166
Commit
948b0166
authored
Jun 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
38fd7361
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
36 deletions
+12
-36
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+12
-36
No files found.
wcfs/wcfs_test.py
View file @
948b0166
...
...
@@ -174,7 +174,7 @@ class DFile:
# The database can be mutated (via !wcfs codepath) with .change + .commit .
# Current database head is represented by .head .
# The history of the changes is kept in .dFtail .
# There are various helpers to query history (_blkDataAt, _
needPin
At, .iter_revv, ...)
# There are various helpers to query history (_blkDataAt, _
pinned
At, .iter_revv, ...)
#
# tDB must be explicitly closed once no longer used.
#
...
...
@@ -856,12 +856,6 @@ class tSrvReq:
#
# The automatic computation of pinok is verified against explicitly provided
# pinok when it is present.
#
# Criteria for when blk must be pinned as of @at view:
#
# blk ∈ pinned(at) <=> ∃ r = rev(blk):
# 1) at < r ; blk was changed after at
# 2) r ≤ headOfAccess(blk) ; blk revision changed after at was accessed
@
func
(
tWatchLink
)
def
watch
(
twlink
,
zf
,
at
,
pinok
=
None
):
# -> tWatch
t
=
twlink
.
tdb
...
...
@@ -883,10 +877,10 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
pin_prev
=
{}
if
at_prev
is
not
None
:
assert
at_prev
<=
at
,
'TODO %s -> %s'
%
(
t
.
hat
(
at_prev
),
t
.
hat
(
at
))
pin_prev
=
t
.
_
needPinAt
(
zf
,
at_prev
)
# XXX & headOfBlkAccess(blk) > w.at
pin_prev
=
t
.
_
pinnedAt
(
zf
,
at_prev
)
assert
w
.
pinned
==
pin_prev
pin
=
t
.
_
needPinAt
(
zf
,
at
)
# XXX & headOfBlkAccess > w.at
pin
=
t
.
_
pinnedAt
(
zf
,
at
)
if
at_prev
!=
at
and
at_prev
is
not
None
:
print
(
'# pin@old: %s
\
n
# pin@new: %s'
%
(
t
.
hpin
(
pin_prev
),
t
.
hpin
(
pin
)))
...
...
@@ -942,7 +936,7 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
w
.
at
=
at
# `watch ... -> at_i -> at_j` must be the same as `watch ø -> at_j`
assert
w
.
pinned
==
t
.
_
needPinAt
(
zf
,
at
)
# XXX & headOfBlkAccess
assert
w
.
pinned
==
t
.
_
pinnedAt
(
zf
,
at
)
return
w
...
...
@@ -1090,7 +1084,7 @@ def _blkDataAt(t, zf, blk, at): # -> (data, rev)
if
at
is
None
:
at
=
t
.
head
# XXX dup wrt _
needPin
At
# XXX dup wrt _
pinned
At
# all changes to zf
vdf
=
[
_
.
byfile
[
zf
]
for
_
in
t
.
dFtail
if
zf
in
_
.
byfile
]
...
...
@@ -1115,35 +1109,17 @@ def _blkRevAt(t, zf, blk, at): # -> rev
_
,
rev
=
t
.
_blkDataAt
(
zf
,
blk
,
at
)
return
rev
# XXX kill
# 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._blkRevAt(zf, blk, t.head)
"""
# XXX -> _pinDeltaAt ?
# _needPinAt returns which blocks needs to be pinned for zf@at compared to zf@head
# _pinnedAt 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
# pins as if all blocks @head were accesses - i.e. considering all file changes
# in (at, head] range.
# Criteria for when blk must be pinned as of @at view:
#
# The caller has to take accessed/not-accessed effect into account on its own
# (see tDB._accessed & friends)
# blk ∈ pinned(at) <=> ∃ r = rev(blk):
# 1) at < r ; blk was changed after at
# 2) r ≤ headOfAccess(blk) ; blk revision changed after at was accessed
@
func
(
tDB
)
def
_
needPin
At
(
t
,
zf
,
at
):
# -> pin = {} blk -> rev
def
_
pinned
At
(
t
,
zf
,
at
):
# -> pin = {} blk -> rev
# XXX dup in _blkDataAt
# all changes to zf
...
...
@@ -1162,7 +1138,7 @@ def _needPinAt(t, zf, at): # -> pin = {} blk -> rev
else
:
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
pin
[
blk
]
=
pinrev
pin
[
blk
]
=
pinrev
# XXX headOfAccess >= ...
return
pin
...
...
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