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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
c8e2aed7
Commit
c8e2aed7
authored
Jun 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b57e6ec0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
28 deletions
+19
-28
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+19
-28
No files found.
wcfs/wcfs_test.py
View file @
c8e2aed7
...
...
@@ -892,8 +892,8 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
at_from
=
'(%s ->) '
%
t
.
hat
(
at_prev
)
print
(
'
\
n
C: setup watch f<%s> %s%s'
%
(
h
(
zf
.
_p_oid
),
at_from
,
t
.
hat
(
at
)))
headOfAccess
=
t
.
_headOfAccess
(
zf
)
blkRevAt
=
lambda
blk
,
at
:
t
.
_blkRevAt
(
zf
,
blk
,
at
)
headOfAccess
=
t
.
_headOfAccess
(
zf
)
# XXX we only use keys
lastRevOf
=
lambda
blk
:
t
.
_blkRevAt
(
zf
,
blk
,
t
.
head
)
pin_prev
=
{}
if
at_prev
is
not
None
:
...
...
@@ -915,36 +915,28 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
if
at_prev
is
not
None
:
assert
False
,
'#%d pinned %s; not pinned %s'
%
(
t
.
hat
(
at_prev
),
t
.
hat
(
at
))
# blk ∈ pin -> blk
was already accessed with
rev > at
# blk ∈ pin -> blk
is tracked; has
rev > at
# (see criteria in _pinnedAt)
assert
blk
in
headOfAccess
assert
at
<
blkRevAt
(
blk
,
headOfAccess
[
blk
]
)
assert
at
<
lastRevOf
(
blk
)
# blk ∈ pin_prev, blk ∉ pin -> unpin to head
#
# FIXME
#
# δ accessed δ not-accessed
# ----x-------x--------x-----o-----------]-----
# at_prev at head
#
# -> must pin to at? (not unpin @head)
elif
blk
in
pin_prev
and
blk
not
in
pin
:
# blk ∈ pin_prev -> blk
was already accessed with
rev > at_prev
# blk ∈ pin_prev -> blk
is tracked; has
rev > at_prev
assert
blk
in
headOfAccess
assert
at_prev
<
blkRevAt
(
blk
,
headOfAccess
[
blk
]
)
assert
at_prev
<
lastRevOf
(
blk
)
# blk ∉ pin ->
blk revision as of last access
is ≤ at
assert
blkRevAt
(
blk
,
headOfAccess
[
blk
]
)
<=
at
# blk ∉ pin ->
last blk revision
is ≤ at
assert
lastRevOf
(
blk
)
<=
at
pin
[
blk
]
=
None
# @head
# blk ∈ pin_prev, blk ∈ pin -> if rev different: use pin
elif
blk
in
pin_prev
and
blk
in
pin
:
# blk ∈ pin_prev, pin -> blk
was already accessed with
rev > at_prev, at
# blk ∈ pin_prev, pin -> blk
is tracked; has
rev > at_prev, at
assert
blk
in
headOfAccess
assert
at_prev
<
blkRevAt
(
blk
,
headOfAccess
[
blk
]
)
assert
at
<
blkRevAt
(
blk
,
headOfAccess
[
blk
]
)
assert
at_prev
<
lastRevOf
(
blk
)
assert
at
<
lastRevOf
(
blk
)
assert
pin_prev
[
blk
]
<=
pin
[
blk
]
if
pin_prev
[
blk
]
==
pin
[
blk
]:
...
...
@@ -953,14 +945,13 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
#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'
%
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
# send watch request and check that we receive pins for
tracked (previously
#
accessed at least once) blocks changed > at.
twlink
.
_watch
(
zf
,
at
,
pinok
,
"ok"
)
w
.
at
=
at
...
...
@@ -1145,9 +1136,9 @@ def _blkRevAt(t, zf, blk, at): # -> rev
#
# 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
# blk ∈ pinned(at) <=>
1) ∃ r = rev(blk): at < r ; blk was changed after at
#
2) blk ∈ tracked ; blk was accessed at least once
#
; (and so is tracked by wcfs)
@
func
(
tDB
)
def
_pinnedAt
(
t
,
zf
,
at
):
# -> pin = {} blk -> rev
# XXX dup in _blkDataAt
...
...
@@ -1168,7 +1159,7 @@ def _pinnedAt(t, zf, at): # -> pin = {} blk -> rev
else
:
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
if
t
.
_headOfAccess
(
zf
).
get
(
blk
,
z64
)
>=
at
:
if
blk
in
t
.
_headOfAccess
(
zf
)
:
pin
[
blk
]
=
pinrev
return
pin
...
...
@@ -1366,8 +1357,8 @@ def test_wcfs_watch_setup():
wl
.
close
()
assertNewWatch
(
at1
,
{
2
:
at1
,
3
:
at0
,
5
:
at0
})
assertNewWatch
(
at2
,
{
2
:
at2
,
3
:
at2
,
5
:
at2
})
assertNewWatch
(
at3
,
{
2
:
at3
,
3
:
at2
,
5
:
at3
})
#
XXX recheck 5
assertNewWatch
(
at4
,
{
3
:
at2
})
# XXX 5 not accessed - right?
assertNewWatch
(
at3
,
{
2
:
at3
,
3
:
at2
,
5
:
at3
})
#
f(5) is pinned, even though it was not
assertNewWatch
(
at4
,
{
3
:
at2
,
5
:
at4
})
# accessed after at3
assertNewWatch
(
at5
,
{
})
# new watch + update at_i -> at_j
...
...
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