mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
coreiface: updates for moving path to subpackage
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
2e77df04ca
commit
667b7f9927
@ -13,8 +13,8 @@ import (
|
||||
|
||||
cid "github.com/ipfs/go-cid"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
|
||||
// this import keeps gx from thinking the dep isn't used
|
||||
_ "github.com/ipfs/dir-index-html"
|
||||
@ -57,7 +57,7 @@ func addAssetList(nd *core.IpfsNode, l []string) (cid.Cid, error) {
|
||||
return cid.Cid{}, err
|
||||
}
|
||||
|
||||
basePath := iface.IpfsPath(dirb.Cid())
|
||||
basePath := path.IpfsPath(dirb.Cid())
|
||||
|
||||
for _, p := range l {
|
||||
d, err := Asset(p)
|
||||
|
||||
@ -11,8 +11,8 @@ import (
|
||||
|
||||
cmdkit "github.com/ipfs/go-ipfs-cmdkit"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
)
|
||||
|
||||
@ -65,7 +65,7 @@ on raw IPFS blocks. It outputs the following to stdout:
|
||||
return err
|
||||
}
|
||||
|
||||
b, err := api.Block().Stat(req.Context, coreiface.ParsePath(req.Arguments[0]))
|
||||
b, err := api.Block().Stat(req.Context, path.ParsePath(req.Arguments[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -102,7 +102,7 @@ It outputs to stdout, and <key> is a base58 encoded multihash.
|
||||
return err
|
||||
}
|
||||
|
||||
r, err := api.Block().Get(req.Context, coreiface.ParsePath(req.Arguments[0]))
|
||||
r, err := api.Block().Get(req.Context, path.ParsePath(req.Arguments[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -224,7 +224,7 @@ It takes a list of base58 encoded multihashes to remove.
|
||||
|
||||
// TODO: use batching coreapi when done
|
||||
for _, b := range req.Arguments {
|
||||
rp, err := api.ResolvePath(req.Context, coreiface.ParsePath(b))
|
||||
rp, err := api.ResolvePath(req.Context, path.ParsePath(b))
|
||||
|
||||
err = api.Block().Rm(req.Context, rp, options.Block.Force(force))
|
||||
if err != nil {
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
"github.com/ipfs/go-ipfs-files"
|
||||
"github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -118,7 +119,7 @@ func cat(ctx context.Context, api iface.CoreAPI, paths []string, offset int64, m
|
||||
return nil, 0, nil
|
||||
}
|
||||
for _, p := range paths {
|
||||
f, err := api.Unixfs().Get(ctx, iface.ParsePath(p))
|
||||
f, err := api.Unixfs().Get(ctx, path.ParsePath(p))
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
@ -15,8 +15,7 @@ import (
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
path "github.com/ipfs/go-path"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
)
|
||||
|
||||
@ -160,7 +159,7 @@ format.
|
||||
return err
|
||||
}
|
||||
|
||||
rp, err := api.ResolvePath(req.Context, iface.ParsePath(req.Arguments[0]))
|
||||
rp, err := api.ResolvePath(req.Context, path.ParsePath(req.Arguments[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -200,7 +199,7 @@ var DagResolveCmd = &cmds.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
rp, err := api.ResolvePath(req.Context, iface.ParsePath(req.Arguments[0]))
|
||||
rp, err := api.ResolvePath(req.Context, path.ParsePath(req.Arguments[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import (
|
||||
"github.com/ipfs/go-mfs"
|
||||
ft "github.com/ipfs/go-unixfs"
|
||||
"github.com/ipfs/interface-go-ipfs-core"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
mh "github.com/multiformats/go-multihash"
|
||||
)
|
||||
|
||||
@ -363,7 +364,7 @@ var filesCpCmd = &cmds.Command{
|
||||
func getNodeFromPath(ctx context.Context, node *core.IpfsNode, api iface.CoreAPI, p string) (ipld.Node, error) {
|
||||
switch {
|
||||
case strings.HasPrefix(p, "/ipfs/"):
|
||||
return api.ResolveNode(ctx, iface.ParsePath(p))
|
||||
return api.ResolveNode(ctx, path.ParsePath(p))
|
||||
default:
|
||||
fsn, err := mfs.Lookup(node.FilesRoot, p)
|
||||
if err != nil {
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
gopath "path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -17,7 +17,7 @@ import (
|
||||
cmdkit "github.com/ipfs/go-ipfs-cmdkit"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
files "github.com/ipfs/go-ipfs-files"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
"github.com/whyrusleeping/tar-utils"
|
||||
"gopkg.in/cheggaaa/pb.v1"
|
||||
)
|
||||
@ -71,7 +71,7 @@ may also specify the level of compression by specifying '-l=<1-9>'.
|
||||
return err
|
||||
}
|
||||
|
||||
p := iface.ParsePath(req.Arguments[0])
|
||||
p := path.ParsePath(req.Arguments[0])
|
||||
|
||||
file, err := api.Unixfs().Get(req.Context, p)
|
||||
if err != nil {
|
||||
@ -264,8 +264,8 @@ func (i *identityWriteCloser) Close() error {
|
||||
}
|
||||
|
||||
func fileArchive(f files.Node, name string, archive bool, compression int) (io.Reader, error) {
|
||||
cleaned := path.Clean(name)
|
||||
_, filename := path.Split(cleaned)
|
||||
cleaned := gopath.Clean(name)
|
||||
_, filename := gopath.Split(cleaned)
|
||||
|
||||
// need to connect a writer to a reader
|
||||
piper, pipew := io.Pipe()
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
unixfs_pb "github.com/ipfs/go-unixfs/pb"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
// LsLink contains printable data for a single ipld link in ls output
|
||||
@ -131,7 +132,7 @@ The JSON output contains type information.
|
||||
}
|
||||
|
||||
for i, fpath := range paths {
|
||||
results, err := api.Unixfs().Ls(req.Context, iface.ParsePath(fpath),
|
||||
results, err := api.Unixfs().Ls(req.Context, path.ParsePath(fpath),
|
||||
options.Unixfs.ResolveChildren(resolveSize || resolveType))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -112,7 +113,7 @@ Alternatively, publish an <ipfs-path> using a valid PeerID (as listed by
|
||||
opts = append(opts, options.Name.TTL(d))
|
||||
}
|
||||
|
||||
p := iface.ParsePath(req.Arguments[0])
|
||||
p := path.ParsePath(req.Arguments[0])
|
||||
|
||||
if verifyExists, _ := req.Options[resolveOptionName].(bool); verifyExists {
|
||||
_, err := api.ResolveNode(req.Context, p)
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
|
||||
cmdkit "github.com/ipfs/go-ipfs-cmdkit"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -60,8 +60,8 @@ Example:
|
||||
return err
|
||||
}
|
||||
|
||||
pa := coreiface.ParsePath(req.Arguments[0])
|
||||
pb := coreiface.ParsePath(req.Arguments[1])
|
||||
pa := path.ParsePath(req.Arguments[0])
|
||||
pb := path.ParsePath(req.Arguments[1])
|
||||
|
||||
changes, err := api.Object().Diff(req.Context, pa, pb)
|
||||
if err != nil {
|
||||
|
||||
@ -15,8 +15,8 @@ import (
|
||||
"github.com/ipfs/go-ipfs-cmds"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
dag "github.com/ipfs/go-merkledag"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
@ -91,7 +91,7 @@ is the raw data of the object.
|
||||
return err
|
||||
}
|
||||
|
||||
path := coreiface.ParsePath(req.Arguments[0])
|
||||
path := path.ParsePath(req.Arguments[0])
|
||||
|
||||
data, err := api.Object().Data(req.Context, path)
|
||||
if err != nil {
|
||||
@ -130,7 +130,7 @@ multihash.
|
||||
return err
|
||||
}
|
||||
|
||||
path := coreiface.ParsePath(req.Arguments[0])
|
||||
path := path.ParsePath(req.Arguments[0])
|
||||
|
||||
rp, err := api.ResolvePath(req.Context, path)
|
||||
if err != nil {
|
||||
@ -222,7 +222,7 @@ Supported values are:
|
||||
return err
|
||||
}
|
||||
|
||||
path := coreiface.ParsePath(req.Arguments[0])
|
||||
path := path.ParsePath(req.Arguments[0])
|
||||
|
||||
datafieldenc, _ := req.Options[encodingOptionName].(string)
|
||||
if err != nil {
|
||||
@ -314,7 +314,7 @@ var ObjectStatCmd = &cmds.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
ns, err := api.Object().Stat(req.Context, coreiface.ParsePath(req.Arguments[0]))
|
||||
ns, err := api.Object().Stat(req.Context, path.ParsePath(req.Arguments[0]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ import (
|
||||
|
||||
"github.com/ipfs/go-ipfs-cmdkit"
|
||||
"github.com/ipfs/go-ipfs-cmds"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/options"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
var ObjectPatchCmd = &cmds.Command{
|
||||
@ -55,7 +55,7 @@ the limit will not be respected by the network.
|
||||
return err
|
||||
}
|
||||
|
||||
root := coreiface.ParsePath(req.Arguments[0])
|
||||
root := path.ParsePath(req.Arguments[0])
|
||||
|
||||
file, err := cmdenv.GetFileArg(req.Files.Entries())
|
||||
if err != nil {
|
||||
@ -99,7 +99,7 @@ Example:
|
||||
return err
|
||||
}
|
||||
|
||||
root := coreiface.ParsePath(req.Arguments[0])
|
||||
root := path.ParsePath(req.Arguments[0])
|
||||
|
||||
file, err := cmdenv.GetFileArg(req.Files.Entries())
|
||||
if err != nil {
|
||||
@ -139,7 +139,7 @@ Remove a Merkle-link from the given object and return the hash of the result.
|
||||
return err
|
||||
}
|
||||
|
||||
root := coreiface.ParsePath(req.Arguments[0])
|
||||
root := path.ParsePath(req.Arguments[0])
|
||||
|
||||
name := req.Arguments[1]
|
||||
p, err := api.Object().RmLink(req.Context, root, name)
|
||||
@ -192,9 +192,9 @@ to a file containing 'bar', and returns the hash of the new object.
|
||||
return err
|
||||
}
|
||||
|
||||
root := coreiface.ParsePath(req.Arguments[0])
|
||||
root := path.ParsePath(req.Arguments[0])
|
||||
name := req.Arguments[1]
|
||||
child := coreiface.ParsePath(req.Arguments[2])
|
||||
child := path.ParsePath(req.Arguments[2])
|
||||
|
||||
create, _ := req.Options[createOptionName].(bool)
|
||||
if err != nil {
|
||||
|
||||
@ -22,6 +22,7 @@ import (
|
||||
verifcid "github.com/ipfs/go-verifcid"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
var PinCmd = &cmds.Command{
|
||||
@ -183,7 +184,7 @@ var addPinCmd = &cmds.Command{
|
||||
func pinAddMany(ctx context.Context, api coreiface.CoreAPI, enc cidenc.Encoder, paths []string, recursive bool) ([]string, error) {
|
||||
added := make([]string, len(paths))
|
||||
for i, b := range paths {
|
||||
rp, err := api.ResolvePath(ctx, coreiface.ParsePath(b))
|
||||
rp, err := api.ResolvePath(ctx, path.ParsePath(b))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -233,7 +234,7 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.)
|
||||
|
||||
pins := make([]string, 0, len(req.Arguments))
|
||||
for _, b := range req.Arguments {
|
||||
rp, err := api.ResolvePath(req.Context, coreiface.ParsePath(b))
|
||||
rp, err := api.ResolvePath(req.Context, path.ParsePath(b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -407,8 +408,8 @@ new pin and removing the old one.
|
||||
|
||||
unpin, _ := req.Options[pinUnpinOptionName].(bool)
|
||||
|
||||
from := coreiface.ParsePath(req.Arguments[0])
|
||||
to := coreiface.ParsePath(req.Arguments[1])
|
||||
from := path.ParsePath(req.Arguments[0])
|
||||
to := path.ParsePath(req.Arguments[1])
|
||||
|
||||
err = api.Pin().Update(req.Context, from, to, options.Pin.Unpin(unpin))
|
||||
if err != nil {
|
||||
@ -497,7 +498,7 @@ func pinLsKeys(ctx context.Context, args []string, typeStr string, n *core.IpfsN
|
||||
keys := make(map[cid.Cid]RefKeyObject)
|
||||
|
||||
for _, p := range args {
|
||||
c, err := api.ResolvePath(ctx, coreiface.ParsePath(p))
|
||||
c, err := api.ResolvePath(ctx, path.ParsePath(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -14,10 +14,10 @@ import (
|
||||
cidenc "github.com/ipfs/go-cidutil/cidenc"
|
||||
cmdkit "github.com/ipfs/go-ipfs-cmdkit"
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
path "github.com/ipfs/go-path"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
ipfspath "github.com/ipfs/go-path"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -126,11 +126,11 @@ Resolve the value of an IPFS DAG path:
|
||||
if err != nil && err != ns.ErrResolveRecursion {
|
||||
return err
|
||||
}
|
||||
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: path.Path(p.String())})
|
||||
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: ipfspath.Path(p.String())})
|
||||
}
|
||||
|
||||
// else, ipfs path or ipns with recursive flag
|
||||
rp, err := api.ResolvePath(req.Context, coreiface.ParsePath(name))
|
||||
rp, err := api.ResolvePath(req.Context, path.ParsePath(name))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -140,7 +140,7 @@ Resolve the value of an IPFS DAG path:
|
||||
encoded += "/" + remainder
|
||||
}
|
||||
|
||||
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: path.Path(encoded)})
|
||||
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: ipfspath.Path(encoded)})
|
||||
},
|
||||
Encoders: cmds.EncoderMap{
|
||||
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, rp *ncmd.ResolvedPath) error {
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
cmds "github.com/ipfs/go-ipfs-cmds"
|
||||
merkledag "github.com/ipfs/go-merkledag"
|
||||
unixfs "github.com/ipfs/go-unixfs"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
type LsLink struct {
|
||||
@ -96,7 +96,7 @@ possible, please use 'ipfs ls' instead.
|
||||
for _, p := range paths {
|
||||
ctx := req.Context
|
||||
|
||||
merkleNode, err := api.ResolveNode(ctx, iface.ParsePath(p))
|
||||
merkleNode, err := api.ResolveNode(ctx, path.ParsePath(p))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -14,12 +14,13 @@ import (
|
||||
cid "github.com/ipfs/go-cid"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
type BlockAPI CoreAPI
|
||||
|
||||
type BlockStat struct {
|
||||
path coreiface.ResolvedPath
|
||||
path path.ResolvedPath
|
||||
size int
|
||||
}
|
||||
|
||||
@ -57,10 +58,10 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
|
||||
api.pinning.PinWithMode(b.Cid(), pin.Recursive)
|
||||
}
|
||||
|
||||
return &BlockStat{path: coreiface.IpldPath(b.Cid()), size: len(data)}, nil
|
||||
return &BlockStat{path: path.IpldPath(b.Cid()), size: len(data)}, nil
|
||||
}
|
||||
|
||||
func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, error) {
|
||||
func (api *BlockAPI) Get(ctx context.Context, p path.Path) (io.Reader, error) {
|
||||
rp, err := api.core().ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -74,7 +75,7 @@ func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, erro
|
||||
return bytes.NewReader(b.RawData()), nil
|
||||
}
|
||||
|
||||
func (api *BlockAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.BlockRmOption) error {
|
||||
func (api *BlockAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.BlockRmOption) error {
|
||||
rp, err := api.core().ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -112,7 +113,7 @@ func (api *BlockAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.Bl
|
||||
}
|
||||
}
|
||||
|
||||
func (api *BlockAPI) Stat(ctx context.Context, p coreiface.Path) (coreiface.BlockStat, error) {
|
||||
func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (coreiface.BlockStat, error) {
|
||||
rp, err := api.core().ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -124,7 +125,7 @@ func (api *BlockAPI) Stat(ctx context.Context, p coreiface.Path) (coreiface.Bloc
|
||||
}
|
||||
|
||||
return &BlockStat{
|
||||
path: coreiface.IpldPath(b.Cid()),
|
||||
path: path.IpldPath(b.Cid()),
|
||||
size: len(b.RawData()),
|
||||
}, nil
|
||||
}
|
||||
@ -133,7 +134,7 @@ func (bs *BlockStat) Size() int {
|
||||
return bs.size
|
||||
}
|
||||
|
||||
func (bs *BlockStat) Path() coreiface.ResolvedPath {
|
||||
func (bs *BlockStat) Path() path.ResolvedPath {
|
||||
return bs.path
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
dag "github.com/ipfs/go-merkledag"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
pstore "github.com/libp2p/go-libp2p-peerstore"
|
||||
routing "github.com/libp2p/go-libp2p-routing"
|
||||
@ -33,7 +34,7 @@ func (api *DhtAPI) FindPeer(ctx context.Context, p peer.ID) (pstore.PeerInfo, er
|
||||
return pi, nil
|
||||
}
|
||||
|
||||
func (api *DhtAPI) FindProviders(ctx context.Context, p coreiface.Path, opts ...caopts.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) {
|
||||
func (api *DhtAPI) FindProviders(ctx context.Context, p path.Path, opts ...caopts.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) {
|
||||
settings, err := caopts.DhtFindProvidersOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -58,7 +59,7 @@ func (api *DhtAPI) FindProviders(ctx context.Context, p coreiface.Path, opts ...
|
||||
return pchan, nil
|
||||
}
|
||||
|
||||
func (api *DhtAPI) Provide(ctx context.Context, path coreiface.Path, opts ...caopts.DhtProvideOption) error {
|
||||
func (api *DhtAPI) Provide(ctx context.Context, path path.Path, opts ...caopts.DhtProvideOption) error {
|
||||
settings, err := caopts.DhtProvideOptions(opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
ipfspath "github.com/ipfs/go-path"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
crypto "github.com/libp2p/go-libp2p-crypto"
|
||||
peer "github.com/libp2p/go-libp2p-peer"
|
||||
)
|
||||
@ -27,8 +28,8 @@ func (k *key) Name() string {
|
||||
}
|
||||
|
||||
// Path returns the path of the key.
|
||||
func (k *key) Path() coreiface.Path {
|
||||
return coreiface.ParsePath(ipfspath.Join([]string{"/ipns", k.peerID.Pretty()}))
|
||||
func (k *key) Path() path.Path {
|
||||
return path.ParsePath(ipfspath.Join([]string{"/ipns", k.peerID.Pretty()}))
|
||||
}
|
||||
|
||||
// ID returns key PeerID
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
ipath "github.com/ipfs/go-path"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
"github.com/libp2p/go-libp2p-crypto"
|
||||
ci "github.com/libp2p/go-libp2p-crypto"
|
||||
"github.com/libp2p/go-libp2p-peer"
|
||||
@ -21,7 +22,7 @@ type NameAPI CoreAPI
|
||||
|
||||
type ipnsEntry struct {
|
||||
name string
|
||||
value coreiface.Path
|
||||
value path.Path
|
||||
}
|
||||
|
||||
// Name returns the ipnsEntry name.
|
||||
@ -30,12 +31,12 @@ func (e *ipnsEntry) Name() string {
|
||||
}
|
||||
|
||||
// Value returns the ipnsEntry value.
|
||||
func (e *ipnsEntry) Value() coreiface.Path {
|
||||
func (e *ipnsEntry) Value() path.Path {
|
||||
return e.value
|
||||
}
|
||||
|
||||
// Publish announces new IPNS name and returns the new IPNS entry.
|
||||
func (api *NameAPI) Publish(ctx context.Context, p coreiface.Path, opts ...caopts.NamePublishOption) (coreiface.IpnsEntry, error) {
|
||||
func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.NamePublishOption) (coreiface.IpnsEntry, error) {
|
||||
if err := api.checkPublishAllowed(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -107,7 +108,7 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
|
||||
defer close(out)
|
||||
for res := range resolver.ResolveAsync(ctx, name, options.ResolveOpts...) {
|
||||
select {
|
||||
case out <- coreiface.IpnsResult{Path: coreiface.ParsePath(res.Path.String()), Err: res.Err}:
|
||||
case out <- coreiface.IpnsResult{Path: path.ParsePath(res.Path.String()), Err: res.Err}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
@ -119,14 +120,14 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
|
||||
|
||||
// Resolve attempts to resolve the newest version of the specified name and
|
||||
// returns its path.
|
||||
func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (coreiface.Path, error) {
|
||||
func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (path.Path, error) {
|
||||
results, err := api.Search(ctx, name, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = coreiface.ErrResolveFailed
|
||||
var p coreiface.Path
|
||||
var p path.Path
|
||||
|
||||
for res := range results {
|
||||
p, err = res.Path, res.Err
|
||||
|
||||
@ -20,6 +20,7 @@ import (
|
||||
ft "github.com/ipfs/go-unixfs"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
ipath "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
const inputLimit = 2 << 20
|
||||
@ -57,7 +58,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.ObjectPutOption) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.ObjectPutOption) (ipath.ResolvedPath, error) {
|
||||
options, err := caopts.ObjectPutOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -134,14 +135,14 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
}
|
||||
}
|
||||
|
||||
return coreiface.IpfsPath(dagnode.Cid()), nil
|
||||
return ipath.IpfsPath(dagnode.Cid()), nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Get(ctx context.Context, path coreiface.Path) (ipld.Node, error) {
|
||||
func (api *ObjectAPI) Get(ctx context.Context, path ipath.Path) (ipld.Node, error) {
|
||||
return api.core().ResolveNode(ctx, path)
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Data(ctx context.Context, path coreiface.Path) (io.Reader, error) {
|
||||
func (api *ObjectAPI) Data(ctx context.Context, path ipath.Path) (io.Reader, error) {
|
||||
nd, err := api.core().ResolveNode(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -155,7 +156,7 @@ func (api *ObjectAPI) Data(ctx context.Context, path coreiface.Path) (io.Reader,
|
||||
return bytes.NewReader(pbnd.Data()), nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Links(ctx context.Context, path coreiface.Path) ([]*ipld.Link, error) {
|
||||
func (api *ObjectAPI) Links(ctx context.Context, path ipath.Path) ([]*ipld.Link, error) {
|
||||
nd, err := api.core().ResolveNode(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -170,7 +171,7 @@ func (api *ObjectAPI) Links(ctx context.Context, path coreiface.Path) ([]*ipld.L
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Stat(ctx context.Context, path coreiface.Path) (*coreiface.ObjectStat, error) {
|
||||
func (api *ObjectAPI) Stat(ctx context.Context, path ipath.Path) (*coreiface.ObjectStat, error) {
|
||||
nd, err := api.core().ResolveNode(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -193,7 +194,7 @@ func (api *ObjectAPI) Stat(ctx context.Context, path coreiface.Path) (*coreiface
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name string, child coreiface.Path, opts ...caopts.ObjectAddLinkOption) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) AddLink(ctx context.Context, base ipath.Path, name string, child ipath.Path, opts ...caopts.ObjectAddLinkOption) (ipath.ResolvedPath, error) {
|
||||
options, err := caopts.ObjectAddLinkOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -231,10 +232,10 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name str
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return coreiface.IpfsPath(nnode.Cid()), nil
|
||||
return ipath.IpfsPath(nnode.Cid()), nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link string) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) RmLink(ctx context.Context, base ipath.Path, link string) (ipath.ResolvedPath, error) {
|
||||
baseNd, err := api.core().ResolveNode(ctx, base)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -257,18 +258,18 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link stri
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return coreiface.IpfsPath(nnode.Cid()), nil
|
||||
return ipath.IpfsPath(nnode.Cid()), nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) AppendData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) AppendData(ctx context.Context, path ipath.Path, r io.Reader) (ipath.ResolvedPath, error) {
|
||||
return api.patchData(ctx, path, r, true)
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) SetData(ctx context.Context, path coreiface.Path, r io.Reader) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) SetData(ctx context.Context, path ipath.Path, r io.Reader) (ipath.ResolvedPath, error) {
|
||||
return api.patchData(ctx, path, r, false)
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.Reader, appendData bool) (coreiface.ResolvedPath, error) {
|
||||
func (api *ObjectAPI) patchData(ctx context.Context, path ipath.Path, r io.Reader, appendData bool) (ipath.ResolvedPath, error) {
|
||||
nd, err := api.core().ResolveNode(ctx, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -294,10 +295,10 @@ func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.R
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return coreiface.IpfsPath(pbnd.Cid()), nil
|
||||
return ipath.IpfsPath(pbnd.Cid()), nil
|
||||
}
|
||||
|
||||
func (api *ObjectAPI) Diff(ctx context.Context, before coreiface.Path, after coreiface.Path) ([]coreiface.ObjectChange, error) {
|
||||
func (api *ObjectAPI) Diff(ctx context.Context, before ipath.Path, after ipath.Path) ([]coreiface.ObjectChange, error) {
|
||||
beforeNd, err := api.core().ResolveNode(ctx, before)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -321,11 +322,11 @@ func (api *ObjectAPI) Diff(ctx context.Context, before coreiface.Path, after cor
|
||||
}
|
||||
|
||||
if change.Before.Defined() {
|
||||
out[i].Before = coreiface.IpfsPath(change.Before)
|
||||
out[i].Before = ipath.IpfsPath(change.Before)
|
||||
}
|
||||
|
||||
if change.After.Defined() {
|
||||
out[i].After = coreiface.IpfsPath(change.After)
|
||||
out[i].After = ipath.IpfsPath(change.After)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,11 +13,12 @@ import (
|
||||
"github.com/ipfs/go-path/resolver"
|
||||
uio "github.com/ipfs/go-unixfs/io"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
// ResolveNode resolves the path `p` using Unixfs resolver, gets and returns the
|
||||
// resolved Node.
|
||||
func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (ipld.Node, error) {
|
||||
func (api *CoreAPI) ResolveNode(ctx context.Context, p path.Path) (ipld.Node, error) {
|
||||
rp, err := api.ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -32,9 +33,9 @@ func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (ipld.Nod
|
||||
|
||||
// ResolvePath resolves the path `p` using Unixfs resolver, returns the
|
||||
// resolved path.
|
||||
func (api *CoreAPI) ResolvePath(ctx context.Context, p coreiface.Path) (coreiface.ResolvedPath, error) {
|
||||
if _, ok := p.(coreiface.ResolvedPath); ok {
|
||||
return p.(coreiface.ResolvedPath), nil
|
||||
func (api *CoreAPI) ResolvePath(ctx context.Context, p path.Path) (path.ResolvedPath, error) {
|
||||
if _, ok := p.(path.ResolvedPath); ok {
|
||||
return p.(path.ResolvedPath), nil
|
||||
}
|
||||
if err := p.IsValid(); err != nil {
|
||||
return nil, err
|
||||
@ -74,5 +75,5 @@ func (api *CoreAPI) ResolvePath(ctx context.Context, p coreiface.Path) (coreifac
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return coreiface.NewResolvedPath(ipath, node, root, gopath.Join(rest...)), nil
|
||||
return path.NewResolvedPath(ipath, node, root, gopath.Join(rest...)), nil
|
||||
}
|
||||
|
||||
@ -10,11 +10,12 @@ import (
|
||||
merkledag "github.com/ipfs/go-merkledag"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
caopts "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
type PinAPI CoreAPI
|
||||
|
||||
func (api *PinAPI) Add(ctx context.Context, p coreiface.Path, opts ...caopts.PinAddOption) error {
|
||||
func (api *PinAPI) Add(ctx context.Context, p path.Path, opts ...caopts.PinAddOption) error {
|
||||
dagNode, err := api.core().ResolveNode(ctx, p)
|
||||
if err != nil {
|
||||
return fmt.Errorf("pin: %s", err)
|
||||
@ -55,7 +56,7 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]coreif
|
||||
}
|
||||
|
||||
// Rm pin rm api
|
||||
func (api *PinAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.PinRmOption) error {
|
||||
func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOption) error {
|
||||
rp, err := api.core().ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -73,7 +74,7 @@ func (api *PinAPI) Rm(ctx context.Context, p coreiface.Path, opts ...caopts.PinR
|
||||
return api.pinning.Flush()
|
||||
}
|
||||
|
||||
func (api *PinAPI) Update(ctx context.Context, from coreiface.Path, to coreiface.Path, opts ...caopts.PinUpdateOption) error {
|
||||
func (api *PinAPI) Update(ctx context.Context, from path.Path, to path.Path, opts ...caopts.PinUpdateOption) error {
|
||||
settings, err := caopts.PinUpdateOptions(opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -107,7 +108,7 @@ type pinStatus struct {
|
||||
|
||||
// BadNode is used in PinVerifyRes
|
||||
type badNode struct {
|
||||
path coreiface.ResolvedPath
|
||||
path path.ResolvedPath
|
||||
err error
|
||||
}
|
||||
|
||||
@ -119,7 +120,7 @@ func (s *pinStatus) BadNodes() []coreiface.BadPinNode {
|
||||
return s.badNodes
|
||||
}
|
||||
|
||||
func (n *badNode) Path() coreiface.ResolvedPath {
|
||||
func (n *badNode) Path() path.ResolvedPath {
|
||||
return n.path
|
||||
}
|
||||
|
||||
@ -143,7 +144,7 @@ func (api *PinAPI) Verify(ctx context.Context) (<-chan coreiface.PinStatus, erro
|
||||
links, err := getLinks(ctx, root)
|
||||
if err != nil {
|
||||
status := &pinStatus{ok: false, cid: root}
|
||||
status.badNodes = []coreiface.BadPinNode{&badNode{path: coreiface.IpldPath(root), err: err}}
|
||||
status.badNodes = []coreiface.BadPinNode{&badNode{path: path.IpldPath(root), err: err}}
|
||||
visited[root] = status
|
||||
return status
|
||||
}
|
||||
@ -174,10 +175,10 @@ func (api *PinAPI) Verify(ctx context.Context) (<-chan coreiface.PinStatus, erro
|
||||
|
||||
type pinInfo struct {
|
||||
pinType string
|
||||
path coreiface.ResolvedPath
|
||||
path path.ResolvedPath
|
||||
}
|
||||
|
||||
func (p *pinInfo) Path() coreiface.ResolvedPath {
|
||||
func (p *pinInfo) Path() path.ResolvedPath {
|
||||
return p.path
|
||||
}
|
||||
|
||||
@ -193,7 +194,7 @@ func (api *PinAPI) pinLsAll(typeStr string, ctx context.Context) ([]coreiface.Pi
|
||||
for _, c := range keyList {
|
||||
keys[c] = &pinInfo{
|
||||
pinType: typeStr,
|
||||
path: coreiface.IpldPath(c),
|
||||
path: path.IpldPath(c),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,14 +22,15 @@ import (
|
||||
unixfile "github.com/ipfs/go-unixfs/file"
|
||||
uio "github.com/ipfs/go-unixfs/io"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/options"
|
||||
options "github.com/ipfs/interface-go-ipfs-core/options"
|
||||
path "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
type UnixfsAPI CoreAPI
|
||||
|
||||
// Add builds a merkledag node from a reader, adds it to the blockstore,
|
||||
// and returns the key representing that node.
|
||||
func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options.UnixfsAddOption) (coreiface.ResolvedPath, error) {
|
||||
func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options.UnixfsAddOption) (path.ResolvedPath, error) {
|
||||
settings, prefix, err := options.UnixfsAddOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -130,10 +131,10 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return coreiface.IpfsPath(nd.Cid()), nil
|
||||
return path.IpfsPath(nd.Cid()), nil
|
||||
}
|
||||
|
||||
func (api *UnixfsAPI) Get(ctx context.Context, p coreiface.Path) (files.Node, error) {
|
||||
func (api *UnixfsAPI) Get(ctx context.Context, p path.Path) (files.Node, error) {
|
||||
ses := api.core().getSession(ctx)
|
||||
|
||||
nd, err := ses.ResolveNode(ctx, p)
|
||||
@ -146,7 +147,7 @@ func (api *UnixfsAPI) Get(ctx context.Context, p coreiface.Path) (files.Node, er
|
||||
|
||||
// Ls returns the contents of an IPFS or IPNS object(s) at path p, with the format:
|
||||
// `<link base58 hash> <link size in bytes> <link name>`
|
||||
func (api *UnixfsAPI) Ls(ctx context.Context, p coreiface.Path, opts ...options.UnixfsLsOption) (<-chan coreiface.DirEntry, error) {
|
||||
func (api *UnixfsAPI) Ls(ctx context.Context, p path.Path, opts ...options.UnixfsLsOption) (<-chan coreiface.DirEntry, error) {
|
||||
settings, err := options.UnixfsLsOptions(opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -26,6 +26,7 @@ import (
|
||||
ft "github.com/ipfs/go-unixfs"
|
||||
"github.com/ipfs/go-unixfs/importer"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
ipath "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
"github.com/libp2p/go-libp2p-routing"
|
||||
"github.com/multiformats/go-multibase"
|
||||
)
|
||||
@ -147,7 +148,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
|
||||
ipnsHostname = true
|
||||
}
|
||||
|
||||
parsedPath := coreiface.ParsePath(urlPath)
|
||||
parsedPath := ipath.ParsePath(urlPath)
|
||||
if err := parsedPath.IsValid(); err != nil {
|
||||
webError(w, "invalid ipfs path", err, http.StatusBadRequest)
|
||||
return
|
||||
@ -246,7 +247,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
|
||||
return
|
||||
}
|
||||
|
||||
idx, err := i.api.Unixfs().Get(ctx, coreiface.Join(resolvedPath, "index.html"))
|
||||
idx, err := i.api.Unixfs().Get(ctx, ipath.Join(resolvedPath, "index.html"))
|
||||
switch err.(type) {
|
||||
case nil:
|
||||
dirwithoutslash := urlPath[len(urlPath)-1] != '/'
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
path "github.com/ipfs/go-path"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
nsopts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
|
||||
ipath "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
ci "github.com/libp2p/go-libp2p-crypto"
|
||||
id "github.com/libp2p/go-libp2p/p2p/protocol/identify"
|
||||
)
|
||||
@ -344,12 +345,12 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
k2, err := api.ResolvePath(ctx, iface.Join(k, "foo? #<'"))
|
||||
k2, err := api.ResolvePath(ctx, ipath.Join(k, "foo? #<'"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
k3, err := api.ResolvePath(ctx, iface.Join(k, "foo? #<'/bar"))
|
||||
k3, err := api.ResolvePath(ctx, ipath.Join(k, "foo? #<'/bar"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import (
|
||||
ihelper "github.com/ipfs/go-unixfs/importer/helpers"
|
||||
"github.com/ipfs/go-unixfs/importer/trickle"
|
||||
coreiface "github.com/ipfs/interface-go-ipfs-core"
|
||||
"github.com/ipfs/interface-go-ipfs-core/path"
|
||||
)
|
||||
|
||||
var log = logging.Logger("coreunix")
|
||||
@ -478,7 +479,7 @@ func getOutput(dagnode ipld.Node) (*coreiface.AddEvent, error) {
|
||||
}
|
||||
|
||||
output := &coreiface.AddEvent{
|
||||
Path: coreiface.IpfsPath(c),
|
||||
Path: path.IpfsPath(c),
|
||||
Size: strconv.FormatUint(s, 10),
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ import (
|
||||
dag "github.com/ipfs/go-merkledag"
|
||||
importer "github.com/ipfs/go-unixfs/importer"
|
||||
uio "github.com/ipfs/go-unixfs/io"
|
||||
iface "github.com/ipfs/interface-go-ipfs-core"
|
||||
ipath "github.com/ipfs/interface-go-ipfs-core/path"
|
||||
ci "github.com/libp2p/go-testutil/ci"
|
||||
)
|
||||
|
||||
@ -184,7 +184,7 @@ func TestIpfsStressRead(t *testing.T) {
|
||||
defer wg.Done()
|
||||
|
||||
for i := 0; i < 2000; i++ {
|
||||
item := iface.ParsePath(paths[rand.Intn(len(paths))])
|
||||
item := ipath.ParsePath(paths[rand.Intn(len(paths))])
|
||||
|
||||
relpath := strings.Replace(item.String(), item.Namespace(), "", 1)
|
||||
fname := path.Join(mnt.Dir, relpath)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user