Addressed reviews
This commit is contained in:
parent
adc7c5b131
commit
6543c0c79b
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user