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
a0aa07e3
Commit
a0aa07e3
authored
May 29, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename root to last
parent
38479ff1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
importer/helpers/dagbuilder.go
importer/helpers/dagbuilder.go
+4
-3
importer/importer.go
importer/importer.go
+3
-3
No files found.
importer/helpers/dagbuilder.go
View file @
a0aa07e3
...
@@ -6,9 +6,10 @@ import (
...
@@ -6,9 +6,10 @@ import (
)
)
// NodeCB is callback function for dag generation
// NodeCB is callback function for dag generation
// the `root` flag signifies whether or not this is
// the `last` flag signifies whether or not this is the last
// the root of a dag.
// (top-most root) node being added. useful for things like
type
NodeCB
func
(
node
*
dag
.
Node
,
root
bool
)
error
// only pinning the first node recursively.
type
NodeCB
func
(
node
*
dag
.
Node
,
last
bool
)
error
var
nilFunc
NodeCB
=
func
(
_
*
dag
.
Node
,
_
bool
)
error
{
return
nil
}
var
nilFunc
NodeCB
=
func
(
_
*
dag
.
Node
,
_
bool
)
error
{
return
nil
}
...
...
importer/importer.go
View file @
a0aa07e3
...
@@ -66,13 +66,13 @@ func BuildTrickleDagFromReader(r io.Reader, ds dag.DAGService, spl chunk.BlockSp
...
@@ -66,13 +66,13 @@ func BuildTrickleDagFromReader(r io.Reader, ds dag.DAGService, spl chunk.BlockSp
}
}
func
BasicPinnerCB
(
p
pin
.
ManualPinner
)
h
.
NodeCB
{
func
BasicPinnerCB
(
p
pin
.
ManualPinner
)
h
.
NodeCB
{
return
func
(
n
*
dag
.
Node
,
roo
t
bool
)
error
{
return
func
(
n
*
dag
.
Node
,
las
t
bool
)
error
{
k
,
err
:=
n
.
Key
()
k
,
err
:=
n
.
Key
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
roo
t
{
if
las
t
{
p
.
PinWithMode
(
k
,
pin
.
Recursive
)
p
.
PinWithMode
(
k
,
pin
.
Recursive
)
return
p
.
Flush
()
return
p
.
Flush
()
}
else
{
}
else
{
...
@@ -83,7 +83,7 @@ func BasicPinnerCB(p pin.ManualPinner) h.NodeCB {
...
@@ -83,7 +83,7 @@ func BasicPinnerCB(p pin.ManualPinner) h.NodeCB {
}
}
func
PinIndirectCB
(
p
pin
.
ManualPinner
)
h
.
NodeCB
{
func
PinIndirectCB
(
p
pin
.
ManualPinner
)
h
.
NodeCB
{
return
func
(
n
*
dag
.
Node
,
roo
t
bool
)
error
{
return
func
(
n
*
dag
.
Node
,
las
t
bool
)
error
{
k
,
err
:=
n
.
Key
()
k
,
err
:=
n
.
Key
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
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