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
622e0a43
Commit
622e0a43
authored
Jun 07, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6adf799c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+33
-2
No files found.
wcfs/wcfs_test.py
View file @
622e0a43
...
...
@@ -178,7 +178,7 @@ class DF:
# it is is similar to ΔFile in wcfs.go .
class
DFile
:
# .rev tid
# .ddata {} blk -> data
XXX name
# .ddata {} blk -> data
def
__init__
(
dfile
):
# rev set from outside
dfile
.
ddata
=
{}
...
...
@@ -370,6 +370,32 @@ class tDB:
#print(' '*level, 'zzz', tail)
yield
([
dF
.
rev
]
+
tail
)
# _blkData returns expected blk data and revision for @at database view.
def
_blkData
(
t
,
zf
,
blk
,
at
=
None
):
# -> (data, rev)
if
at
is
None
:
at
=
t
.
head
# XXX dup wrt _pinAt
# all changes to zf
vdf
=
[
_
.
byfile
[
zf
]
for
_
in
t
.
dFtail
if
zf
in
_
.
byfile
]
# changes to zf[blk] <= at
blkhistoryat
=
[
_
for
_
in
vdf
if
blk
in
_
.
ddata
and
_
.
rev
<=
at
]
if
len
(
blkhistoryat
)
==
0
:
# blk did not existed @at # XXX verify whether file was existing at all
data
=
b''
rev
=
None
else
:
_
=
blkhistoryat
[
-
1
]
data
=
_
.
ddata
[
blk
]
rev
=
_
.
rev
assert
rev
<=
at
return
data
,
rev
# tFile provides testing environment for one bigfile on wcfs.
...
...
@@ -385,6 +411,8 @@ class tFile:
def
__init__
(
t
,
tdb
,
zf
,
at
=
None
):
assert
isinstance
(
zf
,
ZBigFile
)
t
.
tdb
=
tdb
t
.
zf
=
zf
t
.
at
=
at
t
.
f
=
tdb
.
_open
(
zf
,
at
=
at
)
t
.
blksize
=
zf
.
blksize
...
...
@@ -447,6 +475,8 @@ class tFile:
if
not
isinstance
(
data
,
bytes
):
data
=
data
.
encode
(
'utf-8'
)
assert
len
(
data
)
<=
t
.
blksize
dataOk
,
_
=
t
.
tdb
.
_blkData
(
t
.
zf
,
blk
,
t
.
at
)
assert
data
==
dataOk
,
"explicit vs computed data"
data
+=
b'
\
0
'
*
(
t
.
blksize
-
len
(
data
))
# tailing zeros
assert
blk
<
t
.
_sizeinblk
()
...
...
@@ -724,7 +754,7 @@ def _pinAt(twlink, zf, at): # -> pin = {} blk -> rev
if
len
(
blkhistoryat
)
==
0
:
pinrev
=
t
.
_headv
[
0
]
# was hole - at0 XXX -> pin to @00?
else
:
pinrev
=
max
(
blkhistoryat
)
pinrev
=
blkhistoryat
[
-
1
]
assert
pinrev
<=
at
pin
[
blk
]
=
pinrev
...
...
@@ -1032,6 +1062,7 @@ def test_wcfs():
at4
=
t
.
commit
()
f
.
assertCache
([
1
,
1
,
0
,
1
,
0
,
0
])
# FIXME a must be invalidated - see δbtree ^^^
# XXX -> f.assertBlk(2, '4c', {wl: {2: at3}})
blk
=
2
pinok
=
{
2
:
at3
}
# XXX at3 -> at <= wl.at for zf
...
...
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