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-merkledag
Commits
b7715c8a
Commit
b7715c8a
authored
Aug 12, 2015
by
Jeromy
Committed by
Juan Batiz-Benet
Sep 05, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
an attempt at making the editor more efficient
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
dbcf68e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
utils/utils.go
utils/utils.go
+29
-0
No files found.
utils/utils.go
View file @
b7715c8a
...
...
@@ -151,3 +151,32 @@ func rmLink(ctx context.Context, ds dag.DAGService, root *dag.Node, path []strin
return
root
,
nil
}
func
(
e
*
Editor
)
WriteOutputTo
(
ds
dag
.
DAGService
)
error
{
return
copyDag
(
e
.
GetNode
(),
e
.
ds
,
ds
)
}
func
copyDag
(
nd
*
dag
.
Node
,
from
,
to
dag
.
DAGService
)
error
{
_
,
err
:=
to
.
Add
(
nd
)
if
err
!=
nil
{
return
err
}
for
_
,
lnk
:=
range
nd
.
Links
{
child
,
err
:=
lnk
.
GetNode
(
context
.
Background
(),
from
)
if
err
!=
nil
{
if
err
==
dag
.
ErrNotFound
{
// not found means we didnt modify it, and it should
// already be in the target datastore
continue
}
return
err
}
err
=
copyDag
(
child
,
from
,
to
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
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