@cryptotaxi247 / kubo / commits / 3b6761520

gomod: update iface with path refactor

This commit was moved from ipfs/go-ipfs-http-client@0bd65a67ee2994966538fae6d034ddb9fac466e6

Łukasz Magiera committed Apr 26, 2019 at 20:30 UTC 3b67615201cd38aceb6de61e87da1552be7689fb
11 files changed +75 -73
client/httpapi/api_test.go
+2 -5
@@ -10,6 +10,7 @@ import (
10 "testing"
11
12 "github.com/ipfs/interface-go-ipfs-core"
13 + "github.com/ipfs/interface-go-ipfs-core/path"
14 "github.com/ipfs/interface-go-ipfs-core/tests"
15 local "github.com/ipfs/iptb-plugins/local"
16 "github.com/ipfs/iptb/testbed"
@@ -171,11 +172,7 @@ func (NodeProvider) makeAPISwarm(ctx context.Context, fullIdentity bool, n int)
172 }
173
174 // empty node is pinned even with --empty-repo, we don't want that
174 - emptyNode, err := iface.ParsePath("/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
175 - if err != nil {
176 - errs <- err
177 - return
178 - }
175 + emptyNode := path.New("/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
176 if err := apis[i].Pin().Rm(ctx, emptyNode); err != nil {
177 errs <- err
178 return
client/httpapi/apifile.go
+8 -8
@@ -10,12 +10,12 @@ import (
10 "github.com/ipfs/go-cid"
11 files "github.com/ipfs/go-ipfs-files"
12 unixfs "github.com/ipfs/go-unixfs"
13 - iface "github.com/ipfs/interface-go-ipfs-core"
13 + "github.com/ipfs/interface-go-ipfs-core/path"
14 )
15
16 const forwardSeekLimit = 1 << 14 //16k
17
18 -func (api *UnixfsAPI) Get(ctx context.Context, p iface.Path) (files.Node, error) {
18 +func (api *UnixfsAPI) Get(ctx context.Context, p path.Path) (files.Node, error) {
19 if p.Mutable() { // use resolved path in case we are dealing with IPNS / MFS
20 var err error
21 p, err = api.core().ResolvePath(ctx, p)
@@ -48,7 +48,7 @@ type apiFile struct {
48 ctx context.Context
49 core *HttpApi
50 size int64
51 - path iface.Path
51 + path path.Path
52
53 r *Response
54 at int64
@@ -114,7 +114,7 @@ func (f *apiFile) Size() (int64, error) {
114 return f.size, nil
115 }
116
117 -func (api *UnixfsAPI) getFile(ctx context.Context, p iface.Path, size int64) (files.Node, error) {
117 +func (api *UnixfsAPI) getFile(ctx context.Context, p path.Path, size int64) (files.Node, error) {
118 f := &apiFile{
119 ctx: ctx,
120 core: api.core(),
@@ -177,13 +177,13 @@ func (it *apiIter) Next() bool {
177
178 switch it.cur.Type {
179 case unixfs.THAMTShard, unixfs.TMetadata, unixfs.TDirectory:
180 - it.curFile, err = it.core.getDir(it.ctx, iface.IpfsPath(c), int64(it.cur.Size))
180 + it.curFile, err = it.core.getDir(it.ctx, path.IpfsPath(c), int64(it.cur.Size))
181 if err != nil {
182 it.err = err
183 return false
184 }
185 case unixfs.TFile:
186 - it.curFile, err = it.core.getFile(it.ctx, iface.IpfsPath(c), int64(it.cur.Size))
186 + it.curFile, err = it.core.getFile(it.ctx, path.IpfsPath(c), int64(it.cur.Size))
187 if err != nil {
188 it.err = err
189 return false
@@ -203,7 +203,7 @@ type apiDir struct {
203 ctx context.Context
204 core *UnixfsAPI
205 size int64
206 - path iface.Path
206 + path path.Path
207
208 dec *json.Decoder
209 }
@@ -224,7 +224,7 @@ func (d *apiDir) Entries() files.DirIterator {
224 }
225 }
226
227 -func (api *UnixfsAPI) getDir(ctx context.Context, p iface.Path, size int64) (files.Node, error) {
227 +func (api *UnixfsAPI) getDir(ctx context.Context, p path.Path, size int64) (files.Node, error) {
228 resp, err := api.core().Request("ls", p.String()).
229 Option("resolve-size", true).
230 Option("stream", true).Send(ctx)
client/httpapi/block.go
+6 -5
@@ -10,6 +10,7 @@ import (
10 "github.com/ipfs/go-cid"
11 "github.com/ipfs/interface-go-ipfs-core"
12 caopts "github.com/ipfs/interface-go-ipfs-core/options"
13 + "github.com/ipfs/interface-go-ipfs-core/path"
14 mh "github.com/multiformats/go-multihash"
15 )
16
@@ -26,8 +27,8 @@ func (s *blockStat) Size() int {
27 return s.BSize
28 }
29
29 -func (s *blockStat) Path() iface.ResolvedPath {
30 - return iface.IpldPath(s.cid)
30 +func (s *blockStat) Path() path.Resolved {
31 + return path.IpldPath(s.cid)
32 }
33
34 func (api *BlockAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.BlockPutOption) (iface.BlockStat, error) {
@@ -60,7 +61,7 @@ func (api *BlockAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.BlockP
61 return &out, nil
62 }
63
63 -func (api *BlockAPI) Get(ctx context.Context, p iface.Path) (io.Reader, error) {
64 +func (api *BlockAPI) Get(ctx context.Context, p path.Path) (io.Reader, error) {
65 resp, err := api.core().Request("block/get", p.String()).Send(ctx)
66 if err != nil {
67 return nil, err
@@ -79,7 +80,7 @@ func (api *BlockAPI) Get(ctx context.Context, p iface.Path) (io.Reader, error) {
80 return b, nil
81 }
82
82 -func (api *BlockAPI) Rm(ctx context.Context, p iface.Path, opts ...caopts.BlockRmOption) error {
83 +func (api *BlockAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.BlockRmOption) error {
84 options, err := caopts.BlockRmOptions(opts...)
85 if err != nil {
86 return err
@@ -105,7 +106,7 @@ func (api *BlockAPI) Rm(ctx context.Context, p iface.Path, opts ...caopts.BlockR
106 return nil
107 }
108
108 -func (api *BlockAPI) Stat(ctx context.Context, p iface.Path) (iface.BlockStat, error) {
109 +func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (iface.BlockStat, error) {
110 var out blockStat
111 err := api.core().Request("block/stat", p.String()).Exec(ctx, &out)
112 if err != nil {
client/httpapi/dag.go
+3 -3
@@ -9,8 +9,8 @@ import (
9 "github.com/ipfs/go-block-format"
10 "github.com/ipfs/go-cid"
11 "github.com/ipfs/go-ipld-format"
12 - "github.com/ipfs/interface-go-ipfs-core"
12 "github.com/ipfs/interface-go-ipfs-core/options"
13 + "github.com/ipfs/interface-go-ipfs-core/path"
14 )
15
16 type httpNodeAdder HttpApi
@@ -18,7 +18,7 @@ type HttpDagServ httpNodeAdder
18 type pinningHttpNodeAdder httpNodeAdder
19
20 func (api *HttpDagServ) Get(ctx context.Context, c cid.Cid) (format.Node, error) {
21 - r, err := api.core().Block().Get(ctx, iface.IpldPath(c))
21 + r, err := api.core().Block().Get(ctx, path.IpldPath(c))
22 if err != nil {
23 return nil, err
24 }
@@ -105,7 +105,7 @@ func (api *HttpDagServ) Pinning() format.NodeAdder {
105 }
106
107 func (api *HttpDagServ) Remove(ctx context.Context, c cid.Cid) error {
108 - return api.core().Block().Rm(ctx, iface.IpldPath(c)) //TODO: should we force rm?
108 + return api.core().Block().Rm(ctx, path.IpldPath(c)) //TODO: should we force rm?
109 }
110
111 func (api *HttpDagServ) RemoveMany(ctx context.Context, cids []cid.Cid) error {
client/httpapi/dht.go
+3 -3
@@ -4,8 +4,8 @@ import (
4 "context"
5 "encoding/json"
6
7 - "github.com/ipfs/interface-go-ipfs-core"
7 caopts "github.com/ipfs/interface-go-ipfs-core/options"
8 + "github.com/ipfs/interface-go-ipfs-core/path"
9 "github.com/libp2p/go-libp2p-peer"
10 "github.com/libp2p/go-libp2p-peerstore"
11 notif "github.com/libp2p/go-libp2p-routing/notifications"
@@ -37,7 +37,7 @@ func (api *DhtAPI) FindPeer(ctx context.Context, p peer.ID) (peerstore.PeerInfo,
37 }
38 }
39
40 -func (api *DhtAPI) FindProviders(ctx context.Context, p iface.Path, opts ...caopts.DhtFindProvidersOption) (<-chan peerstore.PeerInfo, error) {
40 +func (api *DhtAPI) FindProviders(ctx context.Context, p path.Path, opts ...caopts.DhtFindProvidersOption) (<-chan peerstore.PeerInfo, error) {
41 options, err := caopts.DhtFindProvidersOptions(opts...)
42 if err != nil {
43 return nil, err
@@ -93,7 +93,7 @@ func (api *DhtAPI) FindProviders(ctx context.Context, p iface.Path, opts ...caop
93 return res, nil
94 }
95
96 -func (api *DhtAPI) Provide(ctx context.Context, p iface.Path, opts ...caopts.DhtProvideOption) error {
96 +func (api *DhtAPI) Provide(ctx context.Context, p path.Path, opts ...caopts.DhtProvideOption) error {
97 options, err := caopts.DhtProvideOptions(opts...)
98 if err != nil {
99 return err
client/httpapi/key.go
+3 -3
@@ -6,6 +6,7 @@ import (
6
7 "github.com/ipfs/interface-go-ipfs-core"
8 caopts "github.com/ipfs/interface-go-ipfs-core/options"
9 + "github.com/ipfs/interface-go-ipfs-core/path"
10 "github.com/libp2p/go-libp2p-peer"
11 )
12
@@ -22,9 +23,8 @@ func (k *keyOutput) Name() string {
23 return k.JName
24 }
25
25 -func (k *keyOutput) Path() iface.Path {
26 - p, _ := iface.ParsePath("/ipns/" + k.Id)
27 - return p
26 +func (k *keyOutput) Path() path.Path {
27 + return path.New("/ipns/" + k.Id)
28 }
29
30 func (k *keyOutput) ID() peer.ID {
client/httpapi/name.go
+9 -8
@@ -9,6 +9,7 @@ import (
9 "github.com/ipfs/interface-go-ipfs-core"
10 caopts "github.com/ipfs/interface-go-ipfs-core/options"
11 "github.com/ipfs/interface-go-ipfs-core/options/namesys"
12 + "github.com/ipfs/interface-go-ipfs-core/path"
13 )
14
15 type NameAPI HttpApi
@@ -17,18 +18,18 @@ type ipnsEntry struct {
18 JName string `json:"Name"`
19 JValue string `json:"Value"`
20
20 - path iface.Path
21 + path path.Path
22 }
23
24 func (e *ipnsEntry) Name() string {
25 return e.JName
26 }
27
27 -func (e *ipnsEntry) Value() iface.Path {
28 +func (e *ipnsEntry) Value() path.Path {
29 return e.path
30 }
31
31 -func (api *NameAPI) Publish(ctx context.Context, p iface.Path, opts ...caopts.NamePublishOption) (iface.IpnsEntry, error) {
32 +func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.NamePublishOption) (iface.IpnsEntry, error) {
33 options, err := caopts.NamePublishOptions(opts...)
34 if err != nil {
35 return nil, err
@@ -48,8 +49,8 @@ func (api *NameAPI) Publish(ctx context.Context, p iface.Path, opts ...caopts.Na
49 if err := req.Exec(ctx, &out); err != nil {
50 return nil, err
51 }
51 - out.path, err = iface.ParsePath(out.JValue)
52 - return &out, err
52 + out.path = path.New(out.JValue)
53 + return &out, out.path.IsValid()
54 }
55
56 func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.NameResolveOption) (<-chan iface.IpnsResult, error) {
@@ -93,7 +94,7 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
94 }
95 var ires iface.IpnsResult
96 if err == nil {
96 - ires.Path, err = iface.ParsePath(out.Path)
97 + ires.Path = path.New(out.Path)
98 }
99
100 select {
@@ -109,7 +110,7 @@ func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.Name
110 return res, nil
111 }
112
112 -func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (iface.Path, error) {
113 +func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (path.Path, error) {
114 options, err := caopts.NameResolveOptions(opts...)
115 if err != nil {
116 return nil, err
@@ -131,7 +132,7 @@ func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.Nam
132 return nil, err
133 }
134
134 - return iface.ParsePath(out.Path)
135 + return path.New(out.Path), nil
136 }
137
138 func (api *NameAPI) core() *HttpApi {
client/httpapi/object.go
+18 -17
@@ -14,6 +14,7 @@ import (
14 ft "github.com/ipfs/go-unixfs"
15 "github.com/ipfs/interface-go-ipfs-core"
16 caopts "github.com/ipfs/interface-go-ipfs-core/options"
17 + "github.com/ipfs/interface-go-ipfs-core/path"
18 )
19
20 type ObjectAPI HttpApi
@@ -41,7 +42,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
42 return n, nil
43 }
44
44 -func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.ObjectPutOption) (iface.ResolvedPath, error) {
45 +func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.ObjectPutOption) (path.Resolved, error) {
46 options, err := caopts.ObjectPutOptions(opts...)
47 if err != nil {
48 return nil, err
@@ -63,10 +64,10 @@ func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.Objec
64 return nil, err
65 }
66
66 - return iface.IpfsPath(c), nil
67 + return path.IpfsPath(c), nil
68 }
69
69 -func (api *ObjectAPI) Get(ctx context.Context, p iface.Path) (ipld.Node, error) {
70 +func (api *ObjectAPI) Get(ctx context.Context, p path.Path) (ipld.Node, error) {
71 r, err := api.core().Block().Get(ctx, p)
72 if err != nil {
73 return nil, err
@@ -79,7 +80,7 @@ func (api *ObjectAPI) Get(ctx context.Context, p iface.Path) (ipld.Node, error)
80 return merkledag.DecodeProtobuf(b)
81 }
82
82 -func (api *ObjectAPI) Data(ctx context.Context, p iface.Path) (io.Reader, error) {
83 +func (api *ObjectAPI) Data(ctx context.Context, p path.Path) (io.Reader, error) {
84 resp, err := api.core().Request("object/data", p.String()).Send(ctx)
85 if err != nil {
86 return nil, err
@@ -98,7 +99,7 @@ func (api *ObjectAPI) Data(ctx context.Context, p iface.Path) (io.Reader, error)
99 return b, nil
100 }
101
101 -func (api *ObjectAPI) Links(ctx context.Context, p iface.Path) ([]*ipld.Link, error) {
102 +func (api *ObjectAPI) Links(ctx context.Context, p path.Path) ([]*ipld.Link, error) {
103 var out struct {
104 Links []struct {
105 Name string
@@ -126,7 +127,7 @@ func (api *ObjectAPI) Links(ctx context.Context, p iface.Path) ([]*ipld.Link, er
127 return res, nil
128 }
129
129 -func (api *ObjectAPI) Stat(ctx context.Context, p iface.Path) (*iface.ObjectStat, error) {
130 +func (api *ObjectAPI) Stat(ctx context.Context, p path.Path) (*iface.ObjectStat, error) {
131 var out struct {
132 Hash string
133 NumLinks int
@@ -154,7 +155,7 @@ func (api *ObjectAPI) Stat(ctx context.Context, p iface.Path) (*iface.ObjectStat
155 }, nil
156 }
157
157 -func (api *ObjectAPI) AddLink(ctx context.Context, base iface.Path, name string, child iface.Path, opts ...caopts.ObjectAddLinkOption) (iface.ResolvedPath, error) {
158 +func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...caopts.ObjectAddLinkOption) (path.Resolved, error) {
159 options, err := caopts.ObjectAddLinkOptions(opts...)
160 if err != nil {
161 return nil, err
@@ -173,10 +174,10 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base iface.Path, name string,
174 return nil, err
175 }
176
176 - return iface.IpfsPath(c), nil
177 + return path.IpfsPath(c), nil
178 }
179
179 -func (api *ObjectAPI) RmLink(ctx context.Context, base iface.Path, link string) (iface.ResolvedPath, error) {
180 +func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (path.Resolved, error) {
181 var out objectOut
182 err := api.core().Request("object/patch/rm-link", base.String(), link).
183 Exec(ctx, &out)
@@ -189,10 +190,10 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base iface.Path, link string)
190 return nil, err
191 }
192
192 - return iface.IpfsPath(c), nil
193 + return path.IpfsPath(c), nil
194 }
195
195 -func (api *ObjectAPI) AppendData(ctx context.Context, p iface.Path, r io.Reader) (iface.ResolvedPath, error) {
196 +func (api *ObjectAPI) AppendData(ctx context.Context, p path.Path, r io.Reader) (path.Resolved, error) {
197 var out objectOut
198 err := api.core().Request("object/patch/append-data", p.String()).
199 FileBody(r).
@@ -206,10 +207,10 @@ func (api *ObjectAPI) AppendData(ctx context.Context, p iface.Path, r io.Reader)
207 return nil, err
208 }
209
209 - return iface.IpfsPath(c), nil
210 + return path.IpfsPath(c), nil
211 }
212
212 -func (api *ObjectAPI) SetData(ctx context.Context, p iface.Path, r io.Reader) (iface.ResolvedPath, error) {
213 +func (api *ObjectAPI) SetData(ctx context.Context, p path.Path, r io.Reader) (path.Resolved, error) {
214 var out objectOut
215 err := api.core().Request("object/patch/set-data", p.String()).
216 FileBody(r).
@@ -223,7 +224,7 @@ func (api *ObjectAPI) SetData(ctx context.Context, p iface.Path, r io.Reader) (i
224 return nil, err
225 }
226
226 - return iface.IpfsPath(c), nil
227 + return path.IpfsPath(c), nil
228 }
229
230 type change struct {
@@ -233,7 +234,7 @@ type change struct {
234 After cid.Cid
235 }
236
236 -func (api *ObjectAPI) Diff(ctx context.Context, a iface.Path, b iface.Path) ([]iface.ObjectChange, error) {
237 +func (api *ObjectAPI) Diff(ctx context.Context, a path.Path, b path.Path) ([]iface.ObjectChange, error) {
238 var out struct {
239 Changes []change
240 }
@@ -247,10 +248,10 @@ func (api *ObjectAPI) Diff(ctx context.Context, a iface.Path, b iface.Path) ([]i
248 Path: ch.Path,
249 }
250 if ch.Before != cid.Undef {
250 - res[i].Before = iface.IpfsPath(ch.Before)
251 + res[i].Before = path.IpfsPath(ch.Before)
252 }
253 if ch.After != cid.Undef {
253 - res[i].After = iface.IpfsPath(ch.After)
254 + res[i].After = path.IpfsPath(ch.After)
255 }
256 }
257 return res, nil
client/httpapi/path.go
+9 -9
@@ -6,10 +6,10 @@ import (
6 cid "github.com/ipfs/go-cid"
7 ipld "github.com/ipfs/go-ipld-format"
8 ipfspath "github.com/ipfs/go-path"
9 - "github.com/ipfs/interface-go-ipfs-core"
9 + "github.com/ipfs/interface-go-ipfs-core/path"
10 )
11
12 -func (api *HttpApi) ResolvePath(ctx context.Context, path iface.Path) (iface.ResolvedPath, error) {
12 +func (api *HttpApi) ResolvePath(ctx context.Context, p path.Path) (path.Resolved, error) {
13 var out struct {
14 Cid cid.Cid
15 RemPath string
@@ -18,31 +18,31 @@ func (api *HttpApi) ResolvePath(ctx context.Context, path iface.Path) (iface.Res
18 //TODO: this is hacky, fixing https://github.com/ipfs/go-ipfs/issues/5703 would help
19
20 var err error
21 - if path.Namespace() == "ipns" {
22 - if path, err = api.Name().Resolve(ctx, path.String()); err != nil {
21 + if p.Namespace() == "ipns" {
22 + if p, err = api.Name().Resolve(ctx, p.String()); err != nil {
23 return nil, err
24 }
25 }
26
27 - if err := api.Request("dag/resolve", path.String()).Exec(ctx, &out); err != nil {
27 + if err := api.Request("dag/resolve", p.String()).Exec(ctx, &out); err != nil {
28 return nil, err
29 }
30
31 // TODO:
32 - ipath, err := ipfspath.FromSegments("/"+path.Namespace()+"/", out.Cid.String(), out.RemPath)
32 + ipath, err := ipfspath.FromSegments("/"+p.Namespace()+"/", out.Cid.String(), out.RemPath)
33 if err != nil {
34 return nil, err
35 }
36
37 - root, err := cid.Parse(ipfspath.Path(path.String()).Segments()[1])
37 + root, err := cid.Parse(ipfspath.Path(p.String()).Segments()[1])
38 if err != nil {
39 return nil, err
40 }
41
42 - return iface.NewResolvedPath(ipath, out.Cid, root, out.RemPath), nil
42 + return path.NewResolvedPath(ipath, out.Cid, root, out.RemPath), nil
43 }
44
45 -func (api *HttpApi) ResolveNode(ctx context.Context, p iface.Path) (ipld.Node, error) {
45 +func (api *HttpApi) ResolveNode(ctx context.Context, p path.Path) (ipld.Node, error) {
46 rp, err := api.ResolvePath(ctx, p)
47 if err != nil {
48 return nil, err
client/httpapi/pin.go
+9 -8
@@ -7,6 +7,7 @@ import (
7 "github.com/ipfs/go-cid"
8 "github.com/ipfs/interface-go-ipfs-core"
9 caopts "github.com/ipfs/interface-go-ipfs-core/options"
10 + "github.com/ipfs/interface-go-ipfs-core/path"
11 "github.com/pkg/errors"
12 )
13
@@ -21,11 +22,11 @@ type pinRefKeyList struct {
22 }
23
24 type pin struct {
24 - path iface.ResolvedPath
25 + path path.Resolved
26 typ string
27 }
28
28 -func (p *pin) Path() iface.ResolvedPath {
29 +func (p *pin) Path() path.Resolved {
30 return p.path
31 }
32
@@ -33,7 +34,7 @@ func (p *pin) Type() string {
34 return p.typ
35 }
36
36 -func (api *PinAPI) Add(ctx context.Context, p iface.Path, opts ...caopts.PinAddOption) error {
37 +func (api *PinAPI) Add(ctx context.Context, p path.Path, opts ...caopts.PinAddOption) error {
38 options, err := caopts.PinAddOptions(opts...)
39 if err != nil {
40 return err
@@ -62,13 +63,13 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]iface.
63 if err != nil {
64 return nil, err
65 }
65 - pins = append(pins, &pin{typ: p.Type, path: iface.IpldPath(c)})
66 + pins = append(pins, &pin{typ: p.Type, path: path.IpldPath(c)})
67 }
68
69 return pins, nil
70 }
71
71 -func (api *PinAPI) Rm(ctx context.Context, p iface.Path, opts ...caopts.PinRmOption) error {
72 +func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOption) error {
73 options, err := caopts.PinRmOptions(opts...)
74 if err != nil {
75 return err
@@ -79,7 +80,7 @@ func (api *PinAPI) Rm(ctx context.Context, p iface.Path, opts ...caopts.PinRmOpt
80 Exec(ctx, nil)
81 }
82
82 -func (api *PinAPI) Update(ctx context.Context, from iface.Path, to iface.Path, opts ...caopts.PinUpdateOption) error {
83 +func (api *PinAPI) Update(ctx context.Context, from path.Path, to path.Path, opts ...caopts.PinUpdateOption) error {
84 options, err := caopts.PinUpdateOptions(opts...)
85 if err != nil {
86 return err
@@ -107,8 +108,8 @@ type badNode struct {
108 cid cid.Cid
109 }
110
110 -func (n *badNode) Path() iface.ResolvedPath {
111 - return iface.IpldPath(n.cid)
111 +func (n *badNode) Path() path.Resolved {
112 + return path.IpldPath(n.cid)
113 }
114
115 func (n *badNode) Err() error {
client/httpapi/unixfs.go
+5 -4
@@ -13,6 +13,7 @@ import (
13 unixfs_pb "github.com/ipfs/go-unixfs/pb"
14 iface "github.com/ipfs/interface-go-ipfs-core"
15 caopts "github.com/ipfs/interface-go-ipfs-core/options"
16 + "github.com/ipfs/interface-go-ipfs-core/path"
17 mh "github.com/multiformats/go-multihash"
18 )
19
@@ -25,7 +26,7 @@ type addEvent struct {
26
27 type UnixfsAPI HttpApi
28
28 -func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.UnixfsAddOption) (iface.ResolvedPath, error) {
29 +func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.UnixfsAddOption) (path.Resolved, error) {
30 options, _, err := caopts.UnixfsAddOptions(opts...)
31 if err != nil {
32 return nil, err
@@ -98,7 +99,7 @@ loop:
99 return nil, err
100 }
101
101 - ifevt.Path = iface.IpfsPath(c)
102 + ifevt.Path = path.IpfsPath(c)
103 }
104
105 select {
@@ -114,7 +115,7 @@ loop:
115 return nil, err
116 }
117
117 - return iface.IpfsPath(c), nil
118 + return path.IpfsPath(c), nil
119 }
120
121 type lsLink struct {
@@ -133,7 +134,7 @@ type lsOutput struct {
134 Objects []lsObject
135 }
136
136 -func (api *UnixfsAPI) Ls(ctx context.Context, p iface.Path, opts ...caopts.UnixfsLsOption) (<-chan iface.DirEntry, error) {
137 +func (api *UnixfsAPI) Ls(ctx context.Context, p path.Path, opts ...caopts.UnixfsLsOption) (<-chan iface.DirEntry, error) {
138 options, err := caopts.UnixfsLsOptions(opts...)
139 if err != nil {
140 return nil, err