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
dfb82ecc
Commit
dfb82ecc
authored
Jun 27, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4ce4b808
Changes
3
Show 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
// 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
)
{
parent
.
Inode
()
.
NewChild
(
name
,
true
,
child
)
}
// 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
)
{
parent
.
Inode
()
.
NewChild
(
name
,
false
,
child
)
}
wcfs/wcfs.go
View file @
dfb82ecc
...
...
@@ -262,17 +262,76 @@ type BigFileRoot struct {
zstor
zodb
.
IStorage
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
{
return
&
BigFileRoot
{
Node
:
nodefs
.
NewDefaultNode
(),
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>.
func
(
br
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
_
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
oid
,
err
:=
zodb
.
ParseOid
(
name
)
...
...
@@ -290,29 +349,20 @@ func (br *BigFileRoot) Mkdir(name string, mode uint32, _ *fuse.Context) (*nodefs
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
}
bx
:=
NewBigFileX
(
oid
,
br
)
br
.
tab
[
oid
]
=
bx
// 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>"
type
BigFile
struct
{
nodefs
.
Node
oid
zodb
.
Oid
root
*
BigFileRoot
return
bx
.
Inode
(),
fuse
.
OK
}
func
NewBigFile
(
oid
zodb
.
Oid
,
root
*
BigFileRoot
)
*
BigFile
{
return
&
BigFile
{
Node
:
nodefs
.
NewDefaultNode
(),
oid
:
oid
,
root
:
root
,
}
}
// XXX do we need to support rmdir? (probably no)
...
...
wcfs/wcfs_test.py
View file @
dfb82ecc
...
...
@@ -112,7 +112,12 @@ def test_bigfile_empty():
transaction
.
commit
()
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 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