Skip to content

Commit

Permalink
Use api instead of node for block and path
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 20fdedd commit 1a07bc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions core/coreapi/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ func (api *BlockAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Bloc
return nil, err
}

//<<<<<<< HEAD
if settings.Pin {
api.pinning.PinWithMode(b.Cid(), pin.Recursive)
}
//=======
// api.node.Provider.Provide(b.Cid())
//>>>>>>> Add provider to ipfs and provide when adding/fetching

api.provider.Provide(b.Cid())

return &BlockStat{path: coreiface.IpldPath(b.Cid()), size: len(data)}, nil
}
Expand All @@ -75,7 +73,7 @@ func (api *BlockAPI) Get(ctx context.Context, p coreiface.Path) (io.Reader, erro
return nil, err
}

//api.node.Provider.Provide(rp.Cid())
api.provider.Provide(rp.Cid())

return bytes.NewReader(b.RawData()), nil
}
Expand Down Expand Up @@ -129,7 +127,7 @@ func (api *BlockAPI) Stat(ctx context.Context, p coreiface.Path) (coreiface.Bloc
return nil, err
}

//api.node.Provider.Provide(b.Cid())
api.provider.Provide(b.Cid())

return &BlockStat{
path: coreiface.IpldPath(b.Cid()),
Expand Down
2 changes: 1 addition & 1 deletion core/coreapi/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (ipld.Nod
return nil, err
}

//api.node.Provider.Provide(node.Cid())
api.provider.Provide(node.Cid())

return node, nil
}
Expand Down

0 comments on commit 1a07bc3

Please sign in to comment.