Skip to content

Commit

Permalink
InitializeKeyspace doesnt care about fuse
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptix committed Mar 4, 2015
1 parent 7ce74eb commit 6ead1f7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 67 deletions.
37 changes: 37 additions & 0 deletions fuse/ipns/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package ipns

import (
"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 nil
}
29 changes: 0 additions & 29 deletions fuse/ipns/ipns_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
38 changes: 0 additions & 38 deletions fuse/ipns/nofuse.go

This file was deleted.

0 comments on commit 6ead1f7

Please sign in to comment.