Commit 7b98bf80 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

cleaned up interface to use DAG

parent 9f542f87
...@@ -119,7 +119,7 @@ func addFile(n *core.IpfsNode, fpath string, depth int) (*dag.Node, error) { ...@@ -119,7 +119,7 @@ func addFile(n *core.IpfsNode, fpath string, depth int) (*dag.Node, error) {
// addNode adds the node to the graph + local storage // addNode adds the node to the graph + local storage
func addNode(n *core.IpfsNode, nd *dag.Node, fpath string) error { func addNode(n *core.IpfsNode, nd *dag.Node, fpath string) error {
// add the file to the graph + local storage // add the file to the graph + local storage
k, err := n.AddDagNode(nd) k, err := n.DAG.Put(nd)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error { ...@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error {
return err return err
} }
nd, err := n.GetDagNode(u.Key(h)) nd, err := n.DAG.Get(u.Key(h))
if err != nil { if err != nil {
return err return err
} }
......
...@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error { ...@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error {
return err return err
} }
nd, err := n.GetDagNode(u.Key(h)) nd, err := n.DAG.Get(u.Key(h))
if err != nil { if err != nil {
return err return err
} }
......
...@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error { ...@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error {
var printRefs func(h mh.Multihash, recursive bool) var printRefs func(h mh.Multihash, recursive bool)
printRefs = func(h mh.Multihash, recursive bool) { printRefs = func(h mh.Multihash, recursive bool) {
nd, err := n.GetDagNode(u.Key(h)) nd, err := n.DAG.Get(u.Key(h))
if err != nil { if err != nil {
u.PErr("error: cannot retrieve %s (%s)\n", h.B58String(), err) u.PErr("error: cannot retrieve %s (%s)\n", h.B58String(), err)
return return
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
config "github.com/jbenet/go-ipfs/config" config "github.com/jbenet/go-ipfs/config"
merkledag "github.com/jbenet/go-ipfs/merkledag" merkledag "github.com/jbenet/go-ipfs/merkledag"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util"
) )
// IPFS Core module. It represents an IPFS instance. // IPFS Core module. It represents an IPFS instance.
...@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) { ...@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
return n, nil return n, nil
} }
func (n *IpfsNode) AddDagNode(nd *merkledag.Node) (u.Key, error) {
return n.DAG.Put(nd)
}
func (n *IpfsNode) GetDagNode(k u.Key) (*merkledag.Node, error) {
return n.DAG.Get(k)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment