cleaned up interface to use DAG

This commit is contained in:
Juan Batiz-Benet 2014-07-05 23:47:26 -07:00
parent 9f542f8797
commit 7b98bf80f4
5 changed files with 4 additions and 13 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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)
}