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
da48cbaf
Commit
da48cbaf
authored
Dec 26, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f29e5dbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
wcfs/__init__.py
wcfs/__init__.py
+5
-5
wcfs/t/t.go
wcfs/t/t.go
+1
-0
wcfs/wcfs.go
wcfs/wcfs.go
+7
-1
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+3
-3
No files found.
wcfs/__init__.py
View file @
da48cbaf
...
...
@@ -42,7 +42,7 @@ from ZODB.FileStorage import FileStorage
# Conn represents connection to wcfs server.
class
Conn
(
object
):
# .mountpoint path to mountpoint
# ._fwcfs /.wcfs opened to keep the server from going away (at least cleanly)
# ._fwcfs /.wcfs
/zurl
opened to keep the server from going away (at least cleanly)
def
__init__
(
self
,
mountpoint
,
fwcfs
):
self
.
mountpoint
=
mountpoint
...
...
@@ -68,7 +68,7 @@ def serve(zurl, exec_=False):
# try opening .wcfs - it is an error if we can do it.
# XXX -> option to wcfs itself?
try
:
f
=
open
(
mntpt
+
"/.wcfs"
)
f
=
open
(
mntpt
+
"/.wcfs
/zurl
"
)
except
IOError
as
e
:
if
e
.
errno
!=
ENOENT
:
raise
...
...
@@ -108,7 +108,7 @@ def join(zurl, autostart=_default_autostart()):
# try opening .wcfs - if we succeed - it is already mounted.
# XXX -> wcfs itself?
try
:
f
=
open
(
mntpt
+
"/.wcfs"
)
f
=
open
(
mntpt
+
"/.wcfs
/zurl
"
)
except
IOError
as
e
:
if
e
.
errno
!=
ENOENT
:
raise
...
...
@@ -179,7 +179,7 @@ def _start(zurl, *optv):
try
:
while
1
:
try
:
f
=
open
(
"%s/.wcfs"
%
mntpt
)
f
=
open
(
"%s/.wcfs
/zurl
"
%
mntpt
)
except
IOError
as
e
:
if
e
.
errno
!=
ENOENT
:
raise
...
...
@@ -188,7 +188,7 @@ def _start(zurl, *optv):
res
=
f
dotwcfs
=
f
.
read
()
if
dotwcfs
!=
zurl
:
raise
RuntimeError
(
".wcfs != zurl (%s != %s)"
%
(
qq
(
dotwcfs
),
qq
(
zurl
)))
raise
RuntimeError
(
".wcfs
/zurl
!= zurl (%s != %s)"
%
(
qq
(
dotwcfs
),
qq
(
zurl
)))
break
...
...
wcfs/t/t.go
View file @
da48cbaf
...
...
@@ -50,6 +50,7 @@ func (f *file) Open(flags uint32, _ *fuse.Context) (nodefs.File, fuse.Status) {
h
:=
&
fileHandle
{
File
:
nodefs
.
NewDefaultFile
(),
content
:
[]
byte
(
data
)}
// force direct-io to disable pagecache: we alway return different data
// and st_size=0 (like in /proc).
// XXX + FOPEN_NONSEEKABLE - then it will be like socket
return
&
nodefs
.
WithFlags
{
File
:
h
,
FuseFlags
:
fuse
.
FOPEN_DIRECT_IO
,
...
...
wcfs/wcfs.go
View file @
da48cbaf
...
...
@@ -1229,10 +1229,16 @@ func main() {
}
// add entries to /
mkfile
(
root
,
".wcfs"
,
NewStaticFile
([]
byte
(
zurl
)))
mkdir
(
root
,
"head"
,
head
)
mkdir
(
head
,
"bigfile"
,
bfdir
)
mkfile
(
head
,
"at"
,
NewSmallFile
(
head
.
readAt
))
// TODO mtime(at) = tidtime(at)
// XXX ^^^ invalidate cache or direct io
// for debugging/testing
dotwcfs
:=
nodefs
.
NewDefaultNode
()
mkdir
(
root
,
".wcfs"
,
dotwcfs
)
mkfile
(
dotwcfs
,
"zurl"
,
NewStaticFile
([]
byte
(
zurl
)))
// XXX zhead
// TODO handle autoexit
_
=
autoexit
...
...
wcfs/wcfs_test.py
View file @
da48cbaf
...
...
@@ -99,7 +99,7 @@ def test_join():
wc
=
wcfs
.
_start
(
zurl
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs
/zurl
"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
...
...
@@ -116,7 +116,7 @@ def test_join_autostart():
wc
=
wcfs
.
join
(
zurl
,
autostart
=
True
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs
/zurl
"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
...
...
@@ -126,7 +126,7 @@ def test_join_autostart():
@
method
(
wcfs
.
Conn
)
def
_sync
(
self
):
print
>>
sys
.
stderr
,
"
\
n
# >>> wcfs.Conn.sync"
zurl
=
readfile
(
self
.
mountpoint
+
"/.wcfs"
)
zurl
=
readfile
(
self
.
mountpoint
+
"/.wcfs
/zurl
"
)
bigfilev
=
os
.
listdir
(
self
.
mountpoint
+
"/head/bigfile"
)
self
.
close
()
...
...
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