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) {
// addNode adds the node to the graph + local storage
func addNode(n *core.IpfsNode, nd *dag.Node, fpath string) error {
// add the file to the graph + local storage
k, err := n.AddDagNode(nd)
k, err := n.DAG.Put(nd)
if err != nil {
return err
}
......
......@@ -37,7 +37,7 @@ func catCmd(c *commander.Command, inp []string) error {
return err
}
nd, err := n.GetDagNode(u.Key(h))
nd, err := n.DAG.Get(u.Key(h))
if err != nil {
return err
}
......
......@@ -40,7 +40,7 @@ func lsCmd(c *commander.Command, inp []string) error {
return err
}
nd, err := n.GetDagNode(u.Key(h))
nd, err := n.DAG.Get(u.Key(h))
if err != nil {
return err
}
......
......@@ -58,7 +58,7 @@ func refCmd(c *commander.Command, inp []string) error {
var 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 {
u.PErr("error: cannot retrieve %s (%s)\n", h.B58String(), err)
return
......
......@@ -7,7 +7,6 @@ import (
config "github.com/jbenet/go-ipfs/config"
merkledag "github.com/jbenet/go-ipfs/merkledag"
peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util"
)
// IPFS Core module. It represents an IPFS instance.
......@@ -74,11 +73,3 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
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