@cryptotaxi247 / kubo / commits / eb6afd3ed

fix interface for coreunix.Cat, now takes a path

Jeromy committed Jan 23, 2015 at 04:08 UTC eb6afd3edc35802ba8874ff373a712d4de3ae6f1
4 files changed +6 -10
core/core.go
+2 -5
@@ -36,7 +36,6 @@ import (
36 dht "github.com/jbenet/go-ipfs/routing/dht"
37 offroute "github.com/jbenet/go-ipfs/routing/offline"
38 eventlog "github.com/jbenet/go-ipfs/thirdparty/eventlog"
39 - util "github.com/jbenet/go-ipfs/util"
39 debugerror "github.com/jbenet/go-ipfs/util/debugerror"
40 lgbl "github.com/jbenet/go-ipfs/util/eventlog/loggables"
41 )
@@ -302,10 +301,8 @@ func (n *IpfsNode) OnlineMode() bool {
301 }
302 }
303
305 -// TODO expose way to resolve path name
306 -
307 -func (n *IpfsNode) Resolve(k util.Key) (*merkledag.Node, error) {
308 - return (&path.Resolver{n.DAG}).ResolvePath(k.String())
304 +func (n *IpfsNode) Resolve(path string) (*merkledag.Node, error) {
305 + return n.Resolver.ResolvePath(path)
306 }
307
308 // Bootstrap is undefined when node is not in OnlineMode
core/coreunix/cat.go
+2 -3
@@ -5,11 +5,10 @@ import (
5
6 core "github.com/jbenet/go-ipfs/core"
7 uio "github.com/jbenet/go-ipfs/unixfs/io"
8 - u "github.com/jbenet/go-ipfs/util"
8 )
9
11 -func Cat(n *core.IpfsNode, k u.Key) (io.Reader, error) {
12 - dagNode, err := n.Resolve(k)
10 +func Cat(n *core.IpfsNode, path string) (io.Reader, error) {
11 + dagNode, err := n.Resolver.ResolvePath(path)
12 if err != nil {
13 return nil, err
14 }
test/epictest/addcat_test.go
+1 -1
@@ -123,7 +123,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
123 return err
124 }
125
126 - readerCatted, err := coreunix.Cat(catter, keyAdded)
126 + readerCatted, err := coreunix.Cat(catter, keyAdded.String())
127 if err != nil {
128 return err
129 }
test/epictest/three_legged_cat_test.go
+1 -1
@@ -71,7 +71,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
71 return err
72 }
73
74 - readerCatted, err := coreunix.Cat(catter, keyAdded)
74 + readerCatted, err := coreunix.Cat(catter, keyAdded.String())
75 if err != nil {
76 return err
77 }