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