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
dcd3fed8
Commit
dcd3fed8
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e1c6b5c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
6 deletions
+53
-6
wcfs/wcfs.go
wcfs/wcfs.go
+52
-5
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+1
-1
No files found.
wcfs/wcfs.go
View file @
dcd3fed8
...
...
@@ -246,28 +246,75 @@ import (
"flag"
"log"
"os"
"
github.com/hanwen/go-fuse/fuse/nodefs
"
"sync"
"
syscall
"
"lab.nexedi.com/kirr/neo/go/zodb"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
)
// BigFileRoot represents "/bigfile"
type
BigFileRoot
struct
{
nodefs
.
Node
zstor
zodb
.
IStorage
}
mu
sync
.
Mutex
tab
map
[
zodb
.
Oid
]
*
BigFile
}
func
NewBigFileRoot
(
zstor
zodb
.
IStorage
)
*
BigFileRoot
{
return
&
BigFileRoot
{
Node
:
nodefs
.
NewDefaultNode
(),
zstor
:
zstor
,
tab
:
make
(
map
[
zodb
.
Oid
]
*
BigFile
),
}
}
// Mkdir receives client request to create /bigfile/<bigfileX>.
func
(
br
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
_
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
oid
,
err
:=
zodb
.
ParseOid
(
name
)
if
err
!=
nil
{
log
.
Printf
(
"/bigfile: mkdir: non-oid: %q"
,
name
)
return
nil
,
fuse
.
EINVAL
}
// XXX ok to ignore mode?
br
.
mu
.
Lock
()
defer
br
.
mu
.
Unlock
()
if
_
,
already
:=
br
.
tab
[
oid
];
already
{
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
}
bf
:=
NewBigFile
(
oid
,
br
)
br
.
tab
[
oid
]
=
bf
mkdir
(
br
,
name
,
bf
)
// XXX takes treeLock - ok under br.mu ?
return
bf
.
Inode
(),
fuse
.
OK
}
// XXX do we need to support rmdir? (probably no)
// BigFile represents "/bigfile/<bigfileX>"
type
BigFile
struct
{
nodefs
.
Node
oid
zodb
.
Oid
root
*
BigFileRoot
}
func
NewBigFile
(
oid
zodb
.
Oid
,
root
*
BigFileRoot
)
*
BigFile
{
return
&
BigFile
{
Node
:
nodefs
.
NewDefaultNode
(),
oid
:
oid
,
root
:
root
,
}
}
// XXX option to prevent starting if wcfs was already started ?
// XXX option to automatically exit/unmount if there are no requests for some t
...
...
@@ -301,7 +348,7 @@ func main() {
server
,
_
,
err
:=
nodefs
.
MountRoot
(
mntpt
,
root
,
opts
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
// XXX err ctx?
log
.
Fatal
(
err
)
}
// add entries to /
...
...
wcfs/wcfs_test.py
View file @
dcd3fed8
...
...
@@ -103,7 +103,7 @@ def test_join_autostart():
# XXX parametrize zblk0, zblk1
# XXX select !wcfs mode so that we prepare data through !wcfs path.
def
_
test_bigfile_empty
():
def
test_bigfile_empty
():
root
=
testdb
.
dbopen
()
root
[
'zfile'
]
=
f
=
ZBigFile
(
blksize
)
transaction
.
commit
()
...
...
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