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
96451811
Commit
96451811
authored
Feb 18, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6fdd5467
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
20 deletions
+35
-20
wcfs/wcfs.go
wcfs/wcfs.go
+35
-19
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+0
-1
No files found.
wcfs/wcfs.go
View file @
96451811
...
...
@@ -82,7 +82,7 @@
// where /bigfile/<bigfileX> represent bigfile data as of revision <revX>.
//
// Unless accessed {head,@<revX>}/bigfile/<bigfileX> are not automatically visible in
// wcfs filesystem. Similarly @<revX>/
should be explicitly created by client via mkdir. XXX -> just @<revX> access
.
// wcfs filesystem. Similarly @<revX>/
become visible only after accessed
.
//
//
// Invalidation protocol
...
...
@@ -1002,19 +1002,19 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
// XXX do we need to support unlink? -> no, @<revX>/ are automatically garbage-collected.
// / ->
Mkdir
receives client request to create @<rev>/.
//
// it is not an error if @<rev>/ already exists - mkdir succeeds and EEXIST is not returned.
// in other words mkdir behaves here similarly to `mkdir -p`.
//
// XXX -> remove mkdir and just create @revX/ on lookup.
func
(
root
*
Root
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
inode
,
err
:=
root
.
mkdir
(
name
,
fctx
)
// XXX ok to ignore mode?
// / ->
Lookup
receives client request to create @<rev>/.
func
(
root
*
Root
)
Lookup
(
out
*
fuse
.
Attr
,
name
string
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
revd
,
err
:=
root
.
lookup
(
name
,
fctx
)
var
inode
*
nodefs
.
Inode
if
revd
!=
nil
{
inode
=
revd
.
Inode
()
_
=
revd
.
GetAttr
(
out
,
nil
,
fctx
)
// always ok
}
return
inode
,
err2LogStatus
(
err
)
}
func
(
root
*
Root
)
mkdir
(
name
string
,
fctx
*
fuse
.
Context
)
(
_
*
nodefs
.
Inode
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"/:
mkdir %q"
,
name
)
func
(
root
*
Root
)
lookup
(
name
string
,
fctx
*
fuse
.
Context
)
(
_
*
Head
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"/:
lookup %q"
,
name
)
// XXX name -> path?
var
rev
zodb
.
Tid
ok
:=
false
...
...
@@ -1029,11 +1029,11 @@ func (root *Root) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Inode, err e
// check to see if dir(rev) is already there
root
.
revMu
.
Lock
()
_
,
already
:=
root
.
revTab
[
rev
]
revDir
,
already
:=
root
.
revTab
[
rev
]
root
.
revMu
.
Unlock
()
if
already
{
return
nil
,
syscall
.
EEXIST
return
revDir
,
nil
}
// not there - without revMu lock proceed to open @rev view of ZODB
...
...
@@ -1044,19 +1044,20 @@ func (root *Root) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Inode, err e
return
nil
,
err
}
// relock root and either mkdir or EEXIST if the directory was maybe
// simultaneously created while we were not holding revMu.
// relock root and either register new revX/ directory or, if the
// directory was maybe simultaneously created while we were not holding
// revMu, return that.
root
.
revMu
.
Lock
()
_
,
already
=
root
.
revTab
[
rev
]
revDir
,
already
=
root
.
revTab
[
rev
]
if
already
{
root
.
revMu
.
Unlock
()
// zconnRev.Release()
transaction
.
Current
(
zconnRev
.
txnCtx
)
.
Abort
()
return
nil
,
syscall
.
EEXIST
return
revDir
,
nil
}
// XXX -> newHead()
revDir
:
=
&
Head
{
revDir
=
&
Head
{
Node
:
newDefaultNode
(),
rev
:
rev
,
zconn
:
zconnRev
,
...
...
@@ -1078,7 +1079,7 @@ func (root *Root) mkdir(name string, fctx *fuse.Context) (_ *nodefs.Inode, err e
mkdir
(
revDir
,
"bigfile"
,
bfdir
)
// XXX + "at"
return
revDir
.
Inode
()
,
nil
return
revDir
,
nil
}
...
...
@@ -1159,6 +1160,21 @@ func (f *BigFile) Close() error {
return
nil
}
// /(head|<rev>)/ -> Getattr serves stat.
func
(
head
*
Head
)
GetAttr
(
out
*
fuse
.
Attr
,
_
nodefs
.
File
,
_
*
fuse
.
Context
)
fuse
.
Status
{
at
:=
head
.
rev
if
at
==
0
{
head
.
zconnMu
.
RLock
()
at
=
head
.
zconn
.
At
()
head
.
zconnMu
.
RUnlock
()
}
t
:=
at
.
Time
()
.
Time
out
.
Mode
=
fuse
.
S_IFDIR
|
0555
out
.
SetTimes
(
/*atime=*/
nil
,
/*mtime=*/
&
t
,
/*ctime=*/
&
t
)
return
fuse
.
OK
}
// /(head|<rev>)/bigfile/<bigfileX> -> Getattr serves stat.
func
(
f
*
BigFile
)
GetAttr
(
out
*
fuse
.
Attr
,
_
nodefs
.
File
,
_
*
fuse
.
Context
)
fuse
.
Status
{
f
.
head
.
zconnMu
.
RLock
()
...
...
wcfs/wcfs_test.py
View file @
96451811
...
...
@@ -264,7 +264,6 @@ def test_wcfs():
rev1
=
wc
.
mountpoint
+
(
"/@%s"
%
h
(
tcommit1
))
fpath1
=
rev1
+
"/bigfile/"
+
h
(
f
.
_p_oid
)
os
.
mkdir
(
rev1
)
st
=
os
.
stat
(
fpath1
)
assert
st
.
st_size
==
fsize1
#assert st.st_mtime == tidtime(tcommit1) FIXME proper sync
...
...
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