From 20fdedd2d94d0d179c8a35c884a12b100f0f528d Mon Sep 17 00:00:00 2001 From: Michael Avila Date: Fri, 22 Feb 2019 14:30:20 -0800 Subject: [PATCH] Use api instead of node in object and unixfs License: MIT Signed-off-by: Michael Avila --- core/coreapi/object.go | 10 +++++----- core/coreapi/unixfs.go | 11 ++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/core/coreapi/object.go b/core/coreapi/object.go index 4346429ec39..0d9e4af34f4 100644 --- a/core/coreapi/object.go +++ b/core/coreapi/object.go @@ -55,7 +55,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) ( return nil, err } - //api.node.Provider.Provide(n.Cid()) + api.provider.Provide(n.Cid()) return n, nil } @@ -137,7 +137,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj } } - //api.node.Provider.Provide(dagnode.Cid()) + api.provider.Provide(dagnode.Cid()) return coreiface.IpfsPath(dagnode.Cid()), nil } @@ -236,7 +236,7 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name str return nil, err } - //api.node.Provider.Provide(nnode.Cid()) + api.provider.Provide(nnode.Cid()) return coreiface.IpfsPath(nnode.Cid()), nil } @@ -264,7 +264,7 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link stri return nil, err } - //api.node.Provider.Provide(nnode.Cid()) + api.provider.Provide(nnode.Cid()) return coreiface.IpfsPath(nnode.Cid()), nil } @@ -303,7 +303,7 @@ func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.R return nil, err } - //api.node.Provider.Provide(pbnd.Cid()) + api.provider.Provide(pbnd.Cid()) return coreiface.IpfsPath(pbnd.Cid()), nil } diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index d14129a0f24..a2d3dfa3e0f 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -130,9 +130,7 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options return nil, err } - //if !settings.Local { - // api.node.Provider.Provide(nd.Cid()) - //} + api.provider.Provide(nd.Cid()) return coreiface.IpfsPath(nd.Cid()), nil } @@ -145,13 +143,8 @@ func (api *UnixfsAPI) Get(ctx context.Context, p coreiface.Path) (files.Node, er return nil, err } -//<<<<<<< HEAD + api.provider.Provide(nd.Cid()) return unixfile.NewUnixfsFile(ctx, ses.dag, nd) -//======= -// api.node.Provider.Provide(nd.Cid()) -// -// return newUnixfsFile(ctx, ses.dag, nd, "", nil) -//>>>>>>> Add provider to ipfs and provide when adding/fetching } // Ls returns the contents of an IPFS or IPNS object(s) at path p, with the format: