Unverified Commit cb5bb7dd authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

Merge pull request #4627 from ipfs/fix/merge-snafoo

fix hidden merge conflicts
parents 4d8b3c9b 9c67eb4c
...@@ -3,23 +3,22 @@ package coreapi ...@@ -3,23 +3,22 @@ package coreapi
import ( import (
"bytes" "bytes"
"context" "context"
"encoding/base64"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"io" "io"
"io/ioutil" "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" 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" dag "github.com/ipfs/go-ipfs/merkledag"
dagutils "github.com/ipfs/go-ipfs/merkledag/utils"
ft "github.com/ipfs/go-ipfs/unixfs" ft "github.com/ipfs/go-ipfs/unixfs"
"encoding/base64" cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
"encoding/json" ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
"encoding/xml"
"errors"
"fmt"
node "gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format"
cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
) )
const inputLimit = 2 << 20 const inputLimit = 2 << 20
...@@ -45,7 +44,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) ( ...@@ -45,7 +44,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
return nil, err return nil, err
} }
var n node.Node var n ipld.Node
switch options.Type { switch options.Type {
case "empty": case "empty":
n = new(dag.ProtoNode) n = new(dag.ProtoNode)
...@@ -53,7 +52,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) ( ...@@ -53,7 +52,7 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
n = ft.EmptyDirNode() n = ft.EmptyDirNode()
} }
_, err = api.node.DAG.Add(n) err = api.node.DAG.Add(ctx, n)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -120,7 +119,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj ...@@ -120,7 +119,7 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj
return nil, err return nil, err
} }
_, err = api.node.DAG.Add(dagnode) err = api.node.DAG.Add(ctx, dagnode)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -217,7 +216,7 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name str ...@@ -217,7 +216,7 @@ func (api *ObjectAPI) AddLink(ctx context.Context, base coreiface.Path, name str
return nil, err return nil, err
} }
nnode, err := e.Finalize(api.node.DAG) nnode, err := e.Finalize(ctx, api.node.DAG)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -243,7 +242,7 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link stri ...@@ -243,7 +242,7 @@ func (api *ObjectAPI) RmLink(ctx context.Context, base coreiface.Path, link stri
return nil, err return nil, err
} }
nnode, err := e.Finalize(api.node.DAG) nnode, err := e.Finalize(ctx, api.node.DAG)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -280,7 +279,7 @@ func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.R ...@@ -280,7 +279,7 @@ func (api *ObjectAPI) patchData(ctx context.Context, path coreiface.Path, r io.R
} }
pbnd.SetData(data) pbnd.SetData(data)
_, err = api.node.DAG.Add(pbnd) err = api.node.DAG.Add(ctx, pbnd)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -304,13 +303,13 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) ...@@ -304,13 +303,13 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error)
return nil, fmt.Errorf("Unkown data field encoding") 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 { for i, link := range nd.Links {
c, err := cid.Decode(link.Hash) c, err := cid.Decode(link.Hash)
if err != nil { if err != nil {
return nil, err return nil, err
} }
dagnode.Links()[i] = &node.Link{ dagnode.Links()[i] = &ipld.Link{
Name: link.Name, Name: link.Name,
Size: link.Size, Size: link.Size,
Cid: c, Cid: c,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment