Addressed reviews

This commit is contained in:
Kishan Mohanbhai Sagathiya 2019-09-10 15:56:35 +07:00
parent adc7c5b131
commit 6543c0c79b
3 changed files with 2 additions and 17 deletions

View File

@ -49,7 +49,7 @@ func New(rpc *rpc.Client, opts api.PinOptions, local bool) *DAGService {
// Add puts the given node in the destination peers.
func (dgs *DAGService) Add(ctx context.Context, node ipld.Node) error {
if dgs.local {
return adder.AddNodeLocal(ctx, dgs.rpcClient, node)
return adder.NewBlockAdder(dgs.rpcClient, []peer.ID{""}).Add(ctx, node)
}
if dgs.dests == nil {

View File

@ -142,21 +142,6 @@ func Pin(ctx context.Context, rpc *rpc.Client, pin *api.Pin) error {
)
}
// AddNodeLocal puts the given node to the local peer.
func AddNodeLocal(ctx context.Context, rpc *rpc.Client, node ipld.Node) error {
nodeSerial := ipldNodeToNodeWithMeta(node)
logger.Debugf("block put %s to local peer", nodeSerial.Cid)
return rpc.CallContext(
ctx,
"", // use ourself to pin
"IPFSConnector",
"BlockPut",
nodeSerial,
&struct{}{},
)
}
// ErrDAGNotFound is returned whenever we try to get a block from the DAGService.
var ErrDAGNotFound = errors.New("dagservice: block not found")

View File

@ -1551,7 +1551,7 @@ func (c *Cluster) AddFile(reader *multipart.Reader, params *api.AddParams) (cid.
if params.Shard {
dags = sharding.New(c.rpcClient, params.PinOptions, nil)
} else {
dags = single.New(c.rpcClient, params.PinOptions, false)
dags = single.New(c.rpcClient, params.PinOptions, params.Local)
}
add := adder.New(dags, params, nil)
return add.FromMultipart(c.ctx, reader)