mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
Merge pull request #4627 from ipfs/fix/merge-snafoo
fix hidden merge conflicts
This commit is contained in:
@ -3,23 +3,22 @@ package coreapi
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
||||
dagutils "github.com/ipfs/go-ipfs/merkledag/utils"
|
||||
|
||||
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
|
||||
dag "github.com/ipfs/go-ipfs/merkledag"
|
||||
ft "github.com/ipfs/go-ipfs/unixfs"
|
||||
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
node "gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format"
|
||||
cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
|
||||
caopts "github.com/ipfs/go-ipfs/core/coreapi/interface/options"
|
||||
dag "github.com/ipfs/go-ipfs/merkledag"
|
||||
dagutils "github.com/ipfs/go-ipfs/merkledag/utils"
|
||||
ft "github.com/ipfs/go-ipfs/unixfs"
|
||||
|
||||
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
||||
ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
|
||||
)
|
||||
|
||||
const inputLimit = 2 << 20
|
||||
@ -45,7 +44,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var n node.Node
|
||||
var n ipld.Node
|
||||
switch options.Type {
|
||||
case "empty":
|
||||
n = new(dag.ProtoNode)
|
||||
@ -53,7 +52,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
|
||||
n = ft.EmptyDirNode()
|
||||
}
|
||||
|
||||
_, err = api.node.DAG.Add(n)
|
||||
err = api.node.DAG.Add(ctx, n)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -120,7 +119,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = api.node.DAG.Add(dagnode)
|
||||
err = api.node.DAG.Add(ctx, dagnode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -217,7 +216,7 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name str
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nnode, err := e.Finalize(api.node.DAG)
|
||||
nnode, err := e.Finalize(ctx, api.node.DAG)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -243,7 +242,7 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link stri
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nnode, err := e.Finalize(api.node.DAG)
|
||||
nnode, err := e.Finalize(ctx, api.node.DAG)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -280,7 +279,7 @@ func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.R
|
||||
}
|
||||
pbnd.SetData(data)
|
||||
|
||||
_, err = api.node.DAG.Add(pbnd)
|
||||
err = api.node.DAG.Add(ctx, pbnd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -304,13 +303,13 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error)
|
||||
return nil, fmt.Errorf("Unkown data field encoding")
|
||||
}
|
||||
|
||||
dagnode.SetLinks(make([]*node.Link, len(nd.Links)))
|
||||
dagnode.SetLinks(make([]*ipld.Link, len(nd.Links)))
|
||||
for i, link := range nd.Links {
|
||||
c, err := cid.Decode(link.Hash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dagnode.Links()[i] = &node.Link{
|
||||
dagnode.Links()[i] = &ipld.Link{
|
||||
Name: link.Name,
|
||||
Size: link.Size,
|
||||
Cid: c,
|
||||
|
Reference in New Issue
Block a user