InitializeKeyspace doesnt care about fuse
Henry committed
Mar 5, 2015 at 00:18 UTC
293234ae636fabfcc5406a9aab6e68c4e7cb928d
3 files changed
+37
-67
fuse/ipns/common.go
new
+37
@@ -0,0 +1,37 @@
1
+package ipns
2
+
3
+import (
4
+ "github.com/jbenet/go-ipfs/core"
5
+ mdag "github.com/jbenet/go-ipfs/merkledag"
6
+ nsys "github.com/jbenet/go-ipfs/namesys"
7
+ ci "github.com/jbenet/go-ipfs/p2p/crypto"
8
+ ft "github.com/jbenet/go-ipfs/unixfs"
9
+)
10
+
11
+// InitializeKeyspace sets the ipns record for the given key to
12
+// point to an empty directory.
13
+func InitializeKeyspace(n *core.IpfsNode, key ci.PrivKey) error {
14
+ emptyDir := &mdag.Node{Data: ft.FolderPBData()}
15
+ nodek, err := n.DAG.Add(emptyDir)
16
+ if err != nil {
17
+ return err
18
+ }
19
+
20
+ err = n.Pinning.Pin(emptyDir, false)
21
+ if err != nil {
22
+ return err
23
+ }
24
+
25
+ err = n.Pinning.Flush()
26
+ if err != nil {
27
+ return err
28
+ }
29
+
30
+ pub := nsys.NewRoutingPublisher(n.Routing)
31
+ err = pub.Publish(n.Context(), key, nodek)
32
+ if err != nil {
33
+ return err
34
+ }
35
+
36
+ return nil
37
+}
fuse/ipns/ipns_unix.go
-29
@@ -20,7 +20,6 @@ import (
20
core "github.com/jbenet/go-ipfs/core"
21
chunk "github.com/jbenet/go-ipfs/importer/chunk"
22
mdag "github.com/jbenet/go-ipfs/merkledag"
23
- nsys "github.com/jbenet/go-ipfs/namesys"
23
ci "github.com/jbenet/go-ipfs/p2p/crypto"
24
path "github.com/jbenet/go-ipfs/path"
25
ft "github.com/jbenet/go-ipfs/unixfs"
@@ -39,34 +38,6 @@ var (
38
longRepublishTimeout = time.Millisecond * 500
39
)
40
42
-// InitializeKeyspace sets the ipns record for the given key to
43
-// point to an empty directory.
44
-func InitializeKeyspace(n *core.IpfsNode, key ci.PrivKey) error {
45
- emptyDir := &mdag.Node{Data: ft.FolderPBData()}
46
- nodek, err := n.DAG.Add(emptyDir)
47
- if err != nil {
48
- return err
49
- }
50
-
51
- err = n.Pinning.Pin(emptyDir, false)
52
- if err != nil {
53
- return err
54
- }
55
-
56
- err = n.Pinning.Flush()
57
- if err != nil {
58
- return err
59
- }
60
-
61
- pub := nsys.NewRoutingPublisher(n.Routing)
62
- err = pub.Publish(n.Context(), key, nodek)
63
- if err != nil {
64
- return err
65
- }
66
-
67
- return nil
68
-}
69
-
41
// FileSystem is the readwrite IPNS Fuse Filesystem.
42
type FileSystem struct {
43
Ipfs *core.IpfsNode
fuse/ipns/nofuse.go
deleted
-38
@@ -1,38 +0,0 @@
1
-// +build nofuse
2
-
3
-package ipns
4
-
5
-import (
6
- "errors"
7
-
8
- "github.com/jbenet/go-ipfs/core"
9
- ci "github.com/jbenet/go-ipfs/p2p/crypto"
10
-)
11
-
12
-// InitializeKeyspace sets the ipns record for the given key to
13
-// point to an empty directory.
14
-func InitializeKeyspace(n *core.IpfsNode, key ci.PrivKey) error {
15
- // emptyDir := &mdag.Node{Data: ft.FolderPBData()}
16
- // nodek, err := n.DAG.Add(emptyDir)
17
- // if err != nil {
18
- // return err
19
- // }
20
-
21
- // err = n.Pinning.Pin(emptyDir, false)
22
- // if err != nil {
23
- // return err
24
- // }
25
-
26
- // err = n.Pinning.Flush()
27
- // if err != nil {
28
- // return err
29
- // }
30
-
31
- // pub := nsys.NewRoutingPublisher(n.Routing)
32
- // err = pub.Publish(n.Context(), key, nodek)
33
- // if err != nil {
34
- // return err
35
- // }
36
-
37
- return errors.New("how is this fuse related?")
38
-}