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
293234ae
Commit
293234ae
authored
Mar 05, 2015
by
Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InitializeKeyspace doesnt care about fuse
parent
66f1035d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
29 deletions
+37
-29
fuse/ipns/common.go
fuse/ipns/common.go
+37
-0
fuse/ipns/ipns_unix.go
fuse/ipns/ipns_unix.go
+0
-29
No files found.
fuse/ipns/
nofuse
.go
→
fuse/ipns/
common
.go
View file @
293234ae
// +build nofuse
package
ipns
import
(
"errors"
"github.com/jbenet/go-ipfs/core"
mdag
"github.com/jbenet/go-ipfs/merkledag"
nsys
"github.com/jbenet/go-ipfs/namesys"
ci
"github.com/jbenet/go-ipfs/p2p/crypto"
ft
"github.com/jbenet/go-ipfs/unixfs"
)
// InitializeKeyspace sets the ipns record for the given key to
// point to an empty directory.
func
InitializeKeyspace
(
n
*
core
.
IpfsNode
,
key
ci
.
PrivKey
)
error
{
//
emptyDir := &mdag.Node{Data: ft.FolderPBData()}
//
nodek, err := n.DAG.Add(emptyDir)
//
if err != nil {
//
return err
//
}
//
err = n.Pinning.Pin(emptyDir, false)
//
if err != nil {
//
return err
//
}
//
err = n.Pinning.Flush()
//
if err != nil {
//
return err
//
}
//
pub := nsys.NewRoutingPublisher(n.Routing)
//
err = pub.Publish(n.Context(), key, nodek)
//
if err != nil {
//
return err
//
}
return
errors
.
New
(
"how is this fuse related?"
)
emptyDir
:=
&
mdag
.
Node
{
Data
:
ft
.
FolderPBData
()}
nodek
,
err
:=
n
.
DAG
.
Add
(
emptyDir
)
if
err
!=
nil
{
return
err
}
err
=
n
.
Pinning
.
Pin
(
emptyDir
,
false
)
if
err
!=
nil
{
return
err
}
err
=
n
.
Pinning
.
Flush
()
if
err
!=
nil
{
return
err
}
pub
:=
nsys
.
NewRoutingPublisher
(
n
.
Routing
)
err
=
pub
.
Publish
(
n
.
Context
(),
key
,
nodek
)
if
err
!=
nil
{
return
err
}
return
nil
}
fuse/ipns/ipns_unix.go
View file @
293234ae
...
...
@@ -20,7 +20,6 @@ import (
core
"github.com/jbenet/go-ipfs/core"
chunk
"github.com/jbenet/go-ipfs/importer/chunk"
mdag
"github.com/jbenet/go-ipfs/merkledag"
nsys
"github.com/jbenet/go-ipfs/namesys"
ci
"github.com/jbenet/go-ipfs/p2p/crypto"
path
"github.com/jbenet/go-ipfs/path"
ft
"github.com/jbenet/go-ipfs/unixfs"
...
...
@@ -39,34 +38,6 @@ var (
longRepublishTimeout
=
time
.
Millisecond
*
500
)
// InitializeKeyspace sets the ipns record for the given key to
// point to an empty directory.
func
InitializeKeyspace
(
n
*
core
.
IpfsNode
,
key
ci
.
PrivKey
)
error
{
emptyDir
:=
&
mdag
.
Node
{
Data
:
ft
.
FolderPBData
()}
nodek
,
err
:=
n
.
DAG
.
Add
(
emptyDir
)
if
err
!=
nil
{
return
err
}
err
=
n
.
Pinning
.
Pin
(
emptyDir
,
false
)
if
err
!=
nil
{
return
err
}
err
=
n
.
Pinning
.
Flush
()
if
err
!=
nil
{
return
err
}
pub
:=
nsys
.
NewRoutingPublisher
(
n
.
Routing
)
err
=
pub
.
Publish
(
n
.
Context
(),
key
,
nodek
)
if
err
!=
nil
{
return
err
}
return
nil
}
// FileSystem is the readwrite IPNS Fuse Filesystem.
type
FileSystem
struct
{
Ipfs
*
core
.
IpfsNode
...
...
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