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
dfb82ecc
Commit
dfb82ecc
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4ce4b808
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
21 deletions
+81
-21
wcfs/misc.go
wcfs/misc.go
+5
-0
wcfs/wcfs.go
wcfs/wcfs.go
+70
-20
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+6
-1
No files found.
wcfs/misc.go
View file @
dfb82ecc
...
@@ -54,11 +54,16 @@ func (f *StaticFile) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context
...
@@ -54,11 +54,16 @@ func (f *StaticFile) Read(_ nodefs.File, dest []byte, off int64, _ *fuse.Context
// mkdir adds child to parent as directory.
// mkdir adds child to parent as directory.
//
// Note: parent must to be already in the filesystem tree - i.e. associated
// with inode. if not - nodefs will panic in Inode.NewChild on nil dereference.
func
mkdir
(
parent
nodefs
.
Node
,
name
string
,
child
nodefs
.
Node
)
{
func
mkdir
(
parent
nodefs
.
Node
,
name
string
,
child
nodefs
.
Node
)
{
parent
.
Inode
()
.
NewChild
(
name
,
true
,
child
)
parent
.
Inode
()
.
NewChild
(
name
,
true
,
child
)
}
}
// mkfile adds child to parent as file.
// mkfile adds child to parent as file.
//
// Note: parent must be already in the filesystem tree (see mkdir for details).
func
mkfile
(
parent
nodefs
.
Node
,
name
string
,
child
nodefs
.
Node
)
{
func
mkfile
(
parent
nodefs
.
Node
,
name
string
,
child
nodefs
.
Node
)
{
parent
.
Inode
()
.
NewChild
(
name
,
false
,
child
)
parent
.
Inode
()
.
NewChild
(
name
,
false
,
child
)
}
}
wcfs/wcfs.go
View file @
dfb82ecc
...
@@ -262,17 +262,76 @@ type BigFileRoot struct {
...
@@ -262,17 +262,76 @@ type BigFileRoot struct {
zstor
zodb
.
IStorage
zstor
zodb
.
IStorage
mu
sync
.
Mutex
mu
sync
.
Mutex
tab
map
[
zodb
.
Oid
]
*
BigFile
tab
map
[
zodb
.
Oid
]
*
BigFile
X
}
}
// BigFileX represents "/bigfile/<bigfileX>"
type
BigFileX
struct
{
nodefs
.
Node
oid
zodb
.
Oid
root
*
BigFileRoot
}
// BigFile represents "/bigfile/<bigfileX>/head"
type
BigFile
struct
{
nodefs
.
Node
x
*
BigFileX
data
*
BigFileData
//at *BigFileAt
//inv *BigFileInvalidations
}
// BigFileData represents "/bigfile/<bigfileX>/head/data"
type
BigFileData
struct
{
nodefs
.
Node
head
*
BigFile
}
// ---- ctors ---- XXX to down?
func
NewBigFileRoot
(
zstor
zodb
.
IStorage
)
*
BigFileRoot
{
func
NewBigFileRoot
(
zstor
zodb
.
IStorage
)
*
BigFileRoot
{
return
&
BigFileRoot
{
return
&
BigFileRoot
{
Node
:
nodefs
.
NewDefaultNode
(),
Node
:
nodefs
.
NewDefaultNode
(),
zstor
:
zstor
,
zstor
:
zstor
,
tab
:
make
(
map
[
zodb
.
Oid
]
*
BigFile
),
tab
:
make
(
map
[
zodb
.
Oid
]
*
BigFile
X
),
}
}
}
}
func
NewBigFileX
(
oid
zodb
.
Oid
,
root
*
BigFileRoot
)
*
BigFileX
{
bx
:=
&
BigFileX
{
Node
:
nodefs
.
NewDefaultNode
(),
oid
:
oid
,
root
:
root
,
}
return
bx
}
func
NewBigFile
(
x
*
BigFileX
)
*
BigFile
{
f
:=
&
BigFile
{
Node
:
nodefs
.
NewDefaultNode
(),
x
:
x
}
f
.
data
=
NewBigFileData
(
f
)
// XXX + .at
return
f
}
func
NewBigFileData
(
head
*
BigFile
)
*
BigFileData
{
return
&
BigFileData
{
Node
:
nodefs
.
NewDefaultNode
(),
head
:
head
}
}
// Mkdir receives client request to create /bigfile/<bigfileX>.
// Mkdir receives client request to create /bigfile/<bigfileX>.
func
(
br
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
_
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
func
(
br
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
_
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
oid
,
err
:=
zodb
.
ParseOid
(
name
)
oid
,
err
:=
zodb
.
ParseOid
(
name
)
...
@@ -290,29 +349,20 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
...
@@ -290,29 +349,20 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
}
}
bf
:=
NewBigFile
(
oid
,
br
)
bx
:=
NewBigFileX
(
oid
,
br
)
br
.
tab
[
oid
]
=
bf
br
.
tab
[
oid
]
=
bx
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
)
bf
:=
NewBigFile
(
bx
)
mkdir
(
br
,
name
,
bx
)
// XXX takes treeLock - ok under br.mu ?
mkdir
(
bx
,
"head"
,
bf
)
mkfile
(
bf
,
"data"
,
bf
.
data
)
// BigFile represents "/bigfile/<bigfileX>"
return
bx
.
Inode
(),
fuse
.
OK
type
BigFile
struct
{
nodefs
.
Node
oid
zodb
.
Oid
root
*
BigFileRoot
}
}
func
NewBigFile
(
oid
zodb
.
Oid
,
root
*
BigFileRoot
)
*
BigFile
{
// XXX do we need to support rmdir? (probably no)
return
&
BigFile
{
Node
:
nodefs
.
NewDefaultNode
(),
oid
:
oid
,
root
:
root
,
}
}
...
...
wcfs/wcfs_test.py
View file @
dfb82ecc
...
@@ -112,7 +112,12 @@ def test_bigfile_empty():
...
@@ -112,7 +112,12 @@ def test_bigfile_empty():
transaction
.
commit
()
transaction
.
commit
()
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
wc
=
wcfs
.
join
(
testzurl
,
autostart
=
True
)
os
.
mkdir
(
"%s/bigfile/%s"
%
(
wc
.
mountpoint
,
f
.
_p_oid
.
encode
(
'hex'
)))
# path to f under wcfs
fpath
=
"%s/bigfile/%s"
%
(
wc
.
mountpoint
,
f
.
_p_oid
.
encode
(
'hex'
))
os
.
mkdir
(
fpath
)
os
.
stat
(
fpath
+
"/head/data"
)
# XXX size(head/data) = 0
# XXX size(head/data) = 0
# XXX mtime(head/data) ~= last txn that changed bigdile
# XXX mtime(head/data) ~= last txn that changed bigdile
...
...
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