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
91da11ae
Commit
91da11ae
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/commands2: Replaced NewDagFromReader with BuildDagFromReader
parent
f4d0b8ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
core/commands2/add.go
core/commands2/add.go
+8
-6
No files found.
core/commands2/add.go
View file @
91da11ae
...
...
@@ -9,7 +9,9 @@ import (
core
"github.com/jbenet/go-ipfs/core"
internal
"github.com/jbenet/go-ipfs/core/commands2/internal"
importer
"github.com/jbenet/go-ipfs/importer"
"github.com/jbenet/go-ipfs/importer/chunk"
dag
"github.com/jbenet/go-ipfs/merkledag"
pinning
"github.com/jbenet/go-ipfs/pin"
)
// Error indicating the max depth has been exceded.
...
...
@@ -35,11 +37,6 @@ var addCmd = &cmds.Command{
Run
:
func
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
n
:=
req
.
Context
()
.
Node
// if recursive, set depth to reflect so
// opt, found := req.Option("r")
// if r, _ := opt.(bool); found && r {
// }
readers
,
err
:=
internal
.
CastToReaders
(
req
.
Arguments
())
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
...
...
@@ -88,10 +85,15 @@ var addCmd = &cmds.Command{
}
func
add
(
n
*
core
.
IpfsNode
,
readers
[]
io
.
Reader
)
([]
*
dag
.
Node
,
error
)
{
mp
,
ok
:=
n
.
Pinning
.
(
pinning
.
ManualPinner
)
if
!
ok
{
return
nil
,
errors
.
New
(
"invalid pinner type! expected manual pinner"
)
}
dagnodes
:=
make
([]
*
dag
.
Node
,
0
)
for
_
,
reader
:=
range
readers
{
node
,
err
:=
importer
.
New
DagFromReader
(
reader
)
node
,
err
:=
importer
.
Build
DagFromReader
(
reader
,
n
.
DAG
,
mp
,
chunk
.
DefaultSplitter
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
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