mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-06 16:58:11 +08:00
fix interface for coreunix.Cat, now takes a path
This commit is contained in:
parent
4dc5906b18
commit
eb6afd3edc
@ -36,7 +36,6 @@ import (
|
||||
dht "github.com/jbenet/go-ipfs/routing/dht"
|
||||
offroute "github.com/jbenet/go-ipfs/routing/offline"
|
||||
eventlog "github.com/jbenet/go-ipfs/thirdparty/eventlog"
|
||||
util "github.com/jbenet/go-ipfs/util"
|
||||
debugerror "github.com/jbenet/go-ipfs/util/debugerror"
|
||||
lgbl "github.com/jbenet/go-ipfs/util/eventlog/loggables"
|
||||
)
|
||||
@ -302,10 +301,8 @@ func (n *IpfsNode) OnlineMode() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO expose way to resolve path name
|
||||
|
||||
func (n *IpfsNode) Resolve(k util.Key) (*merkledag.Node, error) {
|
||||
return (&path.Resolver{n.DAG}).ResolvePath(k.String())
|
||||
func (n *IpfsNode) Resolve(path string) (*merkledag.Node, error) {
|
||||
return n.Resolver.ResolvePath(path)
|
||||
}
|
||||
|
||||
// Bootstrap is undefined when node is not in OnlineMode
|
||||
|
||||
@ -5,11 +5,10 @@ import (
|
||||
|
||||
core "github.com/jbenet/go-ipfs/core"
|
||||
uio "github.com/jbenet/go-ipfs/unixfs/io"
|
||||
u "github.com/jbenet/go-ipfs/util"
|
||||
)
|
||||
|
||||
func Cat(n *core.IpfsNode, k u.Key) (io.Reader, error) {
|
||||
dagNode, err := n.Resolve(k)
|
||||
func Cat(n *core.IpfsNode, path string) (io.Reader, error) {
|
||||
dagNode, err := n.Resolver.ResolvePath(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
readerCatted, err := coreunix.Cat(catter, keyAdded)
|
||||
readerCatted, err := coreunix.Cat(catter, keyAdded.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
readerCatted, err := coreunix.Cat(catter, keyAdded)
|
||||
readerCatted, err := coreunix.Cat(catter, keyAdded.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user