Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
cb5bb7dd
Unverified
Commit
cb5bb7dd
authored
Jan 30, 2018
by
Whyrusleeping
Committed by
GitHub
Jan 30, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4627 from ipfs/fix/merge-snafoo
fix hidden merge conflicts
parents
4d8b3c9b
9c67eb4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
core/coreapi/object.go
core/coreapi/object.go
+17
-18
No files found.
core/coreapi/object.go
View file @
cb5bb7dd
...
...
@@ -3,23 +3,22 @@ package coreapi
import
(
"bytes"
"context"
"encoding/base64"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
"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"
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"
"encoding/base64"
"encoding/json"
"encoding/xml"
"errors"
"fmt"
node
"gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format"
cid
"gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid"
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment