Skip to content

Commit

Permalink
Use api instead of node in object and unixfs
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Michael Avila <[email protected]>
  • Loading branch information
michaelavila committed Feb 25, 2019
1 parent 1abb4ce commit 20fdedd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
10 changes: 5 additions & 5 deletions core/coreapi/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
11 changes: 2 additions & 9 deletions core/coreapi/unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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:
Expand Down

0 comments on commit 20fdedd

Please sign in to comment.