Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
3b8b9e68
Commit
3b8b9e68
authored
Sep 26, 2014
by
Jeromy
Committed by
Juan Batiz-Benet
Oct 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new file creation inside ipns dirs now works
parent
6080944a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
7 deletions
+63
-7
fuse/ipns/ipns_unix.go
fuse/ipns/ipns_unix.go
+63
-7
No files found.
fuse/ipns/ipns_unix.go
View file @
3b8b9e68
...
...
@@ -183,6 +183,7 @@ func (r *Root) ReadDir(intr fs.Intr) ([]fuse.Dirent, fuse.Error) {
// Node is the core object representing a filesystem tree node.
type
Node
struct
{
nsRoot
*
Node
name
string
// Private keys held by nodes at the root of a keyspace
key
ci
.
PrivKey
...
...
@@ -192,6 +193,7 @@ type Node struct {
fd
*
mdag
.
DagReader
cached
*
mdag
.
PBData
// For writing
dataBuf
*
bytes
.
Buffer
changed
bool
}
...
...
@@ -227,25 +229,30 @@ func (s *Node) Attr() fuse.Attr {
// Lookup performs a lookup under this node.
func
(
s
*
Node
)
Lookup
(
name
string
,
intr
fs
.
Intr
)
(
fs
.
Node
,
fuse
.
Error
)
{
log
.
Debug
(
"ipns: node Lookup '%s'"
,
name
)
log
.
Debug
(
"ipns: node
[%s]
Lookup '%s'
[intr= %s]
"
,
s
.
name
,
name
,
intr
.
String
()
)
nd
,
err
:=
s
.
Ipfs
.
Resolver
.
ResolveLinks
(
s
.
Nd
,
[]
string
{
name
})
if
err
!=
nil
{
// todo: make this error more versatile.
return
nil
,
fuse
.
ENOENT
}
return
s
.
makeChild
(
name
,
nd
),
nil
}
func
(
n
*
Node
)
makeChild
(
name
string
,
node
*
mdag
.
Node
)
*
Node
{
child
:=
&
Node
{
Ipfs
:
s
.
Ipfs
,
Nd
:
nd
,
Ipfs
:
n
.
Ipfs
,
Nd
:
node
,
name
:
name
,
}
if
s
.
nsRoot
==
nil
{
child
.
nsRoot
=
s
if
n
.
nsRoot
==
nil
{
child
.
nsRoot
=
n
}
else
{
child
.
nsRoot
=
s
.
nsRoot
child
.
nsRoot
=
n
.
nsRoot
}
return
child
,
nil
return
child
}
// ReadDir reads the link structure as directory entries
...
...
@@ -358,6 +365,55 @@ func (n *Node) Fsync(req *fuse.FsyncRequest, intr fs.Intr) fuse.Error {
return
nil
}
func
(
n
*
Node
)
Mkdir
(
req
*
fuse
.
MkdirRequest
,
intr
fs
.
Intr
)
(
fs
.
Node
,
fuse
.
Error
)
{
log
.
Debug
(
"Got mkdir request!"
)
dagnd
:=
new
(
mdag
.
Node
)
dagnd
.
Data
=
mdag
.
FolderPBData
()
n
.
Nd
.
AddNodeLink
(
req
.
Name
,
dagnd
)
n
.
changed
=
true
child
:=
&
Node
{
Ipfs
:
n
.
Ipfs
,
Nd
:
dagnd
,
}
if
n
.
nsRoot
==
nil
{
child
.
nsRoot
=
n
}
else
{
child
.
nsRoot
=
n
.
nsRoot
}
return
child
,
nil
}
func
(
n
*
Node
)
Mknod
(
req
*
fuse
.
MknodRequest
,
intr
fs
.
Intr
)
(
fs
.
Node
,
fuse
.
Error
)
{
log
.
Debug
(
"Got mknod request!"
)
return
nil
,
nil
}
func
(
n
*
Node
)
Open
(
req
*
fuse
.
OpenRequest
,
resp
*
fuse
.
OpenResponse
,
intr
fs
.
Intr
)
(
fs
.
Handle
,
fuse
.
Error
)
{
log
.
Debug
(
"[%s] Received open request! flags = %s"
,
n
.
name
,
req
.
Flags
.
String
())
return
n
,
nil
}
func
(
n
*
Node
)
Create
(
req
*
fuse
.
CreateRequest
,
resp
*
fuse
.
CreateResponse
,
intr
fs
.
Intr
)
(
fs
.
Node
,
fs
.
Handle
,
fuse
.
Error
)
{
log
.
Debug
(
"Got create request!"
)
nd
:=
new
(
mdag
.
Node
)
nd
.
Data
=
mdag
.
FilePBData
(
nil
)
child
:=
n
.
makeChild
(
req
.
Name
,
nd
)
err
:=
n
.
Nd
.
AddNodeLink
(
req
.
Name
,
nd
)
if
err
!=
nil
{
log
.
Error
(
"Error adding child to node: %s"
,
err
)
return
nil
,
nil
,
fuse
.
ENOENT
}
return
child
,
nil
,
nil
}
func
(
n
*
Node
)
Remove
(
req
*
fuse
.
RemoveRequest
,
intr
fs
.
Intr
)
fuse
.
Error
{
log
.
Debug
(
"Got Remove request!"
)
return
fuse
.
EIO
}
// Mount mounts an IpfsNode instance at a particular path. It
// serves until the process receives exit signals (to Unmount).
func
Mount
(
ipfs
*
core
.
IpfsNode
,
fpath
string
,
ipfspath
string
)
error
{
...
...
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