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
a974edc9
Commit
a974edc9
authored
Dec 25, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5d775923
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
wcfs/wcfs.go
wcfs/wcfs.go
+8
-1
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+9
-8
No files found.
wcfs/wcfs.go
View file @
a974edc9
...
@@ -789,12 +789,14 @@ func bigopen(ctx context.Context, zconn *ZConn, oid zodb.Oid) (_ *BigFile, err e
...
@@ -789,12 +789,14 @@ func bigopen(ctx context.Context, zconn *ZConn, oid zodb.Oid) (_ *BigFile, err e
zconn
.
Incref
()
zconn
.
Incref
()
return
&
BigFile
{
return
&
BigFile
{
Node
:
nodefs
.
NewDefaultNode
(),
zconn
:
zconn
,
zconn
:
zconn
,
zbf
:
zbf
,
zbf
:
zbf
,
zbfSize
:
zbfSize
,
zbfSize
:
zbfSize
,
// XXX this is needed only for head/
// XXX this is needed only for head/
δFtail
:
NewΔTailI64
(),
// XXX indicate we have coverage starting from zconn.at?
δFtail
:
NewΔTailI64
(),
// XXX indicate we have coverage starting from zconn.at?
loading
:
make
(
map
[
int64
]
*
blkLoadState
),
},
nil
},
nil
}
}
...
@@ -1089,8 +1091,13 @@ func main() {
...
@@ -1089,8 +1091,13 @@ func main() {
// add entries to /
// add entries to /
mkfile
(
root
,
".wcfs"
,
NewStaticFile
([]
byte
(
zurl
)))
mkfile
(
root
,
".wcfs"
,
NewStaticFile
([]
byte
(
zurl
)))
mkdir
(
root
,
"head"
,
&
Head
{
head
:=
&
Head
{
Node
:
nodefs
.
NewDefaultNode
(),
}
mkdir
(
root
,
"head"
,
head
)
mkdir
(
head
,
"bigfile"
,
&
BigFileDir
{
Node
:
nodefs
.
NewDefaultNode
(),
Node
:
nodefs
.
NewDefaultNode
(),
tab
:
make
(
map
[
zodb
.
Oid
]
*
BigFile
),
})
})
// TODO handle autoexit
// TODO handle autoexit
...
...
wcfs/wcfs_test.py
View file @
a974edc9
...
@@ -99,7 +99,8 @@ def test_join():
...
@@ -99,7 +99,8 @@ def test_join():
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/bigfile"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
defer
(
wc2
.
close
)
defer
(
wc2
.
close
)
...
@@ -115,7 +116,8 @@ def test_join_autostart():
...
@@ -115,7 +116,8 @@ def test_join_autostart():
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/bigfile"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
# XXX hack (tmp ?)
# XXX hack (tmp ?)
...
@@ -163,20 +165,19 @@ def test_bigfile_empty():
...
@@ -163,20 +165,19 @@ def test_bigfile_empty():
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
defer
(
wc
.
close
)
defer
(
wc
.
close
)
# path to bigfile/ under wcfs
# path to
head/
bigfile/ under wcfs
bigpath
=
wc
.
mountpoint
+
"/bigfile"
bigpath
=
wc
.
mountpoint
+
"/
head/
bigfile"
#
mkdir
to non-BigFile - must be rejected
#
lookup
to non-BigFile - must be rejected
with
raises
(
OSError
)
as
exc
:
with
raises
(
OSError
)
as
exc
:
os
.
mkdir
(
"%s/%s"
%
(
bigpath
,
last
.
_p_oid
.
encode
(
'hex'
)))
os
.
stat
(
"%s/%s"
%
(
bigpath
,
last
.
_p_oid
.
encode
(
'hex'
)))
assert
exc
.
value
.
errno
==
EINVAL
assert
exc
.
value
.
errno
==
EINVAL
# path to f under wcfs
# path to f under wcfs
fpath
=
"%s/%s"
%
(
bigpath
,
f
.
_p_oid
.
encode
(
'hex'
))
fpath
=
"%s/%s"
%
(
bigpath
,
f
.
_p_oid
.
encode
(
'hex'
))
os
.
mkdir
(
fpath
)
st
=
os
.
stat
(
fpath
)
st
=
os
.
stat
(
fpath
+
"/head/data"
)
assert
st
.
st_size
==
0
assert
st
.
st_size
==
0
assert
st
.
st_mtime
==
tidtime
(
tid1
)
assert
st
.
st_mtime
==
tidtime
(
tid1
)
...
...
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