提交 a0aa07e3 作者: Jeromy

rename root to last

上级 38479ff1
......@@ -6,9 +6,10 @@ import (
)
// NodeCB is callback function for dag generation
// the `root` flag signifies whether or not this is
// the root of a dag.
type NodeCB func(node *dag.Node, root bool) error
// the `last` flag signifies whether or not this is the last
// (top-most root) node being added. useful for things like
// 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 }
......
......@@ -66,13 +66,13 @@ func BuildTrickleDagFromReader(r io.Reader, ds dag.DAGService, spl chunk.BlockSp
}
func BasicPinnerCB(p pin.ManualPinner) h.NodeCB {
return func(n *dag.Node, root bool) error {
return func(n *dag.Node, last bool) error {
k, err := n.Key()
if err != nil {
return err
}
if root {
if last {
p.PinWithMode(k, pin.Recursive)
return p.Flush()
} else {
......@@ -83,7 +83,7 @@ func BasicPinnerCB(p pin.ManualPinner) h.NodeCB {
}
func PinIndirectCB(p pin.ManualPinner) h.NodeCB {
return func(n *dag.Node, root bool) error {
return func(n *dag.Node, last bool) error {
k, err := n.Key()
if err != nil {
return err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论