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
861f30cc
Commit
861f30cc
authored
Apr 20, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't readd entire directories recursively
parent
d7c91992
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
17 deletions
+4
-17
core/commands/add.go
core/commands/add.go
+1
-10
core/commands/object.go
core/commands/object.go
+3
-7
No files found.
core/commands/add.go
View file @
861f30cc
...
...
@@ -232,15 +232,6 @@ func add(n *core.IpfsNode, readers []io.Reader) ([]*dag.Node, error) {
return
dagnodes
,
nil
}
func
addNode
(
n
*
core
.
IpfsNode
,
node
*
dag
.
Node
)
error
{
err
:=
n
.
DAG
.
AddRecursive
(
node
)
// add the file to the graph + local storage
if
err
!=
nil
{
return
err
}
return
nil
}
func
addFile
(
n
*
core
.
IpfsNode
,
file
files
.
File
,
out
chan
interface
{},
progress
bool
,
wrap
bool
)
(
*
dag
.
Node
,
error
)
{
if
file
.
IsDirectory
()
{
return
addDir
(
n
,
file
,
out
,
progress
)
...
...
@@ -309,7 +300,7 @@ func addDir(n *core.IpfsNode, dir files.File, out chan interface{}, progress boo
return
nil
,
err
}
err
=
addNode
(
n
,
tree
)
_
,
err
=
n
.
DAG
.
Add
(
tree
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
core/commands/object.go
View file @
861f30cc
...
...
@@ -384,13 +384,8 @@ var ErrEmptyNode = errors.New("no data or links in this node")
// objectPut takes a format option, serializes bytes from stdin and updates the dag with that data
func
objectPut
(
n
*
core
.
IpfsNode
,
input
io
.
Reader
,
encoding
string
)
(
*
Object
,
error
)
{
var
(
dagnode
*
dag
.
Node
data
[]
byte
err
error
)
data
,
err
=
ioutil
.
ReadAll
(
io
.
LimitReader
(
input
,
inputLimit
+
10
))
data
,
err
:
=
ioutil
.
ReadAll
(
io
.
LimitReader
(
input
,
inputLimit
+
10
))
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -399,6 +394,7 @@ func objectPut(n *core.IpfsNode, input io.Reader, encoding string) (*Object, err
return
nil
,
ErrObjectTooLarge
}
var
dagnode
*
dag
.
Node
switch
getObjectEnc
(
encoding
)
{
case
objectEncodingJSON
:
node
:=
new
(
Node
)
...
...
@@ -429,7 +425,7 @@ func objectPut(n *core.IpfsNode, input io.Reader, encoding string) (*Object, err
return
nil
,
err
}
err
=
addNode
(
n
,
dagnode
)
_
,
err
=
n
.
DAG
.
Add
(
dagnode
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
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