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
50de9920
Commit
50de9920
authored
Jun 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fd48a55a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+12
-12
No files found.
wcfs/wcfs_test.py
View file @
50de9920
...
...
@@ -198,9 +198,9 @@ class tDB:
t
.
_wc_zheadfh
=
open
(
t
.
wc
.
mountpoint
+
"/.wcfs/zhead"
)
t
.
_wc_zheadv
=
[]
# whe
n head/ ZBigFile(s) blocks were last
accessed via wcfs.
# whe
ther head/ ZBigFile(s) blocks were ever
accessed via wcfs.
# this is updated only explicitly via ._blkheadaccess() .
t
.
_blk
AccessedAtHead
=
{}
# ZBigFile -> {} blk -> head(when accessed
)
t
.
_blk
accessedViaHead
=
{}
# ZBigFile -> set(blk
)
# tracked opened tFiles & tWatches
t
.
_files
=
set
()
...
...
@@ -317,11 +317,11 @@ class tDB:
# _blkheadaccess marks head/zf[blk] accessed.
def
_blkheadaccess
(
t
,
zf
,
blk
):
# XXX locking needed? or we do everything serially?
t
.
_
headOfAccess
(
zf
)[
blk
]
=
t
.
head
t
.
_
blkaccessed
(
zf
).
add
(
blk
)
# _
headOfAccess returns {} describing when head/zf blocks were
accessed.
def
_
headOfAccess
(
t
,
zf
):
# {} blk -> head-when-accessed
return
t
.
_blk
AccessedAtHead
.
setdefault
(
zf
,
{}
)
# _
blkaccessed returns set describing whether head/zf blocks were ever
accessed.
def
_
blkaccessed
(
t
,
zf
):
# set(blk)
return
t
.
_blk
accessedViaHead
.
setdefault
(
zf
,
set
()
)
# _path returns path for object on wcfs.
# - str: wcfs root + obj;
...
...
@@ -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
)
# XXX we only use keys
lastRevOf
=
lambda
blk
:
t
.
_blkRevAt
(
zf
,
blk
,
t
.
head
)
accessed
=
t
.
_blkaccessed
(
zf
)
lastRevOf
=
lambda
blk
:
t
.
_blkRevAt
(
zf
,
blk
,
t
.
head
)
pin_prev
=
{}
if
at_prev
is
not
None
:
...
...
@@ -917,13 +917,13 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
# blk ∈ pin -> blk is tracked; has rev > at
# (see criteria in _pinnedAt)
assert
blk
in
headOfAccess
assert
blk
in
accessed
assert
at
<
lastRevOf
(
blk
)
# blk ∈ pin_prev, blk ∉ pin -> unpin to head
elif
blk
in
pin_prev
and
blk
not
in
pin
:
# blk ∈ pin_prev -> blk is tracked; has rev > at_prev
assert
blk
in
headOfAccess
assert
blk
in
accessed
assert
at_prev
<
lastRevOf
(
blk
)
# blk ∉ pin -> last blk revision is ≤ at
...
...
@@ -934,7 +934,7 @@ def watch(twlink, zf, at, pinok=None): # -> tWatch
# blk ∈ pin_prev, blk ∈ pin -> if rev different: use pin
elif
blk
in
pin_prev
and
blk
in
pin
:
# blk ∈ pin_prev, pin -> blk is tracked; has rev > at_prev, at
assert
blk
in
headOfAccess
assert
blk
in
accessed
assert
at_prev
<
lastRevOf
(
blk
)
assert
at
<
lastRevOf
(
blk
)
...
...
@@ -1159,7 +1159,7 @@ def _pinnedAt(t, zf, at): # -> pin = {} blk -> rev
else
:
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
if
blk
in
t
.
_
headOfAccess
(
zf
):
if
blk
in
t
.
_
blkaccessed
(
zf
):
pin
[
blk
]
=
pinrev
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