cleaned up interface to use DAG
Juan Batiz-Benet committed
Jul 5, 2014 at 23:47 UTC
7b98bf80f4628ffe064cc0a248f5feaa430a5773
5 files changed
+4
-13
cli/add.go
+1
-1
@@ -119,7 +119,7 @@ func addFile(n *core.IpfsNode, fpath string, depth int) (*dag.Node, error) {
119
// addNode adds the node to the graph + local storage
120
func addNode(n *core.IpfsNode, nd *dag.Node, fpath string) error {
121
// add the file to the graph + local storage
122
- k, err := n.AddDagNode(nd)
122
+ k, err := n.DAG.Put(nd)
123
if err != nil {
124
return err
125
}
cli/cat.go
+1
-1
@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error {
37
return err
38
}
39
40
- nd, err := n.GetDagNode(u.Key(h))
40
+ nd, err := n.DAG.Get(u.Key(h))
41
if err != nil {
42
return err
43
}
cli/ls.go
+1
-1
@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error {
40
return err
41
}
42
43
- nd, err := n.GetDagNode(u.Key(h))
43
+ nd, err := n.DAG.Get(u.Key(h))
44
if err != nil {
45
return err
46
}
cli/refs.go
+1
-1
@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error {
58
59
var printRefs func(h mh.Multihash, recursive bool)
60
printRefs = func(h mh.Multihash, recursive bool) {
61
- nd, err := n.GetDagNode(u.Key(h))
61
+ nd, err := n.DAG.Get(u.Key(h))
62
if err != nil {
63
u.PErr("error: cannot retrieve %s (%s)\n", h.B58String(), err)
64
return
core/core.go
-9
@@ -7,7 +7,6 @@ import (
7
config "github.com/jbenet/go-ipfs/config"
8
merkledag "github.com/jbenet/go-ipfs/merkledag"
9
peer "github.com/jbenet/go-ipfs/peer"
10
- u "github.com/jbenet/go-ipfs/util"
10
)
11
12
// IPFS Core module. It represents an IPFS instance.
@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
73
74
return n, nil
75
}
77
-
78
-func (n *IpfsNode) AddDagNode(nd *merkledag.Node) (u.Key, error) {
79
- return n.DAG.Put(nd)
80
-}
81
-
82
-func (n *IpfsNode) GetDagNode(k u.Key) (*merkledag.Node, error) {
83
- return n.DAG.Get(k)
84
-}