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:
...
@@ -174,7 +174,7 @@ class DFile:
# The database can be mutated (via !wcfs codepath) 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 (_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.
# tDB must be explicitly closed once no longer used.
#
#
...
@@ -856,12 +856,6 @@ class tSrvReq:
...
@@ -856,12 +856,6 @@ class tSrvReq:
#
#
# The automatic computation of pinok is verified against explicitly provided
# The automatic computation of pinok is verified against explicitly provided
# pinok when it is present.
# 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
)
@
func
(
tWatchLink
)
def
watch
(
twlink
,
zf
,
at
,
pinok
=
None
):
# -> tWatch
def
watch
(
twlink
,
zf
,
at
,
pinok
=
None
):
# -> tWatch
t
=
twlink
.
tdb
t
=
twlink
.
tdb
...
@@ -883,10 +877,10 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
...
@@ -883,10 +877,10 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
pin_prev
=
{}
pin_prev
=
{}
if
at_prev
is
not
None
:
if
at_prev
is
not
None
:
assert
at_prev
<=
at
,
'TODO %s -> %s'
%
(
t
.
hat
(
at_prev
),
t
.
hat
(
at
))
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
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
:
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
)))
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
...
@@ -942,7 +936,7 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
w
.
at
=
at
w
.
at
=
at
# `watch ... -> at_i -> at_j` must be the same as `watch ø -> at_j`
# `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
return
w
...
@@ -1090,7 +1084,7 @@ def _blkDataAt(t, zf, blk, at): # -> (data, rev)
...
@@ -1090,7 +1084,7 @@ def _blkDataAt(t, zf, blk, at): # -> (data, rev)
if
at
is
None
:
if
at
is
None
:
at
=
t
.
head
at
=
t
.
head
# XXX dup wrt _
needPin
At
# XXX dup wrt _
pinned
At
# 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
]
...
@@ -1115,35 +1109,17 @@ def _blkRevAt(t, zf, blk, at): # -> rev
...
@@ -1115,35 +1109,17 @@ def _blkRevAt(t, zf, blk, at): # -> rev
_
,
rev
=
t
.
_blkDataAt
(
zf
,
blk
,
at
)
_
,
rev
=
t
.
_blkDataAt
(
zf
,
blk
,
at
)
return
rev
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 ?
# _pinnedAt returns which blocks needs to be pinned for zf@at compared to zf@head
# _needPinAt returns which blocks needs to be pinned for zf@at compared to zf@head
# according to wcfs invalidation protocol.
# according to wcfs invalidation protocol.
#
#
# It does not take into account whether blocks are in cache or not and computes
# Criteria for when blk must be pinned as of @at view:
# pins as if all blocks @head were accesses - i.e. considering all file changes
# in (at, head] range.
#
#
# The caller has to take accessed/not-accessed effect into account on its own
# blk ∈ pinned(at) <=> ∃ r = rev(blk):
# (see tDB._accessed & friends)
# 1) at < r ; blk was changed after at
# 2) r ≤ headOfAccess(blk) ; blk revision changed after at was accessed
@
func
(
tDB
)
@
func
(
tDB
)
def
_
needPin
At
(
t
,
zf
,
at
):
# -> pin = {} blk -> rev
def
_
pinned
At
(
t
,
zf
,
at
):
# -> pin = {} blk -> rev
# XXX dup in _blkDataAt
# XXX dup in _blkDataAt
# all changes to zf
# all changes to zf
...
@@ -1162,7 +1138,7 @@ def _needPinAt(t, zf, at): # -> pin = {} blk -> rev
...
@@ -1162,7 +1138,7 @@ def _needPinAt(t, zf, at): # -> pin = {} blk -> rev
else
:
else
:
pinrev
=
blkhistoryat
[
-
1
]
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
assert
pinrev
<=
at
pin
[
blk
]
=
pinrev
pin
[
blk
]
=
pinrev
# XXX headOfAccess >= ...
return
pin
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