提交 bfe7ad7e 作者: Kevin Atkinson

merkledag: optimize DagService GetLinks for Raw Nodes.

A Raw Node can not possible have links, so there is no need to retrive
the node.

Once Raw Nodes are in common usage this can likely make a big difference
in the GC and other places that just care about the Links.

License: MIT
Signed-off-by: 's avatarKevin Atkinson <k@kevina.org>
上级 1ca2d428
......@@ -114,6 +114,9 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
}
func (n *dagService) GetLinks(ctx context.Context, c *cid.Cid) ([]*node.Link, error) {
if c.Type() == cid.Raw {
return nil, nil
}
node, err := n.Get(ctx, c)
if err != nil {
return nil, err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论